mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
Merge pull request #3379 from elisalimli/main
[chore] Improve type-safety in Message & Delta classes
This commit is contained in:
commit
24fc934622
1 changed files with 9 additions and 5 deletions
|
@ -378,13 +378,16 @@ class Message(OpenAIObject):
|
|||
super(Message, self).__init__(**params)
|
||||
self.content = content
|
||||
self.role = role
|
||||
self.tool_calls = []
|
||||
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 = []
|
||||
for tool_call in tool_calls:
|
||||
self.tool_calls.append(ChatCompletionMessageToolCall(**tool_call))
|
||||
self.tool_calls = [
|
||||
ChatCompletionMessageToolCall(**tool_call) for tool_call in tool_calls
|
||||
]
|
||||
|
||||
if logprobs is not None:
|
||||
self._logprobs = ChoiceLogprobs(**logprobs)
|
||||
|
@ -407,9 +410,10 @@ class Message(OpenAIObject):
|
|||
except:
|
||||
# if using pydantic v1
|
||||
return self.dict()
|
||||
|
||||
|
||||
|
||||
class Delta(OpenAIObject):
|
||||
tool_calls: Optional[List[ChatCompletionDeltaToolCall]]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
content=None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue