Skip to content

Commit

Permalink
chore: model_name .lower()
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryQW committed Aug 3, 2024
1 parent 3aa8064 commit 08c782b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/openagent/agent/function_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,32 @@ 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,
google_api_key=settings.GOOGLE_GEMINI_API_KEY,
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,
Expand Down
2 changes: 1 addition & 1 deletion src/openagent/conf/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 08c782b

Please sign in to comment.