File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 23
23
if TYPE_CHECKING :
24
24
from google .genai import types
25
25
26
- from ..events .event import Event
27
26
from ..events .event_actions import EventActions
28
27
from ..sessions .state import State
29
28
from .invocation_context import InvocationContext
Original file line number Diff line number Diff line change @@ -310,7 +310,7 @@ async def _process_function_live_helper(
310
310
function_response = {
311
311
'status' : f'No active streaming function named { function_name } found'
312
312
}
313
- elif hasattr ( tool , "func" ) and inspect .isasyncgenfunction (tool .func ):
313
+ elif inspect .isasyncgenfunction (tool .func ):
314
314
print ('is async' )
315
315
316
316
# for streaming tool use case
Original file line number Diff line number Diff line change 14
14
15
15
from __future__ import annotations
16
16
17
- from typing import Optional
17
+ from typing import Any , Optional
18
18
19
19
from google .genai import types
20
20
from pydantic import BaseModel
@@ -37,6 +37,7 @@ class LlmResponse(BaseModel):
37
37
error_message: Error message if the response is an error.
38
38
interrupted: Flag indicating that LLM was interrupted when generating the
39
39
content. Usually it's due to user interruption during a bidi streaming.
40
+ custom_metadata: The custom metadata of the LlmResponse.
40
41
"""
41
42
42
43
model_config = ConfigDict (extra = 'forbid' )
@@ -71,6 +72,14 @@ class LlmResponse(BaseModel):
71
72
Usually it's due to user interruption during a bidi streaming.
72
73
"""
73
74
75
+ custom_metadata : Optional [dict [str , Any ]] = None
76
+ """The custom metadata of the LlmResponse.
77
+
78
+ An optional key-value pair to label an LlmResponse.
79
+
80
+ NOTE: the entire dict must be JSON serializable.
81
+ """
82
+
74
83
@staticmethod
75
84
def create (
76
85
generate_content_response : types .GenerateContentResponse ,
You can’t perform that action at this time.
0 commit comments