feat: support gpt-3.5-turbo-instruct model (#1195)

This commit is contained in:
takatost
2023-09-19 02:05:04 +08:00
committed by GitHub
parent 269a465fc4
commit ae3f1ac0a9
7 changed files with 25 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ from core.model_providers.models.entity.model_params import ModelMode, ModelKwar
from models.provider import ProviderType, ProviderQuotaType
COMPLETION_MODELS = [
'gpt-3.5-turbo-instruct', # 4,096 tokens
'text-davinci-003', # 4,097 tokens
]
@@ -31,6 +32,7 @@ MODEL_MAX_TOKENS = {
'gpt-4': 8192,
'gpt-4-32k': 32768,
'gpt-3.5-turbo': 4096,
'gpt-3.5-turbo-instruct': 4096,
'gpt-3.5-turbo-16k': 16384,
'text-davinci-003': 4097,
}

View File

@@ -40,6 +40,10 @@ class OpenAIProvider(BaseModelProvider):
ModelFeature.AGENT_THOUGHT.value
]
},
{
'id': 'gpt-3.5-turbo-instruct',
'name': 'GPT-3.5-Turbo-Instruct',
},
{
'id': 'gpt-3.5-turbo-16k',
'name': 'gpt-3.5-turbo-16k',
@@ -128,6 +132,7 @@ class OpenAIProvider(BaseModelProvider):
'gpt-4': 8192,
'gpt-4-32k': 32768,
'gpt-3.5-turbo': 4096,
'gpt-3.5-turbo-instruct': 4096,
'gpt-3.5-turbo-16k': 16384,
'text-davinci-003': 4097,
}

View File

@@ -30,6 +30,12 @@
"unit": "0.001",
"currency": "USD"
},
"gpt-3.5-turbo-instruct": {
"prompt": "0.0015",
"completion": "0.002",
"unit": "0.001",
"currency": "USD"
},
"gpt-3.5-turbo-16k": {
"prompt": "0.003",
"completion": "0.004",

View File

@@ -14,6 +14,9 @@ class EnhanceOpenAI(OpenAI):
max_retries: int = 1
"""Maximum number of retries to make when generating."""
def __new__(cls, **data: Any): # type: ignore
return super(EnhanceOpenAI, cls).__new__(cls)
@root_validator()
def validate_environment(cls, values: Dict) -> Dict:
"""Validate that api key and python package exists in environment."""