-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description
The Databricks "Chat Completions-compatible API" is mostly, but not quite, OpenAIChatModel-compatible.
Specifically, the message.content field is not str | None like in the OpenAI SDK, but str | list[ContentItem]. The docs helpfully explain:
The content can be either a string or an array that contains a series of multimodal elements in a single chat interaction. These elements follow the sequence in which they are processed as inputs or outputs by the models. This array input is specifically designed for use with proprietary models accessible only through external model providers. Currently, only Claude models are supported. Use string-typed content for other external model providers, open source models (Llama), or models hosted by customers on Databricks.
list[ContentItem]is not compatible with OpenAI's specifications.
This means we'll need a new DatabricksModel to support Databricks, similar to how we'll be adding an OpenRouterModel (#2936) and already have GroqModel and HuggingFaceModel -- all used to be fully Chat Completions-compatible and, for understandable reasons, diverged over time.
Since this is (so far) the only thing we'll need to handle differently than OpenAIChatModel, I'd prefer not to copy-paste the entire class, but rather to subclass it and change the behavior through hooks. Or if we need a new class, to extract the common bits into helper functions.
References
No response