mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* feat(sarvam): send a litellm User-Agent on chat requests
The Sarvam API logs the User-Agent of each request, which is how traffic is
attributed. LiteLLM's chat path currently sends the OpenAI SDK default
User-Agent, so requests through the JSON-configured sarvam provider are
indistinguishable from direct OpenAI SDK calls.
Add an optional user_agent template to the JSON provider config and wire JSON
providers into the existing attribution-header helper, which until now only ran
for providers with a provider_config. The template reports the running LiteLLM
and Python versions (litellm/1.110.0 Python/3.12.16).
The generated JSONProviderConfig forwards get_attribution_headers to the JSON
config, so the field also works for the JSON providers that are in LlmProviders
and therefore get a provider_config.
The field is opt-in: providers without user_agent keep their current headers,
and a caller-supplied User-Agent still wins, as documented on
get_attribution_headers.
🪷 Generated with Sarvam Code
Co-authored-by: Sarvam Code <code@sarvam.ai>
* refactor(sarvam): type the user_agent field and drop comments
* fix(sarvam): keep a caller client's User-Agent and honor LITELLM_USER_AGENT
A User-Agent set as a default header on the caller's own OpenAI client now wins over the provider attribution, and LITELLM_USER_AGENT replaces the JSON provider's user_agent template. Documents the user_agent field and tightens test types
* fix(sarvam): keep a client subclass's User-Agent and honor an empty LITELLM_USER_AGENT
* test(attribution): cover a caller client header in either spelling
* refactor(attribution): type the caller client and narrow it at the call site
---------
Co-authored-by: Vikash Maddi <vikashmaddi-sarvam@users.noreply.github.com>
Co-authored-by: Sarvam Code <code@sarvam.ai>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| audio_transcription | ||
| auth | ||
| batches | ||
| chat | ||
| decisions | ||
| embedding | ||
| files | ||
| guardrail_translation | ||
| harness | ||
| realtime | ||
| rerank | ||
| responses | ||
| search | ||
| vector_store | ||
| __init__.py | ||
| test_base_managed_resource.py | ||
| test_base_model_iterator.py | ||
| test_base_utils.py | ||
| test_managed_resource_isolation.py | ||
| test_managed_resources_utils.py | ||