mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
(feat) openai improve logging post_call
This commit is contained in:
parent
7de87c845b
commit
32f22adf8b
1 changed files with 6 additions and 0 deletions
|
@ -209,6 +209,12 @@ class OpenAIChatCompletion(BaseLLM):
|
|||
else:
|
||||
openai_client = OpenAI(api_key=api_key, base_url=api_base, http_client=litellm.client_session, timeout=timeout)
|
||||
response = openai_client.chat.completions.create(**data) # type: ignore
|
||||
logging_obj.post_call(
|
||||
input=None,
|
||||
api_key=api_key,
|
||||
original_response=response,
|
||||
additional_args={"complete_input_dict": data},
|
||||
)
|
||||
return convert_to_model_response_object(response_object=json.loads(response.model_dump_json()), model_response_object=model_response)
|
||||
except Exception as e:
|
||||
if "Conversation roles must alternate user/assistant" in str(e) or "user and assistant roles should be alternating" in str(e):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue