Files
pipecat/examples/unified-format-function-calling/standard-function-calling-gemini-multimodal.py
2025-03-05 14:12:30 -03:00

39 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#
# Copyright (c) 20242025, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
#
import asyncio
import os
from dotenv import load_dotenv
from multimodal_base_function_calling import MultimodalWeatherBot
from pipecat.adapters.schemas.tools_schema import AdapterType
from pipecat.services.gemini_multimodal_live import GeminiMultimodalLiveLLMService
load_dotenv(override=True)
class GeminiMultimodalWeatherBot(MultimodalWeatherBot):
"""Main class defining the LLM and passing it to the base handler."""
def __init__(self):
search_tool = {"google_search": {}}
tools_def = MultimodalWeatherBot.tools()
tools_def.custom_tools = {AdapterType.GEMINI: [search_tool]}
llm = GeminiMultimodalLiveLLMService(
api_key=os.getenv("GOOGLE_API_KEY"),
voice_id="Puck",
transcribe_user_audio=True,
transcribe_model_audio=True,
tools=tools_def,
)
super().__init__(llm)
if __name__ == "__main__":
asyncio.run(GeminiMultimodalWeatherBot().run())