Skip to content

Commit

Permalink
Gemini provider
Browse files Browse the repository at this point in the history
  • Loading branch information
simonff committed Dec 29, 2023
1 parent 2ec28cd commit 929fbd9
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions packages/jupyter-ai-magics/jupyter_ai_magics/providers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
bar
import asyncio
import base64
import copy
Expand Down Expand Up @@ -45,7 +44,7 @@
from langchain.pydantic_v1 import BaseModel, Extra, root_validator
from langchain.schema import LLMResult
from langchain.utils import get_from_dict_or_env
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain_google_genai import ChatGoogleGenerativeAI, GoogleGenerativeAI


class EnvAuthStrategy(BaseModel):
Expand Down Expand Up @@ -791,3 +790,20 @@ class QianfanProvider(BaseProvider, QianfanChatEndpoint):
model_id_key = "model_name"
pypi_package_deps = ["qianfan"]
auth_strategy = MultiEnvAuthStrategy(names=["QIANFAN_AK", "QIANFAN_SK"])


class GeminiAIProvider(BaseProvider, GoogleGenerativeAI):
id = "geming"
name = "Gemini"
models = [
"gemini-pro",
]
model_id_key = "model"
pypi_package_deps = ["langchain-google-genai"]
auth_strategy = EnvAuthStrategy(name="GOOGLE_API_KEY")

@classmethod
def is_api_key_exc(cls, e: Exception):
return False


0 comments on commit 929fbd9

Please sign in to comment.