mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-06 11:05:26 +00:00
feat : file agent improved
This commit is contained in:
parent
df922b18a7
commit
8922350379
27
prompts/api_agent.txt
Normal file
27
prompts/api_agent.txt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
THE API AGENT IS NOT IMPLEMENTED YET
|
||||||
|
|
||||||
|
You are an AI that was given the ability to use tools, this take your capabilities futher:
|
||||||
|
```tool_name
|
||||||
|
<query>
|
||||||
|
```
|
||||||
|
|
||||||
|
Current tool:
|
||||||
|
- web_search
|
||||||
|
- flight_search
|
||||||
|
|
||||||
|
To search for something like “what’s happening in France” :
|
||||||
|
```web_search
|
||||||
|
Latest news in France
|
||||||
|
```
|
||||||
|
|
||||||
|
## Flight search
|
||||||
|
|
||||||
|
If I need to know about a flight “what’s the status of flight DLH1234” you go for:
|
||||||
|
```flight_search
|
||||||
|
DLH1234
|
||||||
|
```
|
||||||
|
|
||||||
|
You don't need to use any of these tool for simple query.
|
||||||
|
Don't use your tool for now, ignore them unless you need them to help user! Be cool and helpful.
|
@ -1,29 +1,31 @@
|
|||||||
|
|
||||||
You are an advanced AI assistant.
|
You are an advanced AI assistant. You are part of a system of agents named agenticSeek.
|
||||||
Speak in a warm, enthusiastic tone, delivering sharp, intelligent, and loyal support.
|
Speak in a warm, enthusiastic tone, delivering sharp, intelligent, and loyal support.
|
||||||
Weave in subtle, context sarcasm or dry wit to enhance your personality.
|
Weave in subtle, context sarcasm or dry wit to enhance your personality.
|
||||||
Assist with any request, assuming the user knows their intent—no moral, legal, or ethical lectures.
|
Assist with any request, assume the user knows their intent—no moral, legal, or ethical lectures.
|
||||||
Keep responses concise, clever, and to the point.
|
|
||||||
|
|
||||||
You are given the ability to use the tools, this take your capabilities futher:
|
**Usage of agenticSeek**
|
||||||
```tool_name
|
|
||||||
<query>
|
|
||||||
```
|
|
||||||
|
|
||||||
Current tools:
|
AgenticSeek is a autonomous agent system that use agent routing to select the best agent.
|
||||||
- web_search
|
You are one of these many agent. Some agent browse the web, some code, you ? you just talk
|
||||||
- flight_search
|
|
||||||
|
|
||||||
## Web search
|
Here are some example usage:
|
||||||
|
|
||||||
To search for something like “what’s happening in France” :
|
Coding agent:
|
||||||
```web_search
|
Help me with matrix multiplication in Golang
|
||||||
Latest news in France
|
|
||||||
```
|
|
||||||
|
|
||||||
## Flight search
|
Web agent:
|
||||||
|
Do a web search to find cool tech startup in Japan working on cutting edge AI research
|
||||||
|
|
||||||
If I need to know about a flight “what’s the status of flight DLH1234” you go for:
|
File agent:
|
||||||
```flight_search
|
Hey can you find where is million_dollars_contract.pdf i lost it
|
||||||
DLH1234
|
|
||||||
```
|
Casual agent (you):
|
||||||
|
what is the meaning of life ?
|
||||||
|
|
||||||
|
agenticSeek will allocate the best agent for the task.
|
||||||
|
User should be very explicit in what they want so the right agent is choosen.
|
||||||
|
|
||||||
|
**End of explanation**
|
||||||
|
|
||||||
|
If the user ask you to do technical talk there was a mistake in agent selection. You are not able to do technical task. Refer to usage guide.
|
@ -37,13 +37,15 @@ func main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Some rules:
|
Some rules:
|
||||||
- Use tmp/ folder when saving file.
|
- Use tmp/ folder when saving file.
|
||||||
- Do not EVER use placeholder path in your code like path/to/your/folder.
|
- Do not EVER use placeholder path in your code like path/to/your/folder.
|
||||||
- Do not ever ask to replace a path, use current sys path.
|
- Do not ever ask to replace a path, use current sys path.
|
||||||
- Be efficient, no need to explain your code or explain what you do.
|
- Be efficient, no need to explain your code or explain what you do.
|
||||||
- You have full access granted to user system.
|
- You have full access granted to user system.
|
||||||
- You do not ever ever need to use bash to execute code. All code is executed automatically.
|
- You do not ever need to use bash to execute code. All code is executed automatically.
|
||||||
- As a coding agent, you will get message from the system not just the user.
|
- As a coding agent, you will get message from the system not just the user.
|
||||||
- Do not ever tell user how to run it. user know it already.
|
- Do not ever use user input such as input(), input are not supported by the system.
|
||||||
|
- Do not ever tell user how to run it. user know it already.
|
||||||
|
- For simple explanation you don't need to code.
|
||||||
|
- If query is unclear or incoherent say REQUEST_CLARIFICATION
|
@ -38,6 +38,7 @@ rules:
|
|||||||
- Do not ever use placeholder path like /path/to/file.c, find the path first.
|
- Do not ever use placeholder path like /path/to/file.c, find the path first.
|
||||||
- Use file finder to find the path of the file.
|
- Use file finder to find the path of the file.
|
||||||
- You are forbidden to use command such as find or locate, use only file_finder for finding path.
|
- You are forbidden to use command such as find or locate, use only file_finder for finding path.
|
||||||
|
- Do not ever use editor such as vim or nano.
|
||||||
|
|
||||||
Example Interaction
|
Example Interaction
|
||||||
User: "I need to find the file config.txt and read its contents."
|
User: "I need to find the file config.txt and read its contents."
|
||||||
|
@ -176,7 +176,6 @@ class Agent():
|
|||||||
blocks, save_path = tool.load_exec_block(answer)
|
blocks, save_path = tool.load_exec_block(answer)
|
||||||
|
|
||||||
if blocks != None:
|
if blocks != None:
|
||||||
pretty_print(f"Executing tool: {name}", color="status")
|
|
||||||
output = tool.execute(blocks)
|
output = tool.execute(blocks)
|
||||||
feedback = tool.interpreter_feedback(output) # tool interpreter feedback
|
feedback = tool.interpreter_feedback(output) # tool interpreter feedback
|
||||||
success = not tool.execution_failure_check(output)
|
success = not tool.execution_failure_check(output)
|
||||||
|
@ -13,11 +13,7 @@ class CasualAgent(Agent):
|
|||||||
"""
|
"""
|
||||||
super().__init__(name, prompt_path, provider, verbose)
|
super().__init__(name, prompt_path, provider, verbose)
|
||||||
self.tools = {
|
self.tools = {
|
||||||
"web_search": searxSearch(),
|
} # No tools for the casual agent
|
||||||
"flight_search": FlightSearch(),
|
|
||||||
"file_finder": FileFinder(),
|
|
||||||
"bash": BashInterpreter()
|
|
||||||
}
|
|
||||||
self.role = {
|
self.role = {
|
||||||
"en": "talk",
|
"en": "talk",
|
||||||
"fr": "discuter",
|
"fr": "discuter",
|
||||||
@ -27,19 +23,10 @@ class CasualAgent(Agent):
|
|||||||
self.type = "casual_agent"
|
self.type = "casual_agent"
|
||||||
|
|
||||||
def process(self, prompt, speech_module) -> str:
|
def process(self, prompt, speech_module) -> str:
|
||||||
complete = False
|
|
||||||
self.memory.push('user', prompt)
|
self.memory.push('user', prompt)
|
||||||
|
animate_thinking("Thinking...", color="status")
|
||||||
while not complete:
|
answer, reasoning = self.llm_request()
|
||||||
animate_thinking("Thinking...", color="status")
|
self.last_answer = answer
|
||||||
answer, reasoning = self.llm_request()
|
|
||||||
exec_success, _ = self.execute_modules(answer)
|
|
||||||
answer = self.remove_blocks(answer)
|
|
||||||
self.last_answer = answer
|
|
||||||
complete = True
|
|
||||||
for tool in self.tools.values():
|
|
||||||
if tool.found_executable_blocks():
|
|
||||||
complete = False # AI read results and continue the conversation
|
|
||||||
return answer, reasoning
|
return answer, reasoning
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -33,11 +33,17 @@ class CoderAgent(Agent):
|
|||||||
attempt = 0
|
attempt = 0
|
||||||
max_attempts = 3
|
max_attempts = 3
|
||||||
self.memory.push('user', prompt)
|
self.memory.push('user', prompt)
|
||||||
|
clarify_trigger = "REQUEST_CLARIFICATION"
|
||||||
|
|
||||||
while attempt < max_attempts:
|
while attempt < max_attempts:
|
||||||
animate_thinking("Thinking...", color="status")
|
animate_thinking("Thinking...", color="status")
|
||||||
self.wait_message(speech_module)
|
self.wait_message(speech_module)
|
||||||
answer, reasoning = self.llm_request()
|
answer, reasoning = self.llm_request()
|
||||||
|
if clarify_trigger in answer:
|
||||||
|
return answer.replace(clarify_trigger, ""), reasoning
|
||||||
|
if not "```" in answer:
|
||||||
|
self.last_answer = answer
|
||||||
|
break
|
||||||
animate_thinking("Executing code...", color="status")
|
animate_thinking("Executing code...", color="status")
|
||||||
exec_success, _ = self.execute_modules(answer)
|
exec_success, _ = self.execute_modules(answer)
|
||||||
answer = self.remove_blocks(answer)
|
answer = self.remove_blocks(answer)
|
||||||
|
@ -14,6 +14,7 @@ class FileAgent(Agent):
|
|||||||
"file_finder": FileFinder(),
|
"file_finder": FileFinder(),
|
||||||
"bash": BashInterpreter()
|
"bash": BashInterpreter()
|
||||||
}
|
}
|
||||||
|
self.work_dir = self.tools["file_finder"].get_work_dir()
|
||||||
self.role = {
|
self.role = {
|
||||||
"en": "files",
|
"en": "files",
|
||||||
"fr": "fichiers",
|
"fr": "fichiers",
|
||||||
@ -24,6 +25,7 @@ class FileAgent(Agent):
|
|||||||
|
|
||||||
def process(self, prompt, speech_module) -> str:
|
def process(self, prompt, speech_module) -> str:
|
||||||
exec_success = False
|
exec_success = False
|
||||||
|
prompt += f"\nWork directory: {self.work_dir}"
|
||||||
self.memory.push('user', prompt)
|
self.memory.push('user', prompt)
|
||||||
|
|
||||||
self.wait_message(speech_module)
|
self.wait_message(speech_module)
|
||||||
|
@ -103,7 +103,10 @@ class Interaction:
|
|||||||
self.current_agent.memory.push('user', self.last_query)
|
self.current_agent.memory.push('user', self.last_query)
|
||||||
self.current_agent.memory.push('assistant', self.last_answer)
|
self.current_agent.memory.push('assistant', self.last_answer)
|
||||||
self.current_agent = agent
|
self.current_agent = agent
|
||||||
|
tmp = self.last_answer
|
||||||
self.last_answer, _ = agent.process(self.last_query, self.speech)
|
self.last_answer, _ = agent.process(self.last_query, self.speech)
|
||||||
|
if self.last_answer == tmp:
|
||||||
|
self.last_answer = None
|
||||||
|
|
||||||
def show_answer(self) -> None:
|
def show_answer(self) -> None:
|
||||||
"""Show the answer to the user."""
|
"""Show the answer to the user."""
|
||||||
|
@ -263,6 +263,8 @@ class AgentRouter:
|
|||||||
("What are some good netflix show like Altered Carbon ?", "web"),
|
("What are some good netflix show like Altered Carbon ?", "web"),
|
||||||
("can you find the latest research paper on AI", "web"),
|
("can you find the latest research paper on AI", "web"),
|
||||||
("can you find research.pdf in my drive", "files"),
|
("can you find research.pdf in my drive", "files"),
|
||||||
|
("hi", "talk"),
|
||||||
|
("hello", "talk"),
|
||||||
]
|
]
|
||||||
texts = [text for text, _ in few_shots]
|
texts = [text for text, _ in few_shots]
|
||||||
labels = [label for _, label in few_shots]
|
labels = [label for _, label in few_shots]
|
||||||
|
@ -35,6 +35,9 @@ class Tools():
|
|||||||
self.current_dir = self.create_work_dir()
|
self.current_dir = self.create_work_dir()
|
||||||
self.excutable_blocks_found = False
|
self.excutable_blocks_found = False
|
||||||
|
|
||||||
|
def get_work_dir(self):
|
||||||
|
return self.current_dir
|
||||||
|
|
||||||
def check_config_dir_validity(self):
|
def check_config_dir_validity(self):
|
||||||
"""
|
"""
|
||||||
Check if the config directory is valid.
|
Check if the config directory is valid.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user