naman1102 commited on
Commit
9d6ba16
·
1 Parent(s): 92c94e2
Files changed (2) hide show
  1. app.py +1 -1
  2. tools.py +4 -1
app.py CHANGED
@@ -115,7 +115,7 @@ def finalize_node(state: AgentState) -> AgentState:
115
  audio_transcript = state.get("audio_transcript") or state.get("transcript")
116
  if audio_transcript:
117
  combined += f"AUDIO_TRANSCRIPT: {audio_transcript}\n"
118
- combined += "Based on the above, provide ONLY the final answer. Do not include any explanation or extra text."
119
 
120
  llm_response = llm([SystemMessage(content=combined)])
121
  return {"final_answer": llm_response.content.strip()}
 
115
  audio_transcript = state.get("audio_transcript") or state.get("transcript")
116
  if audio_transcript:
117
  combined += f"AUDIO_TRANSCRIPT: {audio_transcript}\n"
118
+ combined += "Based on the above, provide ONLY the final answer. Do not include any explanation or extra text. the final answer should be in the same language as the user's question. should be as few words as possible. if its multiple words, put them comma sepreated. if its a number, then return the number ONLY as a string."
119
 
120
  llm_response = llm([SystemMessage(content=combined)])
121
  return {"final_answer": llm_response.content.strip()}
tools.py CHANGED
@@ -19,6 +19,7 @@ def web_search_tool(state: AgentState) -> AgentState:
19
  # Run DuckDuckGo
20
  ddg = DuckDuckGoSearchRun()
21
  result_text = ddg.run(query)
 
22
  return {
23
  "web_search_query": None,
24
  "web_search_result": result_text
@@ -38,6 +39,7 @@ def ocr_image_tool(state: AgentState) -> AgentState:
38
  text = text.strip() or "(no visible text)"
39
  except Exception as e:
40
  text = f"Error during OCR: {e}"
 
41
  return {
42
  "ocr_path": None,
43
  "ocr_result": text
@@ -64,6 +66,7 @@ def parse_excel_tool(state: AgentState) -> AgentState:
64
  text = str(records)
65
  except Exception as e:
66
  text = f"Error reading Excel: {e}"
 
67
  return {
68
  "excel_path": None,
69
  "excel_sheet_name": None,
@@ -121,7 +124,7 @@ def audio_transcriber_tool(state: AgentState) -> AgentState:
121
  text = response["text"].strip()
122
  except Exception as e:
123
  text = f"Error during transcription: {e}"
124
-
125
  return {
126
  "audio_path": None,
127
  "transcript": text
 
19
  # Run DuckDuckGo
20
  ddg = DuckDuckGoSearchRun()
21
  result_text = ddg.run(query)
22
+ print(f"web_search_result: {result_text}")
23
  return {
24
  "web_search_query": None,
25
  "web_search_result": result_text
 
39
  text = text.strip() or "(no visible text)"
40
  except Exception as e:
41
  text = f"Error during OCR: {e}"
42
+ print(f"ocr_result: {text}")
43
  return {
44
  "ocr_path": None,
45
  "ocr_result": text
 
66
  text = str(records)
67
  except Exception as e:
68
  text = f"Error reading Excel: {e}"
69
+ print(f"excel_result: {text}")
70
  return {
71
  "excel_path": None,
72
  "excel_sheet_name": None,
 
124
  text = response["text"].strip()
125
  except Exception as e:
126
  text = f"Error during transcription: {e}"
127
+ print(f"transcript: {text}")
128
  return {
129
  "audio_path": None,
130
  "transcript": text