mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix openai like
This commit is contained in:
parent
c3e87a9651
commit
6cfe10b91d
4 changed files with 9 additions and 3 deletions
|
|
@ -198,6 +198,7 @@ class OpenAILikeChatHandler(OpenAILikeBase):
|
|||
return OpenAILikeChatConfig._transform_response(
|
||||
model=model,
|
||||
response=response_data,
|
||||
response_json=response_data,
|
||||
model_response=model_response,
|
||||
stream=stream,
|
||||
logging_obj=logging_obj,
|
||||
|
|
@ -368,7 +369,7 @@ class OpenAILikeChatHandler(OpenAILikeBase):
|
|||
url=api_base, headers=headers, data=json.dumps(data)
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
response_data = response.json()
|
||||
except httpx.HTTPStatusError as e:
|
||||
raise OpenAILikeError(
|
||||
status_code=e.response.status_code,
|
||||
|
|
@ -383,6 +384,7 @@ class OpenAILikeChatHandler(OpenAILikeBase):
|
|||
return OpenAILikeChatConfig._transform_response(
|
||||
model=model,
|
||||
response=response,
|
||||
response_json=response_data,
|
||||
model_response=model_response,
|
||||
stream=stream,
|
||||
logging_obj=logging_obj,
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class OpenAILikeChatConfig(OpenAIGPTConfig):
|
|||
def _transform_response(
|
||||
model: str,
|
||||
response: httpx.Response,
|
||||
response_json: dict,
|
||||
model_response: ModelResponse,
|
||||
stream: bool,
|
||||
logging_obj: LiteLLMLoggingObj,
|
||||
|
|
@ -78,7 +79,6 @@ class OpenAILikeChatConfig(OpenAIGPTConfig):
|
|||
custom_llm_provider: str,
|
||||
base_model: Optional[str],
|
||||
) -> ModelResponse:
|
||||
response_json = response.json()
|
||||
logging_obj.post_call(
|
||||
input=messages,
|
||||
api_key="",
|
||||
|
|
|
|||
|
|
@ -2826,6 +2826,7 @@ def completion( # type: ignore # noqa: PLR0915
|
|||
elif custom_llm_provider == "openai_like":
|
||||
response = openai_like_chat_completion.completion(
|
||||
model=model,
|
||||
acompletion=acompletion,
|
||||
messages=messages,
|
||||
api_base=api_base,
|
||||
model_response=model_response,
|
||||
|
|
|
|||
|
|
@ -2,5 +2,8 @@ model_list:
|
|||
- model_name: "fake-openai-endpoint"
|
||||
litellm_params:
|
||||
model: openai_like/any
|
||||
api_base: https://exampleopenaiendpoint-production.up.railway.app
|
||||
api_base: https://exampleopenaiendpoint-production-c715.up.railway.app
|
||||
api_key: "ishaan"
|
||||
|
||||
general_settings:
|
||||
master_key: sk-1234
|
||||
Loading…
Add table
Reference in a new issue