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

@@ -42,7 +42,7 @@ def decrypt_side_effect(tenant_id, encrypted_openai_api_key):
@patch('core.helper.encrypter.decrypt_token', side_effect=decrypt_side_effect)
def test_get_num_tokens(mock_decrypt):
openai_model = get_mock_openai_model('text-davinci-003')
openai_model = get_mock_openai_model('gpt-3.5-turbo-instruct')
rst = openai_model.get_num_tokens([PromptMessage(content='you are a kindness Assistant.')])
assert rst == 6
@@ -61,7 +61,7 @@ def test_chat_get_num_tokens(mock_decrypt):
def test_run(mock_decrypt, mocker):
mocker.patch('core.model_providers.providers.base.BaseModelProvider.update_last_used', return_value=None)
openai_model = get_mock_openai_model('text-davinci-003')
openai_model = get_mock_openai_model('gpt-3.5-turbo-instruct')
rst = openai_model.run(
[PromptMessage(content='Human: Are you Human? you MUST only answer `y` or `n`? \nAssistant: ')],
stop=['\nHuman:'],