Spaces:
Running
Running
Inclusion of AI21 into board of panellists
#5
by KaanS139 - opened
ring.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
-
|
|
|
|
| 3 |
from langchain_openai import OpenAI
|
| 4 |
|
| 5 |
from langchain.prompts import PromptTemplate
|
|
@@ -11,10 +12,11 @@ LLM_GPT4 = "GPT4"
|
|
| 11 |
LLM_GPT4o = "GPT4o"
|
| 12 |
LLM_LLAMA2 = "LLAMA2"
|
| 13 |
LLM_GEMINI = "Gemini"
|
|
|
|
| 14 |
|
| 15 |
OPENAI_LLMS = [LLM_GPT35, LLM_GPT4, LLM_GPT4o]
|
| 16 |
|
| 17 |
-
PREF_ORDER_LLMS = (LLM_GEMINI, LLM_LLAMA2, LLM_GPT35, LLM_GPT4, LLM_GPT4o)
|
| 18 |
|
| 19 |
|
| 20 |
def requires_openai_key(llm_ver):
|
|
@@ -47,6 +49,11 @@ def get_gemini_api_key():
|
|
| 47 |
|
| 48 |
return gemini_api_key
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
def get_llm(llm_ver, temperature):
|
| 52 |
|
|
|
|
| 1 |
import os
|
| 2 |
+
from getpass import getpass
|
| 3 |
+
from langchain_ai21 import AI21LLM
|
| 4 |
from langchain_openai import OpenAI
|
| 5 |
|
| 6 |
from langchain.prompts import PromptTemplate
|
|
|
|
| 12 |
LLM_GPT4o = "GPT4o"
|
| 13 |
LLM_LLAMA2 = "LLAMA2"
|
| 14 |
LLM_GEMINI = "Gemini"
|
| 15 |
+
LLM_AI21 = "AI21"
|
| 16 |
|
| 17 |
OPENAI_LLMS = [LLM_GPT35, LLM_GPT4, LLM_GPT4o]
|
| 18 |
|
| 19 |
+
PREF_ORDER_LLMS = (LLM_GEMINI, LLM_LLAMA2, LLM_GPT35, LLM_GPT4, LLM_GPT4o, AI21)
|
| 20 |
|
| 21 |
|
| 22 |
def requires_openai_key(llm_ver):
|
|
|
|
| 49 |
|
| 50 |
return gemini_api_key
|
| 51 |
|
| 52 |
+
def get_ai21_api_key():
|
| 53 |
+
|
| 54 |
+
ai21_api_key = os.environ.get["AI21_API_KEY"]
|
| 55 |
+
|
| 56 |
+
return ai21_api_key
|
| 57 |
|
| 58 |
def get_llm(llm_ver, temperature):
|
| 59 |
|