mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
5 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e8461b5b97
|
style: run black formatter on files from main merge | ||
|
|
f42ffed2bd
|
Litellm oss staging 04 02 2026 p1 (#25055)
* fix(vertex_ai): support pluggable (executable) credential_source for WIF auth (#24700) The WIF credential dispatch in load_auth() only handled identity_pool and aws credential types. When credential_source.executable was present (used for Azure Managed Identity via Workload Identity Federation), it fell through to identity_pool.Credentials which rejected it with MalformedError. Add dispatch to google.auth.pluggable.Credentials for executable-type credential sources, following the same pattern as the existing identity_pool and aws helpers. Fixes authentication for Azure Container Apps → GCP Vertex AI via WIF with executable credential sources. * feat(logging): add component and logger fields to JSON logs for 3rd p… (#24447) * feat(logging): add component and logger fields to JSON logs for 3rd party filtering * Let user-supplied extra fields win over auto-generated component/logger, tighten test assertions * Feat - Add organization into the metrics metadata for org_id & org_alias (#24440) * Add org_id and org_alias label names to Prometheus metric definitions * Add user_api_key_org_alias to StandardLoggingUserAPIKeyMetadata * Populate user_api_key_org_alias in pre-call metadata * Pass org_id and org_alias into per-request Prometheus metric labels * Add test for org labels on per-request Prometheus metrics * chore: resolve test mockdata * Address review: populate org_alias from DB view, add feature flag, use .get() for org metadata * Add org labels to failure path and verify flag behavior in test * Fix test: build flag-off enum_values without org fields * Gate org labels behind feature flag in get_labels() instead of static metric lists * Scope org label injection to metrics that carry team context, remove orphaned budget label defs, add test teardown * Use explicit metric allowlist for org label injection instead of team heuristic * Fix duplicate org label guard, move _org_label_metrics to class constant * Reset custom_prometheus_metadata_labels after duplicate label assertion * fix: emit org labels by default, remove flag, fix missing org_alias in all metadata paths * fix: emit org labels by default, no opt-in flag required * fix: write org_alias to metadata unconditionally in proxy_server.py * fix: 429s from batch creation being converted to 500 (#24703) * add us gov models (#24660) * add us gov models * added max tokens * Litellm dev 04 02 2026 p1 (#25052) * fix: replace hardcoded url * fix: Anthropic web search cost not tracked for Chat Completions The ModelResponse branch in response_object_includes_web_search_call() only checked url_citation annotations and prompt_tokens_details, missing Anthropic's server_tool_use.web_search_requests field. This caused _handle_web_search_cost() to never fire for Anthropic Claude models. Also routes vertex_ai/claude-* models to the Anthropic cost calculator instead of the Gemini one, since Claude on Vertex uses the same server_tool_use billing structure as the direct Anthropic API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * fix(anthropic): pass logging_obj to client.post for litellm_overhead_time_ms (#24071) When LITELLM_DETAILED_TIMING=true, litellm_overhead_time_ms was null for Anthropic because the handler did not pass logging_obj to client.post(), so track_llm_api_timing could not set llm_api_duration_ms. Pass logging_obj=logging_obj at all four post() call sites (make_call, make_sync_call, acompletion, completion). Add test to ensure make_call passes logging_obj to client.post. Made-with: Cursor * sap - add additional parameters for grounding - additional parameter for grounding added for the sap provider * sap - fix models * (sap) add filtering, masking, translation SAP GEN AI Hub modules * (sap) add tests and docs for new SAP modules * (sap) add support of multiple modules config * (sap) code refactoring * (sap) rename file * test(): add safeguard tests * (sap) update tests * (sap) update docs, solve merge conflict in transformation.py * (sap) linter fix * (sap) Align embedding request transformation with current API * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) mock commit * (sap) run black formater * (sap) add literals to models, add negative tests, fix test for tool transformation * (sap) fix formating * (sap) fix models * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) commit for rerun bot review * (sap) minor improve * (sap) fix after bot review * (sap) lint fix * docs(sap): update documentation * fix(sap): change creds priority * fix(sap): change creds priority * fix(sap): fix sap creds unit test * fix(sap): linter fix * fix(sap): linter fix * linter fix * (sap) update logic of fetching creds, add additional tests * (sap) clean up code * (sap) fix after review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) add a possibility to put the service key by both variants * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) update test * (sap) update service key resolve function * (sap) run black formater * (sap) fix validate credentials, add negative tests for credential fetching * (sap) fix validate credentials, add negative tests for credential fetching * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) fix after bot review * (sap) lint fix * (sap) lint fix * feat: support service_tier in gemini * chore: add a service_tier field mapping from openai to gemini * fix: use x-gemini-service-tier header in response * docs: add service_tier to gemini docs * chore: add defaut/standard mapping, and some tests * chore: tidying up some case insensitivity * chore: remove unnecessary guard * fix: remove redundant test file * fix: handle 'auto' case-insensitively * fix: return service_tier on final steamed chunk * chore: black * feat: enable supports_service_tier to gemini models * Fix get_standard_logging_metadata tests * Fix test_get_model_info_bedrock_models * Fix test_get_model_info_bedrock_models * Fix remaining tests * Fix mypy issues * Fix tests * Fix merge conflicts * Fix code qa * Fix code qa * Fix code qa * Fix greptile review --------- Co-authored-by: michelligabriele <gabriele.michelli@icloud.com> Co-authored-by: Josh <36064836+J-Byron@users.noreply.github.com> Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: milan-berri <milan@berri.ai> Co-authored-by: Alperen Kömürcü <alperen.koemuercue@sap.com> Co-authored-by: Vasilisa Parshikova <vasilisa.parshikova@sap.com> Co-authored-by: Lin Xu <lin.xu03@sap.com> Co-authored-by: Mark McDonald <macd@google.com> Co-authored-by: Sameer Kankute <sameer@berri.ai> |
||
|
|
e335dd70f8
|
fix(sap provider layer): enable response-format for anthropic models and improve compatibility for GPT models via LangChain (#22804)
* (sap) ensure tool parameters have type='object' for SAP compatibility Fix SAP GenAI Hub Orchestration Service rejecting tool calls with error: "400 - LLM Module: tools.0.custom.input_schema.type: Input should be 'object'" Root cause: When Claude Code uses tools (like web_search) with the SAP provider through LiteLLM's Anthropic experimental pass-through adapter, Anthropic's input_schema format doesn't always include the required type="object" field. The adapter's translate_anthropic_tools_to_openai() function was directly copying input_schema to OpenAI's parameters field without ensuring the type="object" requirement that SAP's API strictly enforces. Changes: - Modified translate_anthropic_tools_to_openai() to check if input_schema is missing the type field and add type="object" if absent - Preserves existing type field if already present - Added comprehensive test suite (6 tests) covering: - Missing type field scenario (now adds type="object") - Existing type preservation - Empty input_schema handling - Multiple tools transformation - Additional schema properties preservation - SAP-specific compatibility regression test Testing: - All new tests pass (6/6 in test_anthropic_tool_schema_fix.py) - All existing Anthropic tool tests pass (57/57 tool-related tests) - SAP tool parameter validation tests pass (9/9 in test_sap_tool_parameters.py) * (sap) enable native response_format for anthropic models * (sap) filter strict param from model_params for GPT models only * (sap) revert Anthropic adapter type='object' fix The SAP FunctionTool Pydantic validator in litellm/llms/sap/chat/models.py already ensures type='object' is added to all tool parameters for SAP API compatibility. The Anthropic adapter change affected ALL consumers, not just SAP, which was broader scope than intended for this PR. - Revert input_schema modification in Anthropic adapter - Remove Anthropic-specific test file (SAP tests still cover this case) * (sap) gate markdown stripping to Anthropic models only SAP GenAI Hub with Anthropic models sometimes returns JSON wrapped in markdown code blocks. GPT/Gemini/Mistral models don't exhibit this behavior, so stripping is now gated to avoid accidentally modifying valid responses that may contain markdown in JSON string values. |
||
|
|
fe9b05e23e
|
Add header for SAP AI Core Tracking (#18714)
Signed-off-by: Lize Cai <lize.cai@sap.com> |
||
|
|
c87874c29e
|
[New provider] Sap gen ai hub (#16053)
* add sap gen ai hub * add async tests * add async and streaming support * add embedding model support * add embedding support * remove unused import * fix structured output * clean-up * remove timeout and add tool support * remove unused code * fix(sap): improve streaming robustness; restore embed URL builder compatibility - sap/embed/transformation: add api_key and litellm_params to get_complete_url to align with core flow and prevent failures - sap/chat/handler: wrap async/sync streaming iterators to safely handle Stop(Async)Iteration and errors - sap/chat/transformation: remove unused imports and dead code * fix(sap): linter fix * fix(sap): made gen_ai_hub optional: import check + OptionalDependencyError with install hint if missing. * test(sap): add chat/stream/async tests and OptionalDependencyError check * Fix tool call handling in SAP GenAI Hub transformation Add sap models to model_prices_and_context_window.json and model_prices_and_context_window_backup.json * fix(sap): delete unnecessary code, linter fix * fix(sap): - refactor chat transformation - add support of list and dict content * fix(sap): - fix tests * fix(sap): - fix lint * Update transformation.py * fix(sap): fix model description and fix after rebase * change(sap): - http calls in chat handler, response transformation and auth handling without sap sdk. * change(sap): switching to v2 (chat handler, chat transformation), code clean up * add deployment discovery and improved crendentials handling * add deployment discovery and improved crendentials handling * change(sap): - fix sync stream * change(sap): - fix sync stream * fix(sap): - fix response format * fix(sap): - switch embedding to v2 and http request - reimplement stream creator - improve request transformation * fix async streaming * fix(sap): linters, transformation models, remove sap dependency test * fix(sap): code clean up * add unit test for sap chat completion * linters fix * move token, rg and base_url to properties * (sap): add embedding unit test Signed-off-by: Vasilisa Parshikova <vasilisa.parshikova@sap.com> * fix(sap): bypass response format for some models Signed-off-by: Vasilisa Parshikova <vasilisa.parshikova@sap.com> * fix(sap): fix chat transformation and list of supported params Signed-off-by: Vasilisa Parshikova <vasilisa.parshikova@sap.com> * fix(sap): fix lint * add sap service key module parameter * fix(sap): remove unused code * fix(sap): remove prices * add service key support * fix(sap): - add message content validations - change get_supported_openai_params in chat transformation * typo in mock * fix(sap): - fix in supported params map * fix(sap): - fix in message content validation * fix(sap): - fix in message content validation * fix(sap): - use litellm client for credentials * fix(sap): - linter fix * fix(sap): - use build in custom_http_client - move credentials handling to transformation * fix(sap): - handle stream_options * fix(sap): - fix tests * fix(sap): - code clean up, linter fix * skip other authentication options when creds are provided * fix local variable --------- Signed-off-by: Vasilisa Parshikova <vasilisa.parshikova@sap.com> Co-authored-by: Mathis Boerner <mathis.boerner@sap.com> Co-authored-by: karimmohraz <37623804+karimmohraz@users.noreply.github.com> Co-authored-by: Karim <karim.mohraz@sap.com> |