mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
add transform_delete_response_api_request to base responses config
This commit is contained in:
parent
b2955a2bdd
commit
45c299d27f
2 changed files with 43 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
||||||
import types
|
import types
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
|
from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ from litellm.types.llms.openai import (
|
||||||
ResponsesAPIResponse,
|
ResponsesAPIResponse,
|
||||||
ResponsesAPIStreamingResponse,
|
ResponsesAPIStreamingResponse,
|
||||||
)
|
)
|
||||||
|
from litellm.types.responses.main import *
|
||||||
from litellm.types.router import GenericLiteLLMParams
|
from litellm.types.router import GenericLiteLLMParams
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -73,11 +74,6 @@ class BaseResponsesAPIConfig(ABC):
|
||||||
def get_complete_url(
|
def get_complete_url(
|
||||||
self,
|
self,
|
||||||
api_base: Optional[str],
|
api_base: Optional[str],
|
||||||
api_key: Optional[str],
|
|
||||||
model: str,
|
|
||||||
optional_params: dict,
|
|
||||||
litellm_params: dict,
|
|
||||||
stream: Optional[bool] = None,
|
|
||||||
) -> str:
|
) -> str:
|
||||||
"""
|
"""
|
||||||
OPTIONAL
|
OPTIONAL
|
||||||
|
@ -122,6 +118,31 @@ class BaseResponsesAPIConfig(ABC):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
########## DELETE RESPONSE API TRANSFORMATION ##############
|
||||||
|
#########################################################
|
||||||
|
@abstractmethod
|
||||||
|
def transform_delete_response_api_request(
|
||||||
|
self,
|
||||||
|
response_id: str,
|
||||||
|
api_base: str,
|
||||||
|
litellm_params: GenericLiteLLMParams,
|
||||||
|
headers: dict,
|
||||||
|
) -> Tuple[str, Dict]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def transform_delete_response_api_response(
|
||||||
|
self,
|
||||||
|
raw_response: httpx.Response,
|
||||||
|
logging_obj: LiteLLMLoggingObj,
|
||||||
|
) -> DeleteResponseResult:
|
||||||
|
pass
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
########## END DELETE RESPONSE API TRANSFORMATION ##########
|
||||||
|
#########################################################
|
||||||
|
|
||||||
def get_error_class(
|
def get_error_class(
|
||||||
self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers]
|
self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers]
|
||||||
) -> BaseLLMException:
|
) -> BaseLLMException:
|
||||||
|
|
|
@ -46,3 +46,19 @@ class GenericResponseOutputItem(BaseLiteLLMOpenAIResponseObject):
|
||||||
status: str # "completed", "in_progress", etc.
|
status: str # "completed", "in_progress", etc.
|
||||||
role: str # "assistant", "user", etc.
|
role: str # "assistant", "user", etc.
|
||||||
content: List[OutputText]
|
content: List[OutputText]
|
||||||
|
|
||||||
|
|
||||||
|
class DeleteResponseResult(BaseLiteLLMOpenAIResponseObject):
|
||||||
|
"""
|
||||||
|
Result of a delete response request
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": "resp_6786a1bec27481909a17d673315b29f6",
|
||||||
|
"object": "response",
|
||||||
|
"deleted": true
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
id: Optional[str]
|
||||||
|
object: Optional[str]
|
||||||
|
deleted: Optional[bool]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue