mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Don't set error_code and error_message when model stop response in normal case
PiperOrigin-RevId: 783415488
This commit is contained in:
committed by
Copybara-Service
parent
ce037ec888
commit
3c6e18fd1c
@@ -27,6 +27,7 @@ from typing import Union
|
||||
|
||||
from google.genai import Client
|
||||
from google.genai import types
|
||||
from google.genai.types import FinishReason
|
||||
from typing_extensions import override
|
||||
|
||||
from .. import version
|
||||
@@ -161,8 +162,12 @@ class Gemini(BaseLlm):
|
||||
parts.append(types.Part.from_text(text=text))
|
||||
yield LlmResponse(
|
||||
content=types.ModelContent(parts=parts),
|
||||
error_code=response.candidates[0].finish_reason,
|
||||
error_message=response.candidates[0].finish_message,
|
||||
error_code=None
|
||||
if response.candidates[0].finish_reason == FinishReason.STOP
|
||||
else response.candidates[0].finish_reason,
|
||||
error_message=None
|
||||
if response.candidates[0].finish_reason == FinishReason.STOP
|
||||
else response.candidates[0].finish_message,
|
||||
usage_metadata=usage_metadata,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user