Skip to content

Commit

Permalink
add gpt-4o support
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksym Polishchuk committed May 17, 2024
1 parent e03fc56 commit 0e26709
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions chat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,13 @@ def delete_all(self, request):
'max_tokens': 131072,
'max_prompt_tokens': 123072,
'max_response_tokens': 8000,
}
},
'gpt-4o': {
'name': 'gpt-4o',
'max_tokens': 131072,
'max_prompt_tokens': 123072,
'max_response_tokens': 8000,
}
}


Expand Down Expand Up @@ -818,6 +824,7 @@ def num_tokens_from_text(text, model="gpt-3.5-turbo-0301"):
"gpt-3.5-turbo-16k-0613",
"gpt-4-32k-0613",
"gpt-4-1106-preview",
"gpt-4o"
]:
raise NotImplementedError(
f"num_tokens_from_text() is not implemented for model {model}.")
Expand All @@ -844,7 +851,8 @@ def num_tokens_from_messages(messages, model="gpt-3.5-turbo-0301"):
"gpt-3.5-turbo-0613",
"gpt-3.5-turbo-16k-0613",
"gpt-4-32k-0613",
"gpt-4-1106-preview"
"gpt-4-1106-preview",
"gpt-4o"
]:
tokens_per_message = 4 # every message follows <|start|>{role/name}\n{content}<|end|>\n
tokens_per_name = -1 # if there's a name, the role is omitted
Expand Down

0 comments on commit 0e26709

Please sign in to comment.