Skip to content

Commit

Permalink
chore: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
djcopley committed Feb 9, 2025
1 parent 8efabfe commit 79f9b9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/shelloracle/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def __get__(self, instance: Provider, owner: type[Provider]) -> T:

def _providers() -> dict[str, type[Provider]]:
from shelloracle.providers.deepseek import Deepseek
from shelloracle.providers.google import Google
from shelloracle.providers.localai import LocalAI
from shelloracle.providers.ollama import Ollama
from shelloracle.providers.openai import OpenAI
from shelloracle.providers.xai import XAI
from shelloracle.providers.google import Google

return {
Ollama.name: Ollama,
Expand Down
5 changes: 2 additions & 3 deletions src/shelloracle/providers/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def __init__(self):
genai.configure(api_key=self.api_key)
self.model_instance = genai.GenerativeModel(self.model)


async def generate(self, prompt: str) -> AsyncIterator[str]:
try:
response = await self.model_instance.generate_content_async(
Expand All @@ -27,11 +26,11 @@ async def generate(self, prompt: str) -> AsyncIterator[str]:
{"role": "model", "parts": ["Okay."]}, # Gemini requires a model response before user input
{"role": "user", "parts": [prompt]},
],
stream=True
stream=True,
)

async for chunk in response:
yield chunk.text
except Exception as e:
msg = f"Something went wrong while querying Google Gemini: {e}"
raise ProviderError(msg) from e
raise ProviderError(msg) from e

0 comments on commit 79f9b9c

Please sign in to comment.