Commit graph

18 commits

Author SHA1 Message Date
pokepoke81
732e23a4f9
Remove comment about prompt-cache usage in test
Remove outdated comment regarding prompt-cache counts in chunk_parser.
2026-08-14 11:24:30 -04:00
pokepoke81
ce66cbce0e fix(databricks): surface prompt-cache token counts in streaming usage
chunk_parser built ModelResponseStream without passing usage, so the
cache_read_input_tokens and cache_creation_input_tokens that Databricks
returns for Anthropic models never reached the cost calculator. Every
streamed request was billed at the full input rate even when served
from cache.

ModelResponseStream already coerces a usage dict into Usage, which maps
those keys into prompt_tokens_details, so passing the chunk's usage
through is sufficient.
2026-08-14 10:45:21 -04:00
mateo-berri
abc38935fa fix(anthropic): override custom_llm_provider in provider config subclasses so capability probes use the right namespace 2026-07-11 12:15:59 -07:00
Mateo Wang
20dabb781a
fix(databricks): split parallel tool calls so each tool message follows tool_calls (#31633)
* fix(databricks): split parallel tool calls so each tool message follows tool_calls

Databricks OpenAI-compatible serving (e.g. GPT models) 400s with "messages with
role 'tool' must be a response to a preceeding message with 'tool_calls'" when an
assistant turn makes parallel tool calls. LiteLLM faithfully sends one assistant
message holding all tool_calls followed by one 'tool' message per result, so every
result after the first is preceded by another 'tool' message rather than the
assistant tool_calls message, which Databricks rejects.

Re-emit each result immediately after an assistant message that carries only its
matching tool_call, turning assistant(tool_calls=[A, B]), tool(A), tool(B) into
assistant(tool_calls=[A]), tool(A), assistant(tool_calls=[B]), tool(B). The
rewrite is a no-op when the turn is already valid (single call), the group is
incomplete, or ids don't line up, so no tool call is ever dropped. Scoped to
non-Claude models, matching the existing OpenAI-shaped transformation path.

* style(databricks): use builtin list generics in parallel tool-call split

Switch the List[...] annotations introduced by _split_parallel_tool_calls
to lowercase list[...] so the UP006 strict-rule budget stays within its
ceiling.
2026-06-29 13:46:53 -07:00
Mateo Wang
a4a3348801
[internal copy of #28007] Fix/gcp model garden streaming (#28363)
* fix(vertex): stream Model Garden Gemma/Qwen responses correctly through /v1/messages

* test(vertex): cover _CombinedChunkSplitter defensive branches

* test(databricks): rename test file to avoid duplicate basename collision

* fix(databricks,anthropic): defensive token defaults; document single-mode splitter

Address greptile P2 concerns:
- databricks: default usage token fields to 0 when constructing
  ChatCompletionUsageBlock from a partially populated usage block — matches
  the defensive pattern used in ollama/vertex_ai/cohere/bedrock.
- _CombinedChunkSplitter: clarify in the docstring that an instance is
  single-mode (sync or async, not both), since the two iteration paths hold
  independent upstream iterator references.

Co-authored-by: Claude <claude@anthropic.com>

---------

Co-authored-by: Steven Kessler <9701252+stvnksslr@users.noreply.github.com>
Co-authored-by: Claude <claude@anthropic.com>
2026-06-10 12:31:00 -07:00
Ishaan Jaffer
e8461b5b97
style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
Tomu Hirata
020d769930 Address Greptile review: fix SDK auth fallback and remove unused imports
- Use custom_endpoint=False so Databricks SDK auth fallback works
  (custom_endpoint=True was blocking it). The api_base returned by
  databricks_validate_environment is discarded since get_complete_url
  builds the URL separately.
- Remove unused verbose_logger import
- Remove unused json import in tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:57:50 +09:00
Tomu Hirata
fe7e764846 Add native Responses API support for Databricks GPT models
Databricks supports the Responses API natively for GPT models, but litellm
was falling back to the completion transformation handler which converts
responses requests to chat completion calls, losing response schema enforcement.

This adds DatabricksResponsesAPIConfig that passes responses API requests
directly to Databricks' /responses endpoint for GPT models, while non-GPT
models (Claude, Llama, etc.) continue using the completion transformation path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:34:18 +09:00
Neha Prasad
def910b086 fix: Sanitize empty text content blocks for databricks provider (#20384)
* fix(databricks): sanitize empty text content blocks for Anthropic Messages API

* test(databricks): add tests for empty content block sanitization
2026-02-10 16:12:57 +05:30
Alexsander Hamir
3f6312c0ef
[Fix] CI/CD - litellm_mapped_tests_llms (#18563) 2026-01-01 11:46:32 -08:00
prasadkona
3a1baae45c feat(databricks): Add enhanced authentication, security features, and custom user-agent support
- Add OAuth M2M (Machine-to-Machine) authentication via DATABRICKS_CLIENT_ID and DATABRICKS_CLIENT_SECRET
- Add Databricks SDK auto-auth with automatic credential discovery
- Add sensitive data redaction for secure logging (tokens, API keys, secrets)
- Add custom user_agent parameter for partner attribution in Databricks telemetry
- Support user_agent in LiteLLM Proxy via config.yaml litellm_params
- Add 49 mocked unit tests for all new functionality
- Add 13 E2E tests for real-world validation (skipped in CI)
- Update documentation with new features and examples
2025-12-22 12:02:51 -08:00
Korbinian Koch
6e8e3b30f9
Update Databricks model pricing and add new models (including databricks pricing test). (#17277)
* update databricks pricing and add DBU<>USD test

* Refactor test_databricks_pricing.py

Removed unnecessary sys.path modification and cleaned up comments.
2025-12-01 20:06:47 -08:00
Krish Dholakia
a80cfe5fb5
Merge branch 'main' into feature/databricks-function-call-missing-pass-description 2025-09-09 22:42:32 -07:00
TomeHirata
ca6d77b479 fix citation field name 2025-09-01 16:41:35 +09:00
frankzye1
75a7b39700 pass function tool description for databricks provider
Signed-off-by: frankzye1 <frankzye@qq.com>
2025-08-30 09:27:39 +08:00
TomuHirata
7333060fb0 feat(databricks): add anthropic citation support 2025-08-28 18:43:43 +09:00
Ishaan Jaff
b455ada161
[Bug Fix] [Bug]: New Databricks Foundation Models databricks-gpt-oss-20b and databricks-gpt-oss-120b failed with error: litellm.APIConnectionError: 'signature' (#13318)
* test_transform_choices_without_signature

* fix ChatCompletionThinkingBlock

* extract_reasoning_content
2025-08-05 17:46:40 -07:00
Krish Dholakia
ef42461c1e
Litellm fix GitHub action testing (#11163)
* test: add __init__.py files

* refactor: rename test folder to avoid naming conflict

* test: update workflows

* test: update tests

* test: update imports

* test: update tests

* test: remove unused import

* ci(test-litellm.yml): add pytest retry to github workflow

* test: fix test
2025-05-26 14:41:42 -07:00