Fix tool calls when using Gemini Live + Vertex AI

This commit is contained in:
Paul Kompfner
2025-10-06 15:39:08 -04:00
parent 0b6dd98000
commit 2699f0c2a6

View File

@@ -16,6 +16,7 @@ import io
import json import json
import random import random
import time import time
import uuid
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum from enum import Enum
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
@@ -1345,7 +1346,11 @@ class GeminiMultimodalLiveLLMService(LLMService):
function_calls_llm = [ function_calls_llm = [
FunctionCallFromLLM( FunctionCallFromLLM(
context=self._context, context=self._context,
tool_call_id=f.id, tool_call_id=(
# NOTE: when using Vertex AI we don't get server-provided
# tool call IDs here
f.id or str(uuid.uuid4())
),
function_name=f.name, function_name=f.name,
arguments=f.args, arguments=f.args,
) )