Update comments for accuracy
This commit is contained in:
@@ -231,7 +231,9 @@ class GeminiLLMAdapter(BaseLLMAdapter[GeminiLLMInvocationParams]):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Special handling for non-function-call-related thought
|
# Special handling for non-function-call-related thought
|
||||||
# signature messages (Gemini 3 Pro)
|
# signature messages (Gemini 3 Pro mainly, but possibly others,
|
||||||
|
# too, especially when functions are involved in the
|
||||||
|
# conversation)
|
||||||
if (
|
if (
|
||||||
isinstance(message.message, dict)
|
isinstance(message.message, dict)
|
||||||
and message.message.get("type") == "non_fn_thought_signature"
|
and message.message.get("type") == "non_fn_thought_signature"
|
||||||
@@ -447,7 +449,7 @@ class GeminiLLMAdapter(BaseLLMAdapter[GeminiLLMInvocationParams]):
|
|||||||
def _apply_function_thought_signature_to_messages(
|
def _apply_function_thought_signature_to_messages(
|
||||||
self, thought_signature: bytes, tool_call_id: str, messages: List[Content]
|
self, thought_signature: bytes, tool_call_id: str, messages: List[Content]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Apply tool_call_extra metadata to the corresponding function call message.
|
"""Apply a function-related thought signature to the corresponding function call message.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
thought_signature: The thought signature bytes to apply.
|
thought_signature: The thought signature bytes to apply.
|
||||||
@@ -476,10 +478,11 @@ class GeminiLLMAdapter(BaseLLMAdapter[GeminiLLMInvocationParams]):
|
|||||||
def _apply_non_function_thought_signatures_to_messages(
|
def _apply_non_function_thought_signatures_to_messages(
|
||||||
self, thought_signatures: List[bytes], messages: List[Content]
|
self, thought_signatures: List[bytes], messages: List[Content]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Apply non-function-call-related thought signatures to the last part of each non-function-call assistant message.
|
"""Apply non-function-call-related thought signatures to the last part of corresponding non-function-call assistant messages.
|
||||||
|
|
||||||
Gemini 3 Pro outputs a thought signature at the end of each assistant
|
Gemini 3 Pro (and, somewhat surprisingly, other models, too, when
|
||||||
response.
|
functions are involved in the conversation) outputs a thought signature
|
||||||
|
at the end of assistant responses.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
thought_signatures: The list of thought signature bytes to apply.
|
thought_signatures: The list of thought signature bytes to apply.
|
||||||
|
|||||||
@@ -1005,9 +1005,12 @@ class GoogleLLMService(LLMService):
|
|||||||
)
|
)
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
|
|
||||||
# With Gemini 3 Pro, thought signatures can be
|
# With Gemini 3 Pro (and, somewhat surprisingly,
|
||||||
# included in any kind of part, not just function
|
# other models models, too, especially when
|
||||||
# calls. It will come in the last part of a response.
|
# functions are involved in the conversation),
|
||||||
|
# thought signatures can be included in any kind of
|
||||||
|
# part, not just function calls. It will come in
|
||||||
|
# the last part of a response.
|
||||||
if part.thought_signature and not part.function_call:
|
if part.thought_signature and not part.function_call:
|
||||||
await self.push_frame(
|
await self.push_frame(
|
||||||
LLMMessagesAppendFrame(
|
LLMMessagesAppendFrame(
|
||||||
|
|||||||
Reference in New Issue
Block a user