Skip to content

Commit

Permalink
Merge pull request #204 from dara-network/gpt_4_turbo
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy authored Nov 7, 2023
2 parents 2df9984 + 8cbd0bb commit 9434d11
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions daras_ai_v2/language_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class LLMApis(Enum):

class LargeLanguageModels(Enum):
gpt_4 = "GPT-4 (openai)"
gpt_4_turbo = "GPT-4 Turbo (openai)"
gpt_3_5_turbo = "ChatGPT (openai)"
gpt_3_5_turbo_16k = "ChatGPT 16k (openai)"

Expand All @@ -62,6 +63,7 @@ def _deprecated(cls):
def is_chat_model(self) -> bool:
return self in [
LargeLanguageModels.gpt_4,
LargeLanguageModels.gpt_4_turbo,
LargeLanguageModels.gpt_3_5_turbo,
LargeLanguageModels.gpt_3_5_turbo_16k,
LargeLanguageModels.palm2_chat,
Expand All @@ -71,6 +73,7 @@ def is_chat_model(self) -> bool:

engine_names = {
LargeLanguageModels.gpt_4: "gpt-4",
LargeLanguageModels.gpt_4_turbo: "gpt-4-1106-preview",
LargeLanguageModels.gpt_3_5_turbo: "gpt-3.5-turbo",
LargeLanguageModels.gpt_3_5_turbo_16k: "gpt-3.5-turbo-16k",
LargeLanguageModels.text_davinci_003: "text-davinci-003",
Expand All @@ -86,6 +89,7 @@ def is_chat_model(self) -> bool:

llm_api = {
LargeLanguageModels.gpt_4: LLMApis.openai,
LargeLanguageModels.gpt_4_turbo: LLMApis.openai,
LargeLanguageModels.gpt_3_5_turbo: LLMApis.openai,
LargeLanguageModels.gpt_3_5_turbo_16k: LLMApis.openai,
LargeLanguageModels.text_davinci_003: LLMApis.openai,
Expand All @@ -104,6 +108,8 @@ def is_chat_model(self) -> bool:
model_max_tokens = {
# https://platform.openai.com/docs/models/gpt-4
LargeLanguageModels.gpt_4: 8192,
# https://help.openai.com/en/articles/8555510-gpt-4-turbo
LargeLanguageModels.gpt_4_turbo: 128_000,
# https://platform.openai.com/docs/models/gpt-3-5
LargeLanguageModels.gpt_3_5_turbo: 4096,
LargeLanguageModels.gpt_3_5_turbo_16k: 16_384,
Expand Down

0 comments on commit 9434d11

Please sign in to comment.