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

@@ -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,