From 08c782b96b6868ce6912f3c31c0f5e27751bd1ea Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 3 Aug 2024 11:30:23 +0100 Subject: [PATCH] chore: model_name .lower() --- src/openagent/agent/function_agent.py | 8 ++++++-- src/openagent/conf/env.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/openagent/agent/function_agent.py b/src/openagent/agent/function_agent.py index cdb9227e..45dcd8c3 100644 --- a/src/openagent/agent/function_agent.py +++ b/src/openagent/agent/function_agent.py @@ -84,13 +84,16 @@ def create_react_agent(session_id: str): # Function to create an interpreter based on model name def create_interpreter(model_name): + # OpenAI models if model_name.startswith("gpt"): return ChatOpenAI( model=model_name, temperature=0.3, streaming=True, ) + # Google models elif model_name.startswith("gemini"): + # via Google AI studio if settings.GOOGLE_GEMINI_API_KEY is not None: return ChatGoogleGenerativeAI( model=model_name, @@ -98,14 +101,15 @@ def create_interpreter(model_name): temperature=0.3, streaming=True, ) + # via Google Cloud Vertex AI else: return ChatVertexAI( - model=settings.MODEL_NAME, + model=model_name, project=settings.GOOGLE_CLOUD_PROJECT_ID, temperature=0.3, streaming=True, - verbose=True, ) + # local models via Ollama else: return ChatOllama( model=model_name, diff --git a/src/openagent/conf/env.py b/src/openagent/conf/env.py index 27083736..1d2ffc63 100644 --- a/src/openagent/conf/env.py +++ b/src/openagent/conf/env.py @@ -8,7 +8,7 @@ class Settings(BaseSettings): - MODEL_NAME: str = Field(default="gemini-1.5-pro", env="MODEL_NAME") + MODEL_NAME: str = Field(default="gemini-1.5-pro", env="MODEL_NAME").lower() LLM_API_BASE: Optional[str] = Field(default=None) GOOGLE_CLOUD_PROJECT_ID: Optional[str] = Field(default=None) GOOGLE_GEMINI_API_KEY: Optional[str] = Field(default=None)