Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

add transform_response_api_response

Ishaan Jaffdff8308e922d
diff --git a/litellm/llms/base_llm/responses/transformation.py b/litellm/llms/base_llm/responses/transformation.py
index 76b0a5b329d..cc0a85b6f54 100644
--- a/litellm/llms/base_llm/responses/transformation.py
+++ b/litellm/llms/base_llm/responses/transformation.py
@@ -2,10 +2,13 @@ import types
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Optional, Union
+import httpx
+
from litellm.types.llms.openai import (
ResponseInputParam,
ResponsesAPIOptionalRequestParams,
ResponsesAPIRequestParams,
+ ResponsesAPIResponse,
)
from litellm.types.router import GenericLiteLLMParams
from litellm.types.utils import ModelInfo
@@ -85,7 +88,7 @@ class BaseResponsesAPIConfig(ABC):
return api_base
@abstractmethod
- def transform_request(
+ def transform_responses_api_request(
self,
model: str,
input: Union[str, ResponseInputParam],
@@ -95,8 +98,12 @@ class BaseResponsesAPIConfig(ABC):
) -> ResponsesAPIRequestParams:
pass
- # @abstractmethod
- # def transform_response(
- # self,
- # ):
- # pass
+ @abstractmethod
+ def transform_response_api_response(
+ self,
+ model: str,
+ raw_response: httpx.Response,
+ model_response: ResponsesAPIResponse,
+ logging_obj: LiteLLMLoggingObj,
+ ) -> ResponsesAPIResponse:
+ return model_response
diff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.py
index d67846e1010..fa4fe0274d8 100644
--- a/litellm/llms/openai/responses/transformation.py
+++ b/litellm/llms/openai/responses/transformation.py
@@ -71,7 +71,7 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):
timeout=optional_params.get("timeout"),
)
- def transform_request(
+ def transform_responses_api_request(
self,
model: str,
input: Union[str, ResponseInputParam],