mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(handler.py): support routing custom llm's to chat completion handler
Adds custom llm support for anthropic
This commit is contained in:
parent
8da22be199
commit
1ecf0315e5
1 changed files with 12 additions and 6 deletions
|
|
@ -119,6 +119,8 @@ def anthropic_messages_handler(
|
|||
"""
|
||||
Makes Anthropic `/v1/messages` API calls In the Anthropic API Spec
|
||||
"""
|
||||
from litellm.types.utils import LlmProviders
|
||||
|
||||
local_vars = locals()
|
||||
is_async = kwargs.pop("is_async", False)
|
||||
# Use provided client or create a new one
|
||||
|
|
@ -141,12 +143,16 @@ def anthropic_messages_handler(
|
|||
api_key=litellm_params.api_key,
|
||||
)
|
||||
|
||||
anthropic_messages_provider_config: Optional[
|
||||
BaseAnthropicMessagesConfig
|
||||
] = ProviderConfigManager.get_provider_anthropic_messages_config(
|
||||
model=model,
|
||||
provider=litellm.LlmProviders(custom_llm_provider),
|
||||
)
|
||||
anthropic_messages_provider_config: Optional[BaseAnthropicMessagesConfig] = None
|
||||
if (
|
||||
custom_llm_provider in LlmProviders.__annotations__.keys()
|
||||
): # send custom models straight through to chat completion handler
|
||||
anthropic_messages_provider_config = (
|
||||
ProviderConfigManager.get_provider_anthropic_messages_config(
|
||||
model=model,
|
||||
provider=litellm.LlmProviders(custom_llm_provider),
|
||||
)
|
||||
)
|
||||
if anthropic_messages_provider_config is None:
|
||||
# Handle non-Anthropic models using the adapter
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue