lakshinav commited on
Commit
0279ac2
·
verified ·
1 Parent(s): 999f7f9

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +9 -9
agent.py CHANGED
@@ -4,8 +4,8 @@ from dotenv import load_dotenv
4
  from langgraph.graph import START, StateGraph, MessagesState
5
  from langgraph.prebuilt import tools_condition
6
  from langgraph.prebuilt import ToolNode
7
- from langchain_google_genai import ChatGoogleGenerativeAI
8
- from langchain_groq import ChatGroq
9
  from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint, HuggingFaceEmbeddings
10
  from langchain_community.tools.tavily_search import TavilySearchResults
11
  from langchain_community.document_loaders import WikipediaLoader
@@ -152,16 +152,16 @@ tools = [
152
  ]
153
 
154
  # Build graph function
155
- def build_graph(provider: str = "groq"):
156
  """Build the graph"""
157
  # Load environment variables from .env file
158
- if provider == "google":
159
  # Google Gemini
160
- llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
161
- elif provider == "groq":
162
  # Groq https://console.groq.com/docs/models
163
- llm = ChatGroq(model="qwen-qwq-32b", temperature=0) # optional : qwen-qwq-32b gemma2-9b-it
164
- elif provider == "huggingface":
165
  # TODO: Add huggingface endpoint
166
  llm = ChatHuggingFace(
167
  llm=HuggingFaceEndpoint(
@@ -206,7 +206,7 @@ def build_graph(provider: str = "groq"):
206
  if __name__ == "__main__":
207
  question = "When was a picture of St. Thomas Aquinas first added to the Wikipedia page on the Principle of double effect?"
208
  # Build the graph
209
- graph = build_graph(provider="groq")
210
  # Run the graph
211
  messages = [HumanMessage(content=question)]
212
  messages = graph.invoke({"messages": messages})
 
4
  from langgraph.graph import START, StateGraph, MessagesState
5
  from langgraph.prebuilt import tools_condition
6
  from langgraph.prebuilt import ToolNode
7
+ # from langchain_google_genai import ChatGoogleGenerativeAI
8
+ # from langchain_groq import ChatGroq
9
  from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint, HuggingFaceEmbeddings
10
  from langchain_community.tools.tavily_search import TavilySearchResults
11
  from langchain_community.document_loaders import WikipediaLoader
 
152
  ]
153
 
154
  # Build graph function
155
+ def build_graph(provider: str = "huggingface"):
156
  """Build the graph"""
157
  # Load environment variables from .env file
158
+ # if provider == "google":
159
  # Google Gemini
160
+ # llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
161
+ # elif provider == "groq":
162
  # Groq https://console.groq.com/docs/models
163
+ # llm = ChatGroq(model="qwen-qwq-32b", temperature=0) # optional : qwen-qwq-32b gemma2-9b-it
164
+ if provider == "huggingface":
165
  # TODO: Add huggingface endpoint
166
  llm = ChatHuggingFace(
167
  llm=HuggingFaceEndpoint(
 
206
  if __name__ == "__main__":
207
  question = "When was a picture of St. Thomas Aquinas first added to the Wikipedia page on the Principle of double effect?"
208
  # Build the graph
209
+ graph = build_graph(provider="huggingface")
210
  # Run the graph
211
  messages = [HumanMessage(content=question)]
212
  messages = graph.invoke({"messages": messages})