No public description

PiperOrigin-RevId: 749202950
This commit is contained in:
Wei Sun 2025-04-18 18:07:04 -07:00 committed by Copybara-Service
parent daed456125
commit 6742ab9236
3 changed files with 11 additions and 3 deletions

View File

@ -23,7 +23,6 @@ from .readonly_context import ReadonlyContext
if TYPE_CHECKING:
from google.genai import types
from ..events.event import Event
from ..events.event_actions import EventActions
from ..sessions.state import State
from .invocation_context import InvocationContext

View File

@ -310,7 +310,7 @@ async def _process_function_live_helper(
function_response = {
'status': f'No active streaming function named {function_name} found'
}
elif hasattr(tool, "func") and inspect.isasyncgenfunction(tool.func):
elif inspect.isasyncgenfunction(tool.func):
print('is async')
# for streaming tool use case

View File

@ -14,7 +14,7 @@
from __future__ import annotations
from typing import Optional
from typing import Any, Optional
from google.genai import types
from pydantic import BaseModel
@ -37,6 +37,7 @@ class LlmResponse(BaseModel):
error_message: Error message if the response is an error.
interrupted: Flag indicating that LLM was interrupted when generating the
content. Usually it's due to user interruption during a bidi streaming.
custom_metadata: The custom metadata of the LlmResponse.
"""
model_config = ConfigDict(extra='forbid')
@ -71,6 +72,14 @@ class LlmResponse(BaseModel):
Usually it's due to user interruption during a bidi streaming.
"""
custom_metadata: Optional[dict[str, Any]] = None
"""The custom metadata of the LlmResponse.
An optional key-value pair to label an LlmResponse.
NOTE: the entire dict must be JSON serializable.
"""
@staticmethod
def create(
generate_content_response: types.GenerateContentResponse,