rsobieski commited on
Commit
cab7c5d
·
verified ·
1 Parent(s): a72ec7c

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +10 -2
agent.py CHANGED
@@ -18,7 +18,7 @@ qa_dict = {
18
  def build_graph():
19
  llm = HuggingFaceEndpoint(
20
  repo_id="mistralai/Mistral-7B-Instruct-v0.3",
21
- task="text-generation",
22
  huggingfacehub_api_token=os.environ["HF_TOKEN"]
23
  )
24
 
@@ -44,7 +44,15 @@ def build_graph():
44
  )
45
 
46
  full_prompt = f"{prompt}\n\nQuestion: {query}\nAnswer:"
47
- response = llm.invoke(full_prompt).strip()
 
 
 
 
 
 
 
 
48
  print(f"🧠 LLM said: {response}")
49
 
50
  if response.startswith("use_tool:"):
 
18
  def build_graph():
19
  llm = HuggingFaceEndpoint(
20
  repo_id="mistralai/Mistral-7B-Instruct-v0.3",
21
+ # task="text-generation",
22
  huggingfacehub_api_token=os.environ["HF_TOKEN"]
23
  )
24
 
 
44
  )
45
 
46
  full_prompt = f"{prompt}\n\nQuestion: {query}\nAnswer:"
47
+
48
+
49
+ chat_input = [
50
+ {"role": "system", "content": prompt},
51
+ {"role": "user", "content": query}
52
+ ]
53
+ response = llm.invoke(chat_input).strip()
54
+
55
+ # response = llm.invoke(full_prompt).strip()
56
  print(f"🧠 LLM said: {response}")
57
 
58
  if response.startswith("use_tool:"):