(fix) 'utf-8' codec can't encode characters error on OpenAI (#7018)

* test_openai_multilingual

* pin httpx

* fix openai pyproject

* test_multilingual_requests

* TestOpenAIChatCompletion

* fix test anthropic completion
This commit is contained in:
Ishaan Jaff 2024-12-03 20:33:14 -08:00 committed by GitHub
parent beef64354e
commit 2a8d64991f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 39 additions and 5 deletions

View file

@ -63,6 +63,20 @@ class BaseLLMChatTest(ABC):
response = litellm.completion(**base_completion_call_args, messages=messages)
assert response is not None
def test_multilingual_requests(self):
"""
Tests that the provider can handle multilingual requests and invalid utf-8 sequences
Context: https://github.com/openai/openai-python/issues/1921
"""
base_completion_call_args = self.get_base_completion_call_args()
response = litellm.completion(
**base_completion_call_args,
messages=[{"role": "user", "content": "你好世界!\ud83e, ö"}],
)
print("multilingual response: ", response)
assert response is not None
@pytest.mark.parametrize(
"response_format",
[