Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Dec 4, 2024

Conversation

ishaan-jaff
Copy link
Contributor

@ishaan-jaff ishaan-jaff commented Dec 4, 2024

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

Underlying issue: openai/openai-python#1921

Fixes:

  • pin httpx dependency
  • Add test for multi lingual chars

Fixes this stack trace

/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/openai/_utils/_utils.py:275: in wrapper
    return func(*args, **kwargs)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/openai/resources/chat/completions.py:829: in create
    return self._post(
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/openai/_base_client.py:1280: in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/openai/_base_client.py:957: in request
    return self._request(
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/openai/_base_client.py:983: in _request
    request = self._build_request(options, retries_taken=retries_taken)
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/openai/_base_client.py:506: in _build_request
    return self._client.build_request(  # pyright: ignore[reportUnknownMemberType]
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py:378: in build_request
    return Request(
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_models.py:408: in __init__
    headers, stream = encode_request(
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_content.py:216: in encode_request
    return encode_json(json)

Relevant issues

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

[REQUIRED] Testing - Attach a screenshot of any new tests passing locall

If UI changes, send a screenshot/GIF of working UI fixes

Copy link

vercel bot commented Dec 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 4:28am

tests/llm_translation/base_llm_unit_tests.py Dismissed Show dismissed Hide dismissed
@ishaan-jaff ishaan-jaff merged commit 2a8d649 into main Dec 4, 2024
14 of 25 checks passed
rajatvig pushed a commit to rajatvig/litellm that referenced this pull request Jan 16, 2025
…7018)

* test_openai_multilingual

* pin httpx

* fix openai pyproject

* test_multilingual_requests

* TestOpenAIChatCompletion

* fix test anthropic completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant