Skip to content

Commit

Permalink
Add Gemini to examples (#37)
Browse files Browse the repository at this point in the history
* add gemini to examples

* make gemini optional

---------

Co-authored-by: ANASOFT\keppert <peter.keppert@anasoft.com>
  • Loading branch information
peterkeppert and peterkeppert-anasoft authored Sep 24, 2024
1 parent 978575f commit 98def1a
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 25 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies = [
"langchain-community ~=0.3.0",
"langchain-openai ~=0.2.0",
"langchain-groq ~=0.2.0",
"langchain-google-genai ~=2.0.0",
"langgraph ~=0.2.22",
"langgraph-checkpoint ~=1.0.10",
"langgraph-checkpoint-sqlite ~=1.0.3",
Expand Down
5 changes: 5 additions & 0 deletions src/agent/research_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
from langchain_openai import ChatOpenAI
from langchain_groq import ChatGroq
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain_community.tools import DuckDuckGoSearchResults, OpenWeatherMapQueryRun
from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.messages import AIMessage, SystemMessage
Expand All @@ -28,6 +29,10 @@ class AgentState(MessagesState):

if os.getenv("GROQ_API_KEY") is not None:
models["llama-3.1-70b"] = ChatGroq(model="llama-3.1-70b-versatile", temperature=0.5)
if os.getenv("GOOGLE_API_KEY") is not None:
models["gemini-1.5-flash"] = ChatGoogleGenerativeAI(
model="gemini-1.5-flash", temperature=0.5, streaming=True
)

web_search = DuckDuckGoSearchResults(name="WebSearch")
tools = [web_search, calculator]
Expand Down
1 change: 1 addition & 0 deletions src/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async def main():

models = {
"OpenAI GPT-4o-mini (streaming)": "gpt-4o-mini",
"Gemini 1.5 Flash (streaming)": "gemini-1.5-flash",
"llama-3.1-70b on Groq": "llama-3.1-70b",
}
# Config options
Expand Down
Loading

0 comments on commit 98def1a

Please sign in to comment.