File tree Expand file tree Collapse file tree 10 files changed +552
-5
lines changed Expand file tree Collapse file tree 10 files changed +552
-5
lines changed Original file line number Diff line number Diff line change 324324 ConversationTextResponse ,
325325 UserStartedSpeakingResponse ,
326326 AgentThinkingResponse ,
327+ FunctionCall ,
327328 FunctionCallRequest ,
328329 AgentStartedSpeakingResponse ,
329330 AgentAudioDoneResponse ,
Original file line number Diff line number Diff line change 338338 ConversationTextResponse ,
339339 UserStartedSpeakingResponse ,
340340 AgentThinkingResponse ,
341+ FunctionCall ,
341342 FunctionCallRequest ,
342343 AgentStartedSpeakingResponse ,
343344 AgentAudioDoneResponse ,
Original file line number Diff line number Diff line change 347347 ConversationTextResponse ,
348348 UserStartedSpeakingResponse ,
349349 AgentThinkingResponse ,
350+ FunctionCall ,
350351 FunctionCallRequest ,
351352 AgentStartedSpeakingResponse ,
352353 AgentAudioDoneResponse ,
Original file line number Diff line number Diff line change 2222 ConversationTextResponse ,
2323 UserStartedSpeakingResponse ,
2424 AgentThinkingResponse ,
25+ FunctionCall ,
2526 FunctionCallRequest ,
2627 AgentStartedSpeakingResponse ,
2728 AgentAudioDoneResponse ,
Original file line number Diff line number Diff line change 2121 ConversationTextResponse as LatestConversationTextResponse ,
2222 UserStartedSpeakingResponse as LatestUserStartedSpeakingResponse ,
2323 AgentThinkingResponse as LatestAgentThinkingResponse ,
24+ FunctionCall as LatestFunctionCall ,
2425 FunctionCallRequest as LatestFunctionCallRequest ,
2526 AgentStartedSpeakingResponse as LatestAgentStartedSpeakingResponse ,
2627 AgentAudioDoneResponse as LatestAgentAudioDoneResponse ,
7071ConversationTextResponse = LatestConversationTextResponse
7172UserStartedSpeakingResponse = LatestUserStartedSpeakingResponse
7273AgentThinkingResponse = LatestAgentThinkingResponse
74+ FunctionCall = LatestFunctionCall
7375FunctionCallRequest = LatestFunctionCallRequest
7476AgentStartedSpeakingResponse = LatestAgentStartedSpeakingResponse
7577AgentAudioDoneResponse = LatestAgentAudioDoneResponse
Original file line number Diff line number Diff line change 2626 ConversationTextResponse ,
2727 UserStartedSpeakingResponse ,
2828 AgentThinkingResponse ,
29+ FunctionCall ,
2930 FunctionCallRequest ,
3031 AgentStartedSpeakingResponse ,
3132 AgentAudioDoneResponse ,
Original file line number Diff line number Diff line change 1818 ConversationTextResponse ,
1919 UserStartedSpeakingResponse ,
2020 AgentThinkingResponse ,
21+ FunctionCall ,
2122 FunctionCallRequest ,
2223 AgentStartedSpeakingResponse ,
2324 AgentAudioDoneResponse ,
Original file line number Diff line number Diff line change @@ -448,8 +448,9 @@ class FunctionCallResponse(BaseResponse):
448448 """
449449
450450 type : str = "FunctionCallResponse"
451- function_call_id : str = field (default = "" )
452- output : str = field (default = "" )
451+ id : str = field (default = "" )
452+ name : str = field (default = "" )
453+ content : str = field (default = "" )
453454
454455
455456# Agent Keep Alive
Original file line number Diff line number Diff line change @@ -68,16 +68,43 @@ class AgentThinkingResponse(BaseResponse):
6868 content : str
6969
7070
71+ @dataclass
72+ class FunctionCall (BaseResponse ):
73+ """
74+ Individual function call within a FunctionCallRequest.
75+ """
76+
77+ id : str
78+ name : str
79+ arguments : str
80+ client_side : bool
81+
82+
7183@dataclass
7284class FunctionCallRequest (BaseResponse ):
7385 """
7486 The FunctionCallRequest message is used to call a function from the server to the client.
7587 """
7688
7789 type : str
78- function_name : str
79- function_call_id : str
80- input : str
90+ functions : List [FunctionCall ]
91+
92+ def __post_init__ (self ):
93+ """Convert dict functions to FunctionCall objects if needed."""
94+ if self .functions :
95+ self .functions = [
96+ FunctionCall .from_dict (func ) if isinstance (func , dict ) else func
97+ for func in self .functions
98+ ]
99+
100+ def __getitem__ (self , key ):
101+ _dict = self .to_dict ()
102+ if "functions" in _dict and isinstance (_dict ["functions" ], list ):
103+ _dict ["functions" ] = [
104+ FunctionCall .from_dict (func ) if isinstance (func , dict ) else func
105+ for func in _dict ["functions" ]
106+ ]
107+ return _dict [key ]
81108
82109
83110@dataclass
You can’t perform that action at this time.
0 commit comments