feat: support basic feature of OpenAI new models (#1476)

This commit is contained in:
takatost
2023-11-07 18:05:59 +08:00
committed by GitHub
parent 7b26c9e2ef
commit d7ae86799c
7 changed files with 84 additions and 6 deletions

View File

@@ -41,9 +41,17 @@ class OpenAIProvider(BaseModelProvider):
ModelFeature.AGENT_THOUGHT.value
]
},
{
'id': 'gpt-3.5-turbo-1106',
'name': 'gpt-3.5-turbo-1106',
'mode': ModelMode.CHAT.value,
'features': [
ModelFeature.AGENT_THOUGHT.value
]
},
{
'id': 'gpt-3.5-turbo-instruct',
'name': 'GPT-3.5-Turbo-Instruct',
'name': 'gpt-3.5-turbo-instruct',
'mode': ModelMode.COMPLETION.value,
},
{
@@ -62,6 +70,22 @@ class OpenAIProvider(BaseModelProvider):
ModelFeature.AGENT_THOUGHT.value
]
},
{
'id': 'gpt-4-1106-preview',
'name': 'gpt-4-1106-preview',
'mode': ModelMode.CHAT.value,
'features': [
ModelFeature.AGENT_THOUGHT.value
]
},
{
'id': 'gpt-4-vision-preview',
'name': 'gpt-4-vision-preview',
'mode': ModelMode.CHAT.value,
'features': [
ModelFeature.VISION.value
]
},
{
'id': 'gpt-4-32k',
'name': 'gpt-4-32k',
@@ -79,7 +103,7 @@ class OpenAIProvider(BaseModelProvider):
if self.provider.provider_type == ProviderType.SYSTEM.value \
and self.provider.quota_type == ProviderQuotaType.TRIAL.value:
models = [item for item in models if item['id'] not in ['gpt-4', 'gpt-4-32k']]
models = [item for item in models if not item['id'].startswith('gpt-4')]
return models
elif model_type == ModelType.EMBEDDINGS:
@@ -141,8 +165,11 @@ class OpenAIProvider(BaseModelProvider):
:return:
"""
model_max_tokens = {
'gpt-4-1106-preview': 128000,
'gpt-4-vision-preview': 128000,
'gpt-4': 8192,
'gpt-4-32k': 32768,
'gpt-3.5-turbo-1106': 16384,
'gpt-3.5-turbo': 4096,
'gpt-3.5-turbo-instruct': 4097,
'gpt-3.5-turbo-16k': 16384,