forked from phoenix/litellm-mirror
fix(utils.py): fix pydantic object default values
This commit is contained in:
parent
29aefaa7d7
commit
caf19478af
2 changed files with 12 additions and 4 deletions
|
@ -205,6 +205,8 @@ async def test_langfuse_logging_without_request_response(stream):
|
||||||
assert _trace_data[0].output == {
|
assert _trace_data[0].output == {
|
||||||
"role": "assistant",
|
"role": "assistant",
|
||||||
"content": "redacted-by-litellm",
|
"content": "redacted-by-litellm",
|
||||||
|
"function_call": None,
|
||||||
|
"tool_calls": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -378,7 +378,7 @@ class Message(OpenAIObject):
|
||||||
super(Message, self).__init__(**params)
|
super(Message, self).__init__(**params)
|
||||||
self.content = content
|
self.content = content
|
||||||
self.role = role
|
self.role = role
|
||||||
self.tool_calls = []
|
self.tool_calls = None
|
||||||
self.function_call = None
|
self.function_call = None
|
||||||
|
|
||||||
if function_call is not None:
|
if function_call is not None:
|
||||||
|
@ -2531,13 +2531,19 @@ class Logging:
|
||||||
"complete_streaming_response"
|
"complete_streaming_response"
|
||||||
]
|
]
|
||||||
for choice in _streaming_response.choices:
|
for choice in _streaming_response.choices:
|
||||||
|
if isinstance(choice, litellm.Choices):
|
||||||
choice.message.content = "redacted-by-litellm"
|
choice.message.content = "redacted-by-litellm"
|
||||||
|
elif isinstance(choice, litellm.utils.StreamingChoices):
|
||||||
|
choice.delta.content = "redacted-by-litellm"
|
||||||
else:
|
else:
|
||||||
if result is not None:
|
if result is not None:
|
||||||
if isinstance(result, litellm.ModelResponse):
|
if isinstance(result, litellm.ModelResponse):
|
||||||
if hasattr(result, "choices"):
|
if hasattr(result, "choices") and result.choices is not None:
|
||||||
for choice in result.choices:
|
for choice in result.choices:
|
||||||
|
if isinstance(choice, litellm.Choices):
|
||||||
choice.message.content = "redacted-by-litellm"
|
choice.message.content = "redacted-by-litellm"
|
||||||
|
elif isinstance(choice, litellm.utils.StreamingChoices):
|
||||||
|
choice.delta.content = "redacted-by-litellm"
|
||||||
|
|
||||||
|
|
||||||
def exception_logging(
|
def exception_logging(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue