diff --git a/CHANGELOG.md b/CHANGELOG.md index da59e5dd5..319c92f12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- GoogleLLMService `api_key` argument is now mandatory. + ### Fixed - Fixed AzureLLMService. diff --git a/examples/foundational/12a-describe-video-gemini-flash.py b/examples/foundational/12a-describe-video-gemini-flash.py index 0b5a7893a..00e168ad5 100644 --- a/examples/foundational/12a-describe-video-gemini-flash.py +++ b/examples/foundational/12a-describe-video-gemini-flash.py @@ -62,19 +62,15 @@ async def main(room_url: str, token): ) ) - tts = ElevenLabsTTSService( - aiohttp_session=session, - api_key=os.getenv("ELEVENLABS_API_KEY"), - voice_id=os.getenv("ELEVENLABS_VOICE_ID"), - ) - user_response = UserResponseAggregator() image_requester = UserImageRequester() vision_aggregator = VisionImageFrameAggregator() - google = GoogleLLMService(model="gemini-1.5-flash-latest") + google = GoogleLLMService( + model="gemini-1.5-flash-latest", + api_key=os.getenv("GOOGLE_API_KEY")) tts = ElevenLabsTTSService( aiohttp_session=session, diff --git a/src/pipecat/services/anthropic.py b/src/pipecat/services/anthropic.py index 2610e6dca..f1368f6fa 100644 --- a/src/pipecat/services/anthropic.py +++ b/src/pipecat/services/anthropic.py @@ -44,9 +44,9 @@ class AnthropicLLMService(LLMService): def __init__( self, - api_key, - model="claude-3-opus-20240229", - max_tokens=1024): + api_key: str, + model: str = "claude-3-opus-20240229", + max_tokens: int = 1024): super().__init__() self._client = AsyncAnthropic(api_key=api_key) self._model = model diff --git a/src/pipecat/services/azure.py b/src/pipecat/services/azure.py index 10ee0dd9d..080e3680e 100644 --- a/src/pipecat/services/azure.py +++ b/src/pipecat/services/azure.py @@ -11,6 +11,7 @@ import io from PIL import Image from typing import AsyncGenerator +from numpy import str_ from openai import AsyncAzureOpenAI from pipecat.frames.frames import AudioRawFrame, ErrorFrame, Frame, URLImageRawFrame @@ -73,10 +74,10 @@ class AzureLLMService(BaseOpenAILLMService): def __init__( self, *, - api_key, - endpoint, - api_version="2023-12-01-preview", - model): + api_key: str, + endpoint: str, + model: str, + api_version: str = "2023-12-01-preview"): # Initialize variables before calling parent __init__() because that # will call create_client() and we need those values there. self._endpoint = endpoint @@ -96,12 +97,12 @@ class AzureImageGenServiceREST(ImageGenService): def __init__( self, *, - api_version="2023-06-01-preview", - image_size: str, aiohttp_session: aiohttp.ClientSession, - api_key, - endpoint, - model, + image_size: str, + api_key: str, + endpoint: str, + model: str, + api_version="2023-06-01-preview", ): super().__init__() diff --git a/src/pipecat/services/fireworks.py b/src/pipecat/services/fireworks.py index 6d2d44e6c..2c1020be5 100644 --- a/src/pipecat/services/fireworks.py +++ b/src/pipecat/services/fireworks.py @@ -19,6 +19,6 @@ except ModuleNotFoundError as e: class FireworksLLMService(BaseOpenAILLMService): def __init__(self, - model="accounts/fireworks/models/firefunction-v1", - base_url="https://api.fireworks.ai/inference/v1"): + model: str = "accounts/fireworks/models/firefunction-v1", + base_url: str = "https://api.fireworks.ai/inference/v1"): super().__init__(model, base_url) diff --git a/src/pipecat/services/google.py b/src/pipecat/services/google.py index 316cb91bd..f42a9b069 100644 --- a/src/pipecat/services/google.py +++ b/src/pipecat/services/google.py @@ -40,9 +40,9 @@ class GoogleLLMService(LLMService): franca for all LLM services, so that it is easy to switch between different LLMs. """ - def __init__(self, model="gemini-1.5-flash-latest", api_key=None, **kwargs): + def __init__(self, api_key: str, model: str = "gemini-1.5-flash-latest", **kwargs): super().__init__(**kwargs) - gai.configure(api_key=api_key or os.environ["GOOGLE_API_KEY"]) + gai.configure(api_key=api_key) self._client = gai.GenerativeModel(model) def _get_messages_from_openai_context( diff --git a/src/pipecat/services/ollama.py b/src/pipecat/services/ollama.py index 781d00260..5de16dc07 100644 --- a/src/pipecat/services/ollama.py +++ b/src/pipecat/services/ollama.py @@ -9,5 +9,5 @@ from pipecat.services.openai import BaseOpenAILLMService class OLLamaLLMService(BaseOpenAILLMService): - def __init__(self, model="llama2", base_url="http://localhost:11434/v1"): + def __init__(self, model: str = "llama2", base_url: str = "http://localhost:11434/v1"): super().__init__(model=model, base_url=base_url, api_key="ollama")