new mcp servers format
This commit is contained in:
@@ -739,6 +739,12 @@ class Router:
|
||||
litellm.afile_content, call_type="afile_content"
|
||||
)
|
||||
self.responses = self.factory_function(litellm.responses, call_type="responses")
|
||||
self.aget_responses = self.factory_function(
|
||||
litellm.aget_responses, call_type="aget_responses"
|
||||
)
|
||||
self.adelete_responses = self.factory_function(
|
||||
litellm.adelete_responses, call_type="adelete_responses"
|
||||
)
|
||||
|
||||
def validate_fallbacks(self, fallback_param: Optional[List]):
|
||||
"""
|
||||
@@ -3081,6 +3087,8 @@ class Router:
|
||||
"anthropic_messages",
|
||||
"aresponses",
|
||||
"responses",
|
||||
"aget_responses",
|
||||
"adelete_responses",
|
||||
"afile_delete",
|
||||
"afile_content",
|
||||
] = "assistants",
|
||||
@@ -3135,6 +3143,11 @@ class Router:
|
||||
original_function=original_function,
|
||||
**kwargs,
|
||||
)
|
||||
elif call_type in ("aget_responses", "adelete_responses"):
|
||||
return await self._init_responses_api_endpoints(
|
||||
original_function=original_function,
|
||||
**kwargs,
|
||||
)
|
||||
elif call_type in ("afile_delete", "afile_content"):
|
||||
return await self._ageneric_api_call_with_fallbacks(
|
||||
original_function=original_function,
|
||||
@@ -3145,6 +3158,28 @@ class Router:
|
||||
|
||||
return async_wrapper
|
||||
|
||||
async def _init_responses_api_endpoints(
|
||||
self,
|
||||
original_function: Callable,
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Initialize the Responses API endpoints on the router.
|
||||
|
||||
GET, DELETE Responses API Requests encode the model_id in the response_id, this function decodes the response_id and sets the model to the model_id.
|
||||
"""
|
||||
from litellm.responses.utils import ResponsesAPIRequestUtils
|
||||
|
||||
model_id = ResponsesAPIRequestUtils.get_model_id_from_response_id(
|
||||
kwargs.get("response_id")
|
||||
)
|
||||
if model_id is not None:
|
||||
kwargs["model"] = model_id
|
||||
return await self._ageneric_api_call_with_fallbacks(
|
||||
original_function=original_function,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
async def _pass_through_assistants_endpoint_factory(
|
||||
self,
|
||||
original_function: Callable,
|
||||
|
||||
Reference in New Issue
Block a user