Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added google api embedings and updated modles #220

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ def initialize():
# chat_llm = models.get_openrouter_chat(model_name="openai/o1-mini-2024-09-12")
# chat_llm = models.get_azure_openai_chat(deployment_name="gpt-4o-mini", temperature=0)
# chat_llm = models.get_anthropic_chat(model_name="claude-3-5-sonnet-20240620", temperature=0)
# chat_llm = models.get_google_chat(model_name="gemini-1.5-flash", temperature=0)
# chat_llm = models.get_google_chat(model_name="gemini-1.5-pro-002", temperature=0)
# chat_llm = models.get_google_chat(model_name="gemini-1.5-pro-exp-0827", temperature=0)
# chat_llm = models.get_google_chat(model_name="gemini-1.5-flash-002", temperature=0)
# chat_llm = models.get_google_chat(model_name="gemini-1.5-flash-exp-0827", temperature=0)
# chat_llm = models.get_google_chat(model_name="gemini-1.5-flash-8b-exp-0924", temperature=0)
# chat_llm = models.get_google_chat(model_name="gemini-1.5-flash-8b-exp-0827", temperature=0)
# chat_llm = models.get_mistral_chat(model_name="mistral-small-latest", temperature=0)
# chat_llm = models.get_groq_chat(model_name="llama-3.2-90b-text-preview", temperature=0)
# chat_llm = models.get_sambanova_chat(model_name="Meta-Llama-3.1-70B-Instruct-8k", temperature=0)
Expand All @@ -24,6 +29,8 @@ def initialize():
# embedding_llm = models.get_ollama_embedding(model_name="nomic-embed-text")
# embedding_llm = models.get_huggingface_embedding(model_name="sentence-transformers/all-MiniLM-L6-v2")
# embedding_llm = models.get_lmstudio_embedding(model_name="nomic-ai/nomic-embed-text-v1.5-GGUF")
# embedding_llm = models.get_google_embedding(model_name="models/embedding-001")
embedding_llm = models.get_google_embedding(model_name="models/text-embedding-004")

# agent configuration
config = AgentConfig(
Expand Down
5 changes: 4 additions & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from langchain_anthropic import ChatAnthropic
from langchain_groq import ChatGroq
from langchain_huggingface import HuggingFaceEmbeddings
from langchain_google_genai import GoogleGenerativeAI, HarmBlockThreshold, HarmCategory
from langchain_google_genai import GoogleGenerativeAI, HarmBlockThreshold, HarmCategory, GoogleGenerativeAIEmbeddings
from langchain_mistralai import ChatMistralAI
from pydantic.v1.types import SecretStr
from python.helpers.dotenv import load_dotenv
Expand Down Expand Up @@ -69,6 +69,9 @@ def get_azure_openai_embedding(deployment_name:str, api_key=get_api_key("openai_
def get_google_chat(model_name:str, api_key=get_api_key("google"), temperature=DEFAULT_TEMPERATURE):
return GoogleGenerativeAI(model=model_name, temperature=temperature, google_api_key=api_key, safety_settings={HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE }) # type: ignore

def get_google_embedding(model_name:str, api_key=get_api_key("google")):
return GoogleGenerativeAIEmbeddings(model=model_name, google_api_key=api_key)

# Mistral models
def get_mistral_chat(model_name:str, api_key=get_api_key("mistral"), temperature=DEFAULT_TEMPERATURE):
return ChatMistralAI(model=model_name, temperature=temperature, api_key=api_key) # type: ignore
Expand Down