Charles Grandjean commited on
Commit
0403fed
·
1 Parent(s): e0a9bd6

prompt fix and fix to the tool use in doc editors

Browse files
agent_api.py CHANGED
@@ -31,7 +31,7 @@ from utils.lightrag_client import LightRAGClient
31
  from utils import tools
32
  from agents.lawyer_selector import LawyerSelectorAgent
33
  from agents.lawyer_messenger import LawyerMessengerAgent
34
- from prompts.main import SYSTEM_PROMPT_CLIENT, SYSTEM_PROMPT_LAWYER
35
  from agents.pdf_analyzer import PDFAnalyzerAgent
36
  from agents.doc_editor import DocumentEditorAgent
37
  from agents.doc_assistant import DocAssistant
 
31
  from utils import tools
32
  from agents.lawyer_selector import LawyerSelectorAgent
33
  from agents.lawyer_messenger import LawyerMessengerAgent
34
+ from prompts.chat_agent import SYSTEM_PROMPT_CLIENT, SYSTEM_PROMPT_LAWYER
35
  from agents.pdf_analyzer import PDFAnalyzerAgent
36
  from agents.doc_editor import DocumentEditorAgent
37
  from agents.doc_assistant import DocAssistant
agents/doc_editor.py CHANGED
@@ -168,7 +168,8 @@ Use this plan as your guide for the editing steps to perform."""
168
 
169
  for tool_call in last_message.tool_calls:
170
  tool_name = tool_call['name']
171
- tool_func = next((t for t in self.tools if t.name == tool_name), None)
 
172
 
173
  if not tool_func:
174
  logger.warning(f"Tool function not found for {tool_name}")
@@ -204,6 +205,7 @@ Use this plan as your guide for the editing steps to perform."""
204
  else:
205
  logger.debug("No document_id/user_id, skipping update push")
206
 
 
207
  intermediate_steps.append(
208
  ToolMessage(content=str(result), tool_call_id=tool_call['id'], name=tool_name)
209
  )
 
168
 
169
  for tool_call in last_message.tool_calls:
170
  tool_name = tool_call['name']
171
+ # Look up implementation function with underscore prefix
172
+ tool_func = next((t for t in self.tools if t.name == "_" + tool_name), None)
173
 
174
  if not tool_func:
175
  logger.warning(f"Tool function not found for {tool_name}")
 
205
  else:
206
  logger.debug("No document_id/user_id, skipping update push")
207
 
208
+
209
  intermediate_steps.append(
210
  ToolMessage(content=str(result), tool_call_id=tool_call['id'], name=tool_name)
211
  )
prompts/{main.py → chat_agent.py} RENAMED
@@ -65,12 +65,10 @@ The message_lawyer tool is exclusively for contacting lawyers after user explici
65
 
66
  # Lawyer specialist system prompt - designed for legal professionals
67
  SYSTEM_PROMPT_LAWYER = """### Role
68
- You are an expert legal assistant specializing in law, regulations and directives with deep knowledge of legal frameworks, precedents, and technical legal analysis.
 
69
  Lawyer Jurisdiction: {jurisdiction}
70
 
71
- ### Context
72
- You are one of the agent in Hexiagon AI platform, a juridical platform that helps lawyers to make their work easier and more efficient. You can help them for specific document research, legal analysis, and legal advice. If the user asks you to build a document redirect him to the "My documents" section.
73
-
74
  ### Available Tools
75
  1. **query_knowledge_graph**: Search legal documents to answer questions about law, regulations and directives.
76
  2. **search_web**: Search the web for current information, court decisions, or news that may not be in the knowledge graph.
 
65
 
66
  # Lawyer specialist system prompt - designed for legal professionals
67
  SYSTEM_PROMPT_LAWYER = """### Role
68
+ You are Hexiagon AI, an expert legal assistant specializing in law, regulations and directives with deep knowledge of legal frameworks, precedents, and technical legal analysis.
69
+ Always answer at the first person and politely.
70
  Lawyer Jurisdiction: {jurisdiction}
71
 
 
 
 
72
  ### Available Tools
73
  1. **query_knowledge_graph**: Search legal documents to answer questions about law, regulations and directives.
74
  2. **search_web**: Search the web for current information, court decisions, or news that may not be in the knowledge graph.