errchh commited on
Commit
7851025
·
1 Parent(s): 70ca1ab

change llm

Browse files
__pycache__/agent.cpython-312.pyc CHANGED
Binary files a/__pycache__/agent.cpython-312.pyc and b/__pycache__/agent.cpython-312.pyc differ
 
agent.py CHANGED
@@ -5,6 +5,7 @@ from typing import TypedDict, List, Dict, Any, Optional, Annotated
5
 
6
  from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint, HuggingFaceEmbeddings
7
  from langchain_google_genai import ChatGoogleGenerativeAI # Added ChatGoogleGenerativeAI
 
8
 
9
  from langgraph.graph import StateGraph, MessagesState, START, END
10
  from langgraph.graph.message import add_messages
@@ -29,6 +30,7 @@ HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
29
  print(f"DEBUG: HUGGINGFACEHUB_API_TOKEN = {HUGGINGFACEHUB_API_TOKEN}")
30
  GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
31
  print(f"DEBUG: GOOGLE_API_KEY = {GOOGLE_API_KEY}")
 
32
 
33
 
34
  # maths tool
@@ -153,18 +155,19 @@ tools = [
153
  ]
154
 
155
 
 
156
  # build graph function
157
  def build_graph():
158
  # llm
159
- llm = HuggingFaceEndpoint(
160
- repo_id="deepseek-ai/DeepSeek-V3-0324",
161
- huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
 
162
  )
163
  print(f"DEBUG: llm object = {llm}")
164
 
165
  # bind tools to llm
166
- chat = ChatHuggingFace(llm=llm, verbose=False)
167
- llm_with_tools = chat.bind_tools(tools)
168
  print(f"DEBUG: llm_with_tools object = {llm_with_tools}")
169
 
170
  # generate AgentState and Agent graph
 
5
 
6
  from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint, HuggingFaceEmbeddings
7
  from langchain_google_genai import ChatGoogleGenerativeAI # Added ChatGoogleGenerativeAI
8
+ from langchain_groq import ChatGroq
9
 
10
  from langgraph.graph import StateGraph, MessagesState, START, END
11
  from langgraph.graph.message import add_messages
 
30
  print(f"DEBUG: HUGGINGFACEHUB_API_TOKEN = {HUGGINGFACEHUB_API_TOKEN}")
31
  GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
32
  print(f"DEBUG: GOOGLE_API_KEY = {GOOGLE_API_KEY}")
33
+ GROQ_API_KEY = os.getenv("GROQ_API_KEY")
34
 
35
 
36
  # maths tool
 
155
  ]
156
 
157
 
158
+
159
  # build graph function
160
  def build_graph():
161
  # llm
162
+ llm = ChatGroq(
163
+ model="qwen-qwq-32b",
164
+ temperature=0,
165
+ api_key=GROQ_API_KEY
166
  )
167
  print(f"DEBUG: llm object = {llm}")
168
 
169
  # bind tools to llm
170
+ llm_with_tools = llm.bind_tools(tools)
 
171
  print(f"DEBUG: llm_with_tools object = {llm_with_tools}")
172
 
173
  # generate AgentState and Agent graph
pyproject.toml CHANGED
@@ -10,6 +10,7 @@ dependencies = [
10
  "gradio>=5.29.0",
11
  "langchain-community>=0.3.23",
12
  "langchain-google-genai>=2.1.4",
 
13
  "langchain-huggingface>=0.2.0",
14
  "langchain-openai>=0.3.16",
15
  "langchain-tools>=0.1.34",
 
10
  "gradio>=5.29.0",
11
  "langchain-community>=0.3.23",
12
  "langchain-google-genai>=2.1.4",
13
+ "langchain-groq>=0.3.2",
14
  "langchain-huggingface>=0.2.0",
15
  "langchain-openai>=0.3.16",
16
  "langchain-tools>=0.1.34",
requirements.txt CHANGED
@@ -3,6 +3,7 @@ duckduckgo-search
3
  gradio
4
  langchain-community
5
  langchain-google-genai
 
6
  langchain-huggingface
7
  langchain-openai
8
  langchain-tools
 
3
  gradio
4
  langchain-community
5
  langchain-google-genai
6
+ langchain-groq
7
  langchain-huggingface
8
  langchain-openai
9
  langchain-tools
uv.lock CHANGED
@@ -598,6 +598,23 @@ wheels = [
598
  { url = "https://files.pythonhosted.org/packages/28/27/3d6dcadc8a3214d8522c1e7f6a19554e33659be44546d44a2f7572ac7d2a/groovy-0.1.2-py3-none-any.whl", hash = "sha256:7f7975bab18c729a257a8b1ae9dcd70b7cafb1720481beae47719af57c35fa64", size = 14090, upload_time = "2025-02-28T20:24:55.152Z" },
599
  ]
600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
  [[package]]
602
  name = "grpcio"
603
  version = "1.71.0"
@@ -674,6 +691,7 @@ dependencies = [
674
  { name = "gradio" },
675
  { name = "langchain-community" },
676
  { name = "langchain-google-genai" },
 
677
  { name = "langchain-huggingface" },
678
  { name = "langchain-openai" },
679
  { name = "langchain-tools" },
@@ -691,6 +709,7 @@ requires-dist = [
691
  { name = "gradio", specifier = ">=5.29.0" },
692
  { name = "langchain-community", specifier = ">=0.3.23" },
693
  { name = "langchain-google-genai", specifier = ">=2.1.4" },
 
694
  { name = "langchain-huggingface", specifier = ">=0.2.0" },
695
  { name = "langchain-openai", specifier = ">=0.3.16" },
696
  { name = "langchain-tools", specifier = ">=0.1.34" },
@@ -917,6 +936,19 @@ wheels = [
917
  { url = "https://files.pythonhosted.org/packages/07/12/2be71bebbc23e4a499c50df567017110e4d382a045422647c8e6b1040541/langchain_google_genai-2.1.4-py3-none-any.whl", hash = "sha256:a3fa3cf7fe9c1de77280f42fbdd22cfcc5fbeb0d60cd5be7a0e6c50a74f5ce73", size = 44313, upload_time = "2025-04-30T08:29:44.864Z" },
918
  ]
919
 
 
 
 
 
 
 
 
 
 
 
 
 
 
920
  [[package]]
921
  name = "langchain-huggingface"
922
  version = "0.2.0"
 
598
  { url = "https://files.pythonhosted.org/packages/28/27/3d6dcadc8a3214d8522c1e7f6a19554e33659be44546d44a2f7572ac7d2a/groovy-0.1.2-py3-none-any.whl", hash = "sha256:7f7975bab18c729a257a8b1ae9dcd70b7cafb1720481beae47719af57c35fa64", size = 14090, upload_time = "2025-02-28T20:24:55.152Z" },
599
  ]
600
 
601
+ [[package]]
602
+ name = "groq"
603
+ version = "0.24.0"
604
+ source = { registry = "https://pypi.org/simple" }
605
+ dependencies = [
606
+ { name = "anyio" },
607
+ { name = "distro" },
608
+ { name = "httpx" },
609
+ { name = "pydantic" },
610
+ { name = "sniffio" },
611
+ { name = "typing-extensions" },
612
+ ]
613
+ sdist = { url = "https://files.pythonhosted.org/packages/c8/23/d71f076e9fd5f4f8989387c0bca3b5fd02c5eaa17f8fe0777fe0940d2d80/groq-0.24.0.tar.gz", hash = "sha256:e821559de8a77fb81d2585b3faec80ff923d6d64fd52339b33f6c94997d6f7f5", size = 125654, upload_time = "2025-05-02T16:13:31.01Z" }
614
+ wheels = [
615
+ { url = "https://files.pythonhosted.org/packages/98/f0/faa2a007981d74c3e0fe141d07e4ed43b95fed00d3b8489696602b51119d/groq-0.24.0-py3-none-any.whl", hash = "sha256:0020e6b0b2b267263c9eb7c318deef13c12f399c6525734200b11d777b00088e", size = 127536, upload_time = "2025-05-02T16:13:29.493Z" },
616
+ ]
617
+
618
  [[package]]
619
  name = "grpcio"
620
  version = "1.71.0"
 
691
  { name = "gradio" },
692
  { name = "langchain-community" },
693
  { name = "langchain-google-genai" },
694
+ { name = "langchain-groq" },
695
  { name = "langchain-huggingface" },
696
  { name = "langchain-openai" },
697
  { name = "langchain-tools" },
 
709
  { name = "gradio", specifier = ">=5.29.0" },
710
  { name = "langchain-community", specifier = ">=0.3.23" },
711
  { name = "langchain-google-genai", specifier = ">=2.1.4" },
712
+ { name = "langchain-groq", specifier = ">=0.3.2" },
713
  { name = "langchain-huggingface", specifier = ">=0.2.0" },
714
  { name = "langchain-openai", specifier = ">=0.3.16" },
715
  { name = "langchain-tools", specifier = ">=0.1.34" },
 
936
  { url = "https://files.pythonhosted.org/packages/07/12/2be71bebbc23e4a499c50df567017110e4d382a045422647c8e6b1040541/langchain_google_genai-2.1.4-py3-none-any.whl", hash = "sha256:a3fa3cf7fe9c1de77280f42fbdd22cfcc5fbeb0d60cd5be7a0e6c50a74f5ce73", size = 44313, upload_time = "2025-04-30T08:29:44.864Z" },
937
  ]
938
 
939
+ [[package]]
940
+ name = "langchain-groq"
941
+ version = "0.3.2"
942
+ source = { registry = "https://pypi.org/simple" }
943
+ dependencies = [
944
+ { name = "groq" },
945
+ { name = "langchain-core" },
946
+ ]
947
+ sdist = { url = "https://files.pythonhosted.org/packages/e0/4c/973faadcc54fc74352c6758208f48b08dd072025ab33beea52e6c31d4cd1/langchain_groq-0.3.2.tar.gz", hash = "sha256:033f459d4c0515e22a6e64f5a402e366933a6c827fd5915547419cb62fd7b34a", size = 22074, upload_time = "2025-03-31T13:42:29.024Z" }
948
+ wheels = [
949
+ { url = "https://files.pythonhosted.org/packages/c0/58/0d5a19168119c1bd7758ab28d9e6b5c12ba1091bb283f4dc13ca5df7651b/langchain_groq-0.3.2-py3-none-any.whl", hash = "sha256:bc111dea17a3510498c4697c42bf97e629bcf8f00b97fa25e51ea7947fc0b540", size = 15253, upload_time = "2025-03-31T13:42:28.163Z" },
950
+ ]
951
+
952
  [[package]]
953
  name = "langchain-huggingface"
954
  version = "0.2.0"