Modification
Browse files- src/agent/agenttools.py +13 -1
- src/agent/custom_agent.py +2 -1
src/agent/agenttools.py
CHANGED
|
@@ -49,6 +49,17 @@ class ChatBotFunctionTools:
|
|
| 49 |
prompt = f"Explain the relationship between these concepts: {', '.join(concepts)}"
|
| 50 |
return self.generator.complete(prompt)
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
@retry(max_retries=5, delay=1)
|
| 53 |
def llm_query(self, concepts):
|
| 54 |
logging.info(f"Tool Call: llm_query('{concepts}')")
|
|
@@ -63,7 +74,8 @@ class ChatBotFunctionTools:
|
|
| 63 |
"algo_visualizer": FunctionTool.from_defaults(fn=self.visualize_algorithm),
|
| 64 |
"concept_combiner": FunctionTool.from_defaults(fn=self.concept_combiner),
|
| 65 |
"math_concept": FunctionTool.from_defaults(fn=self.math_concept),
|
| 66 |
-
"llm_query": FunctionTool.from_defaults(fn=self.llm_query)
|
|
|
|
| 67 |
}
|
| 68 |
|
| 69 |
|
|
|
|
| 49 |
prompt = f"Explain the relationship between these concepts: {', '.join(concepts)}"
|
| 50 |
return self.generator.complete(prompt)
|
| 51 |
|
| 52 |
+
@retry(max_retries=5, delay=1)
|
| 53 |
+
def code_generator(self, query):
|
| 54 |
+
logging.info(f"Tool Call: copilot('{query}')")
|
| 55 |
+
prompt = (
|
| 56 |
+
"You are a Python Expert.\n"
|
| 57 |
+
"Give the python source code as asked like copilot or help to debug a particular code block:\n"
|
| 58 |
+
f"{query}\n"
|
| 59 |
+
"Keep it compact and dont give much theory. Explain code blocks only."
|
| 60 |
+
)
|
| 61 |
+
return self.generator.complete(prompt)
|
| 62 |
+
|
| 63 |
@retry(max_retries=5, delay=1)
|
| 64 |
def llm_query(self, concepts):
|
| 65 |
logging.info(f"Tool Call: llm_query('{concepts}')")
|
|
|
|
| 74 |
"algo_visualizer": FunctionTool.from_defaults(fn=self.visualize_algorithm),
|
| 75 |
"concept_combiner": FunctionTool.from_defaults(fn=self.concept_combiner),
|
| 76 |
"math_concept": FunctionTool.from_defaults(fn=self.math_concept),
|
| 77 |
+
"llm_query": FunctionTool.from_defaults(fn=self.llm_query),
|
| 78 |
+
"code_generator": FunctionTool.from_defaults(fn=self.code_generator)
|
| 79 |
}
|
| 80 |
|
| 81 |
|
src/agent/custom_agent.py
CHANGED
|
@@ -36,7 +36,8 @@ class LearningAgent:
|
|
| 36 |
prompt = f"""Analyze this learning query and select appropriate tools also form the condensed query based on
|
| 37 |
previous_questions and Query:
|
| 38 |
For Choosing tool properly analyze the condensed query and then decide. Choose multiple if its necessary based on condensed query
|
| 39 |
-
Its mandatory to select to atleast 1 tool
|
|
|
|
| 40 |
Query: {query}
|
| 41 |
Previous Query: {previous_questions}
|
| 42 |
Available Tools: {list(self.tools.keys())}
|
|
|
|
| 36 |
prompt = f"""Analyze this learning query and select appropriate tools also form the condensed query based on
|
| 37 |
previous_questions and Query:
|
| 38 |
For Choosing tool properly analyze the condensed query and then decide. Choose multiple if its necessary based on condensed query
|
| 39 |
+
Its mandatory to select to atleast 1 tool.
|
| 40 |
+
If asked for any query related to code generation dont include theory rather give code and its explaination
|
| 41 |
Query: {query}
|
| 42 |
Previous Query: {previous_questions}
|
| 43 |
Available Tools: {list(self.tools.keys())}
|