diff --git a/litellm/tests/langfuse.log b/litellm/tests/langfuse.log index e69de29bb2d..f47590a293e 100644 --- a/litellm/tests/langfuse.log +++ b/litellm/tests/langfuse.log @@ -0,0 +1,88 @@ +int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +Traceback (most recent call last): + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/client.py", line 778, in generation + "usage": _convert_usage_input(usage) if usage is not None else None, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 77, in _convert_usage_input + "totalCost": extract_by_priority(usage, ["totalCost", "total_cost"]), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 32, in extract_by_priority + return int(usage[key]) + ^^^^^^^^^^^^^^^ +TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +Traceback (most recent call last): + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/client.py", line 778, in generation + "usage": _convert_usage_input(usage) if usage is not None else None, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 77, in _convert_usage_input + "totalCost": extract_by_priority(usage, ["totalCost", "total_cost"]), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 32, in extract_by_priority + return int(usage[key]) + ^^^^^^^^^^^^^^^ +TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +Traceback (most recent call last): + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/client.py", line 778, in generation + "usage": _convert_usage_input(usage) if usage is not None else None, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 77, in _convert_usage_input + "totalCost": extract_by_priority(usage, ["totalCost", "total_cost"]), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 32, in extract_by_priority + return int(usage[key]) + ^^^^^^^^^^^^^^^ +TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +Traceback (most recent call last): + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/client.py", line 778, in generation + "usage": _convert_usage_input(usage) if usage is not None else None, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 77, in _convert_usage_input + "totalCost": extract_by_priority(usage, ["totalCost", "total_cost"]), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 32, in extract_by_priority + return int(usage[key]) + ^^^^^^^^^^^^^^^ +TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +Traceback (most recent call last): + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/client.py", line 778, in generation + "usage": _convert_usage_input(usage) if usage is not None else None, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 77, in _convert_usage_input + "totalCost": extract_by_priority(usage, ["totalCost", "total_cost"]), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/opt/homebrew/lib/python3.11/site-packages/langfuse/utils.py", line 32, in extract_by_priority + return int(usage[key]) + ^^^^^^^^^^^^^^^ +TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' +consumer is running... +Getting observations... None, None, None, None, litellm-test-98e1cc75-bef8-4280-a2b9-e08633b81acd, None, GENERATION +consumer is running... +Getting observations... None, None, None, None, litellm-test-532d2bc8-f8d6-42fd-8f78-416bae79925d, None, GENERATION +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined +joining 1 consumer threads +consumer thread 0 joined diff --git a/litellm/tests/test_alangfuse.py b/litellm/tests/test_alangfuse.py index 6c3830935ef..29718d4746a 100644 --- a/litellm/tests/test_alangfuse.py +++ b/litellm/tests/test_alangfuse.py @@ -205,8 +205,6 @@ async def test_langfuse_logging_without_request_response(stream): assert _trace_data[0].output == { "role": "assistant", "content": "redacted-by-litellm", - "function_call": None, - "tool_calls": None, } except Exception as e: diff --git a/litellm/utils.py b/litellm/utils.py index 65cf60c1e09..5ae4958197f 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -378,16 +378,13 @@ class Message(OpenAIObject): super(Message, self).__init__(**params) self.content = content self.role = role - self.tool_calls = None - self.function_call = None - if function_call is not None: self.function_call = FunctionCall(**function_call) if tool_calls is not None: - self.tool_calls = [ - ChatCompletionMessageToolCall(**tool_call) for tool_call in tool_calls - ] + self.tool_calls = [] + for tool_call in tool_calls: + self.tool_calls.append(ChatCompletionMessageToolCall(**tool_call)) if logprobs is not None: self._logprobs = ChoiceLogprobs(**logprobs) @@ -413,8 +410,6 @@ class Message(OpenAIObject): class Delta(OpenAIObject): - tool_calls: Optional[List[ChatCompletionDeltaToolCall]] = None - def __init__( self, content=None,