Module livekit.plugins.google.tools
Classes
class FileSearch (file_search_store_names: list[str],
top_k: int | None = None,
metadata_filter: str | None = None)-
Expand source code
@dataclass class FileSearch(GeminiTool): file_search_store_names: list[str] top_k: int | None = None metadata_filter: str | None = None def __post_init__(self) -> None: super().__init__(id="gemini_file_search") def to_tool_config(self) -> types.Tool: return types.Tool( file_search=types.FileSearch( file_search_store_names=self.file_search_store_names, top_k=self.top_k, metadata_filter=self.metadata_filter, ) )FileSearch(file_search_store_names: list[str], top_k: int | None = None, metadata_filter: str | None = None)
Ancestors
- GeminiTool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Instance variables
var file_search_store_names : list[str]var metadata_filter : str | Nonevar top_k : int | None
Methods
def to_tool_config(self) ‑> google.genai.types.Tool-
Expand source code
def to_tool_config(self) -> types.Tool: return types.Tool( file_search=types.FileSearch( file_search_store_names=self.file_search_store_names, top_k=self.top_k, metadata_filter=self.metadata_filter, ) )
class GeminiTool (*, id: str)-
Expand source code
class GeminiTool(llm.ProviderTool, ABC): @abstractmethod def to_tool_config(self) -> types.Tool: ...Helper class that provides a standard way to create an ABC using inheritance.
Ancestors
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Subclasses
Methods
def to_tool_config(self) ‑> google.genai.types.Tool-
Expand source code
@abstractmethod def to_tool_config(self) -> types.Tool: ...
class GoogleMaps (auth_config: google.genai.types.AuthConfig | None = None,
enable_widget: bool | None = None)-
Expand source code
@dataclass class GoogleMaps(GeminiTool): auth_config: types.AuthConfig | None = None enable_widget: bool | None = None def __post_init__(self) -> None: super().__init__(id="gemini_google_maps") def to_tool_config(self) -> types.Tool: return types.Tool( google_maps=types.GoogleMaps( auth_config=self.auth_config, enable_widget=self.enable_widget, ) )GoogleMaps(auth_config: google.genai.types.AuthConfig | None = None, enable_widget: bool | None = None)
Ancestors
- GeminiTool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Instance variables
var auth_config : google.genai.types.AuthConfig | Nonevar enable_widget : bool | None
Methods
def to_tool_config(self) ‑> google.genai.types.Tool-
Expand source code
def to_tool_config(self) -> types.Tool: return types.Tool( google_maps=types.GoogleMaps( auth_config=self.auth_config, enable_widget=self.enable_widget, ) )
class GoogleSearch (exclude_domains: list[str] | None = None,
blocking_confidence: google.genai.types.PhishBlockThreshold | None = None,
time_range_filter: google.genai.types.Interval | None = None)-
Expand source code
@dataclass class GoogleSearch(GeminiTool): exclude_domains: list[str] | None = None blocking_confidence: types.PhishBlockThreshold | None = None time_range_filter: types.Interval | None = None def __post_init__(self) -> None: super().__init__(id="gemini_google_search") def to_tool_config(self) -> types.Tool: return types.Tool( google_search=types.GoogleSearch( exclude_domains=self.exclude_domains, blocking_confidence=self.blocking_confidence, time_range_filter=self.time_range_filter, ) )GoogleSearch(exclude_domains: list[str] | None = None, blocking_confidence: google.genai.types.PhishBlockThreshold | None = None, time_range_filter: google.genai.types.Interval | None = None)
Ancestors
- GeminiTool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Instance variables
var blocking_confidence : google.genai.types.PhishBlockThreshold | Nonevar exclude_domains : list[str] | Nonevar time_range_filter : google.genai.types.Interval | None
Methods
def to_tool_config(self) ‑> google.genai.types.Tool-
Expand source code
def to_tool_config(self) -> types.Tool: return types.Tool( google_search=types.GoogleSearch( exclude_domains=self.exclude_domains, blocking_confidence=self.blocking_confidence, time_range_filter=self.time_range_filter, ) )
class ToolCodeExecution-
Expand source code
class ToolCodeExecution(GeminiTool): def __init__(self) -> None: super().__init__(id="gemini_code_execution") def to_tool_config(self) -> types.Tool: return types.Tool( code_execution=types.ToolCodeExecution(), )Helper class that provides a standard way to create an ABC using inheritance.
Ancestors
- GeminiTool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Methods
def to_tool_config(self) ‑> google.genai.types.Tool-
Expand source code
def to_tool_config(self) -> types.Tool: return types.Tool( code_execution=types.ToolCodeExecution(), )
class URLContext-
Expand source code
class URLContext(GeminiTool): def __init__(self) -> None: super().__init__(id="gemini_url_context") def to_tool_config(self) -> types.Tool: return types.Tool( url_context=types.UrlContext(), )Helper class that provides a standard way to create an ABC using inheritance.
Ancestors
- GeminiTool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Methods
def to_tool_config(self) ‑> google.genai.types.Tool-
Expand source code
def to_tool_config(self) -> types.Tool: return types.Tool( url_context=types.UrlContext(), )
class VertexRAGRetrieval (rag_resources: list[str],
similarity_top_k: int = 3,
vector_distance_threshold: float | None = None)-
Expand source code
@dataclass class VertexRAGRetrieval(GeminiTool): """Vertex AI RAG Engine retrieval tool for server-side grounding. Enables single-pass retrieval during Gemini inference with no tool-call round-trip. Works like Google Search grounding but against your own document corpus managed by Vertex AI RAG Engine. Args: rag_resources: RAG corpus resource names (e.g. ``["projects/123/locations/us-central1/ragCorpora/456"]``). similarity_top_k: Number of top results to retrieve. vector_distance_threshold: Optional distance threshold for filtering. """ rag_resources: list[str] similarity_top_k: int = 3 vector_distance_threshold: float | None = None def __post_init__(self) -> None: super().__init__(id="gemini_vertex_rag_retrieval") def to_tool_config(self) -> types.Tool: return types.Tool( retrieval=types.Retrieval( vertex_rag_store=types.VertexRagStore( rag_resources=[ types.VertexRagStoreRagResource(rag_corpus=corpus) for corpus in self.rag_resources ], similarity_top_k=self.similarity_top_k, vector_distance_threshold=self.vector_distance_threshold, ), ) )Vertex AI RAG Engine retrieval tool for server-side grounding.
Enables single-pass retrieval during Gemini inference with no tool-call round-trip. Works like Google Search grounding but against your own document corpus managed by Vertex AI RAG Engine.
Args
rag_resources- RAG corpus resource names
(e.g.
["projects/123/locations/us-central1/ragCorpora/456"]). similarity_top_k- Number of top results to retrieve.
vector_distance_threshold- Optional distance threshold for filtering.
Ancestors
- GeminiTool
- livekit.agents.llm.tool_context.ProviderTool
- livekit.agents.llm.tool_context.Tool
- abc.ABC
Instance variables
var rag_resources : list[str]var similarity_top_k : intvar vector_distance_threshold : float | None
Methods
def to_tool_config(self) ‑> google.genai.types.Tool-
Expand source code
def to_tool_config(self) -> types.Tool: return types.Tool( retrieval=types.Retrieval( vertex_rag_store=types.VertexRagStore( rag_resources=[ types.VertexRagStoreRagResource(rag_corpus=corpus) for corpus in self.rag_resources ], similarity_top_k=self.similarity_top_k, vector_distance_threshold=self.vector_distance_threshold, ), ) )