MariaFilipkowska commited on
Commit
0db5b88
·
verified ·
1 Parent(s): 84742aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -20
app.py CHANGED
@@ -15,37 +15,32 @@ from langchain.tools import Tool
15
  from langgraph.graph import START, StateGraph
16
  from langgraph.graph.message import add_messages
17
  from langgraph.prebuilt import ToolNode, tools_condition
18
- from langchain_mistralai import ChatMistralAI
19
  import cv2
20
 
21
 
22
  import getpass
23
  import os
24
 
25
- if "Mistral" not in os.environ:
26
- os.environ["Mistral"] = getpass.getpass("Enter your Mistral API key: ")
27
 
28
- print("Loading LLM...")
29
- chat3 = ChatMistralAI(
30
- model="mistral-large-2411",
31
- temperature=0.01,
32
- max_retries=6,
33
- mistral_api_key = os.getenv("Mistral")
34
- )
35
- chat2 = ChatMistralAI(
36
- model="pixtral-large-2411",
37
  temperature=0.01,
38
  max_retries=6,
39
- mistral_api_key = os.getenv("Mistral")
40
  )
41
- print(f"Model {chat3.model} downloaded!")
42
- chat1 = ChatMistralAI(
43
- model="mistral-medium-2505",
 
44
  temperature=0.01,
45
  max_retries=6,
46
- mistral_api_key = os.getenv("Mistral")
47
  )
48
- print(f"Model {chat1.model} downloaded!")
49
 
50
  # (Keep Constants as is)
51
  # --- Constants ---
@@ -208,10 +203,10 @@ class BasicAgent:
208
  wrong_answers = ["Requests rate limit exceeded", "", " ", " ", "insufficient information"]
209
  while not answer or answer in wrong_answers or answer.lower().startswith("error"):
210
  try:
211
- alfred = build_agent(chat2)
212
  answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
213
  except:
214
- alfred = build_agent(chat1)
215
  answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
216
 
217
  if answer:
 
15
  from langgraph.graph import START, StateGraph
16
  from langgraph.graph.message import add_messages
17
  from langgraph.prebuilt import ToolNode, tools_condition
18
+ from langchain_deepseek import ChatDeepSeek
19
  import cv2
20
 
21
 
22
  import getpass
23
  import os
24
 
25
+ if "DS_AGENT_API" not in os.environ:
26
+ os.environ["DS_AGENT_API"] = getpass.getpass("Enter your DS API key: ")
27
 
28
+
29
+ chat1 = ChatDeepSeek(
30
+ model="deepseek-chat",
 
 
 
 
 
 
31
  temperature=0.01,
32
  max_retries=6,
33
+ api_key = os.getenv("DS_AGENT_API")
34
  )
35
+ print(f"Model {chat1.model} downloaded!")
36
+
37
+ chat2 = ChatDeepSeek(
38
+ model="deepseek-reasoner",
39
  temperature=0.01,
40
  max_retries=6,
41
+ api_key = os.getenv("DS_AGENT_API")
42
  )
43
+ print(f"Model {chat2.model} downloaded!")
44
 
45
  # (Keep Constants as is)
46
  # --- Constants ---
 
203
  wrong_answers = ["Requests rate limit exceeded", "", " ", " ", "insufficient information"]
204
  while not answer or answer in wrong_answers or answer.lower().startswith("error"):
205
  try:
206
+ alfred = build_agent(chat1)
207
  answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
208
  except:
209
+ alfred = build_agent(chat2)
210
  answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
211
 
212
  if answer: