Add Llama API OAI compatible endpoint support
Why are these changes needed?
To add the latest support for using Llama API offerings with AutoGen
Checks
- [ ] I've included any doc changes needed for https://microsoft.github.io/autogen/. See https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md to build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR.
- [ ] I've made sure all auto checks have passed.
Llama support is cool!
could you adding register_transformer at _message_transfrom to?
https://github.com/microsoft/autogen/blob/main/python/packages/autogen-ext/src/autogen_ext/models/openai/_message_transform.py
You could start with __BASE_TRANSFORMER_MAP
or build __LLAMA_TRANSFROMER_MAP same as __BASE_TRANSFORMER_MAP for future modified.
https://github.com/microsoft/autogen/blob/c7757de59eaa6cf3a7cd039ccddcdb7ceadd724f/python/packages/autogen-ext/src/autogen_ext/models/openai/_message_transform.py#L413-L432
and...
https://github.com/microsoft/autogen/blob/c7757de59eaa6cf3a7cd039ccddcdb7ceadd724f/python/packages/autogen-ext/src/autogen_ext/models/openai/_message_transform.py#L470-L492
I think you are expert of Llama. If you know about Llama's message limited, could support more well with _message_transfrom.
In Anthropic case, Claude does not support empty message, so this message transformer remove empty messages.
@WuhanMonkey thanks for the PR. Could you address @SongChiYoung 's comments?
@WuhanMonkey thanks for the PR. Could you address @SongChiYoung 's comments?
Hey yes, just updated it.
We are still pending on CLA review from our legal side.
@microsoft-github-policy-service agree company="Meta"
We finally get the CLA approved and signed. @SongChiYoung and @ekzhu would you mind help me review and approve this PR? Thanks
One more question, @SongChiYoung, does AutoGen allows extra headers in the request for customized x-title or http-referer for tracking purpose?
One more question, @SongChiYoung, does AutoGen allows extra headers in the request for customized x-title or http-referer for tracking purpose?
You can pass in default_headers as part of the OpenAIChatCompletionClient. https://microsoft.github.io/autogen/stable/reference/python/autogen_ext.models.openai.html#autogen_ext.models.openai.OpenAIChatCompletionClient
Codecov Report
Attention: Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.
Project coverage is 79.52%. Comparing base (
1eb7f93) to head (5413c51). Report is 1 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...xt/src/autogen_ext/models/openai/_openai_client.py | 20.00% | 4 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #6442 +/- ##
==========================================
- Coverage 79.53% 79.52% -0.01%
==========================================
Files 225 225
Lines 16644 16661 +17
==========================================
+ Hits 13237 13249 +12
- Misses 3407 3412 +5
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 79.52% <76.47%> (-0.01%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@WuhanMonkey I will bring it to finish. Thanks. For local checks you can see python/README.md for guides.
@WuhanMonkey I will bring it to finish. Thanks. For local checks you can see
python/README.mdfor guides.
Thanks appreciate it.