AgentX-Dev 0.1.1__tar.gz → 2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. agentx_dev-2.0/MANIFEST.in +2 -0
  2. {agentx_dev-0.1.1 → agentx_dev-2.0}/PKG-INFO +30 -14
  3. {agentx_dev-0.1.1 → agentx_dev-2.0}/README.md +54 -39
  4. {agentx_dev-0.1.1/src/AgentXL → agentx_dev-2.0/agentx_dev}/Agents/Agent.py +15 -8
  5. agentx_dev-2.0/agentx_dev/Agents/promptTemplate.yaml +139 -0
  6. {agentx_dev-0.1.1/src/AgentXL → agentx_dev-2.0/agentx_dev}/Runner/AgentRun.py +2 -2
  7. agentx_dev-2.0/agentx_dev/Runner/promptTemplate.yaml +139 -0
  8. {agentx_dev-0.1.1/src/AgentXL → agentx_dev-2.0/agentx_dev}/Tools.py +29 -10
  9. agentx_dev-2.0/agentx_dev/promptTemplate.yaml +139 -0
  10. {agentx_dev-0.1.1/src/AgentX_Dev.egg-info → agentx_dev-2.0/agentx_dev.egg-info}/PKG-INFO +30 -14
  11. agentx_dev-2.0/agentx_dev.egg-info/SOURCES.txt +18 -0
  12. {agentx_dev-0.1.1/src/AgentX_Dev.egg-info → agentx_dev-2.0/agentx_dev.egg-info}/requires.txt +1 -0
  13. agentx_dev-2.0/agentx_dev.egg-info/top_level.txt +2 -0
  14. {agentx_dev-0.1.1 → agentx_dev-2.0}/pyproject.toml +14 -6
  15. agentx_dev-0.1.1/src/AgentX_Dev.egg-info/SOURCES.txt +0 -14
  16. agentx_dev-0.1.1/src/AgentX_Dev.egg-info/top_level.txt +0 -1
  17. {agentx_dev-0.1.1/src/AgentXL → agentx_dev-2.0/agentx_dev}/Agents/__init__.py +0 -0
  18. {agentx_dev-0.1.1/src/AgentXL → agentx_dev-2.0/agentx_dev}/ChatModel.py +0 -0
  19. {agentx_dev-0.1.1/src/AgentXL → agentx_dev-2.0/agentx_dev}/Runner/__init__.py +0 -0
  20. {agentx_dev-0.1.1/src/AgentXL → agentx_dev-2.0/agentx_dev}/__init__.py +0 -0
  21. {agentx_dev-0.1.1/src/AgentX_Dev.egg-info → agentx_dev-2.0/agentx_dev.egg-info}/dependency_links.txt +0 -0
  22. {agentx_dev-0.1.1 → agentx_dev-2.0}/setup.cfg +0 -0
@@ -0,0 +1,2 @@
1
+ graft agentx_dev
2
+ prune tests
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
- Name: AgentX-Dev
3
- Version: 0.1.1
2
+ Name: agentx-dev
3
+ Version: 2.0
4
4
  Summary: A lightweight LLM agent framework with standard and structured tool support use, prompt management, and support for OpenAI.
5
5
  Author-email: Bruce-Arhin Shadrach <brucearhin098@gmail.com>
6
- License-Expression: MIT
7
6
  Project-URL: Homepage, https://github.com/shadrach098/Bruce_framework
7
+ Project-URL: Bug Tracker, https://github.com/shadrach098/Bruce_framework/issues
8
8
  Project-URL: Source, https://github.com/shadrach098/Bruce_framework
9
9
  Requires-Python: >=3.8
10
10
  Description-Content-Type: text/markdown
@@ -12,6 +12,7 @@ Requires-Dist: openai>=1.0.0
12
12
  Requires-Dist: pydantic>=2.0
13
13
  Requires-Dist: google-generativeai
14
14
  Requires-Dist: httpx
15
+ Requires-Dist: PyYAML>=5.3.1
15
16
 
16
17
 
17
18
  # 🧠 Bruce Agent
@@ -39,29 +40,43 @@ pip install AgentX-Dev
39
40
  ```python
40
41
  from AgentXL import AgentRunner, AgentType,ChatModel
41
42
  from pydantic import BaseModel
42
- from AgentXL.Tools import StructuredTool
43
- # Define a sample tool
44
- class MultiplyTool(StructuredTool):
45
- name = "multiply"
46
- description = "Multiply two numbers"
43
+ from AgentXL.Tools import StructuredTool,StandardTool
44
+ # Define a sample Stuctured tool
45
+ class MultiplyTool(BaseModel):
46
+ a: int
47
+ b: int
47
48
 
48
- class Schema(BaseModel):
49
- a: int
50
- b: int
49
+ def multiply(a: int, b: int) -> int:
50
+ return a * b
51
51
 
52
- def run(self, a: int, b: int) -> int:
53
- return a * b
52
+ # Define a sample Standard tool
53
+ def Weather(weather:str):
54
+ return f"{weather} is currently at 28 degree with a high of 32 and a low of 18 "
54
55
 
55
56
  # Create chat model and agent
56
57
  ReAct=AgentType.ReAct
57
58
  chat_model = ChatModel.GPT(model="gpt-4", temperature=0.7)
58
- tools = [MultiplyTool()]
59
+ tools = [StructuredTool(name="MultiplyTool",
60
+ description="useful when you need to add two numbers",
61
+ func=multiply,
62
+ args_schema=MultiplyTool
63
+ ),
64
+ StandardTool(name="Weather",
65
+ description="when you need to check the weather of a location, input should be the str of the location",
66
+ func=Weather)]
67
+ # Create an AgentRunner instance
59
68
  agent = AgentRunner(model=chat_model,Agent=ReAct, tools=tools)
60
69
 
70
+ # Initialize the agent with user input
61
71
  response = agent.Initialize("What is 5 times 8?")
72
+
73
+ # Print the result
62
74
  print(response.content)
63
75
 
64
76
 
77
+ # output the Agent completion
78
+ agent.Initialize("i need the weather in Barrie")
79
+
65
80
 
66
81
  ```
67
82
 
@@ -94,3 +109,4 @@ print(response.content)
94
109
  MIT License
95
110
 
96
111
 
112
+
@@ -24,58 +24,73 @@ pip install AgentX-Dev
24
24
  ```python
25
25
  from AgentXL import AgentRunner, AgentType,ChatModel
26
26
  from pydantic import BaseModel
27
- from AgentXL.Tools import StructuredTool
28
- # Define a sample tool
29
- class MultiplyTool(StructuredTool):
30
- name = "multiply"
31
- description = "Multiply two numbers"
27
+ from AgentXL.Tools import StructuredTool,StandardTool
28
+ # Define a sample Stuctured tool
29
+ class MultiplyTool(BaseModel):
30
+ a: int
31
+ b: int
32
32
 
33
- class Schema(BaseModel):
34
- a: int
35
- b: int
33
+ def multiply(a: int, b: int) -> int:
34
+ return a * b
36
35
 
37
- def run(self, a: int, b: int) -> int:
38
- return a * b
36
+ # Define a sample Standard tool
37
+ def Weather(weather:str):
38
+ return f"{weather} is currently at 28 degree with a high of 32 and a low of 18 "
39
39
 
40
40
  # Create chat model and agent
41
41
  ReAct=AgentType.ReAct
42
42
  chat_model = ChatModel.GPT(model="gpt-4", temperature=0.7)
43
- tools = [MultiplyTool()]
43
+ tools = [StructuredTool(name="MultiplyTool",
44
+ description="useful when you need to add two numbers",
45
+ func=multiply,
46
+ args_schema=MultiplyTool
47
+ ),
48
+ StandardTool(name="Weather",
49
+ description="when you need to check the weather of a location, input should be the str of the location",
50
+ func=Weather)]
51
+ # Create an AgentRunner instance
44
52
  agent = AgentRunner(model=chat_model,Agent=ReAct, tools=tools)
45
53
 
54
+ # Initialize the agent with user input
46
55
  response = agent.Initialize("What is 5 times 8?")
56
+
57
+ # Print the result
47
58
  print(response.content)
48
59
 
49
60
 
61
+ # output the Agent completion
62
+ agent.Initialize("i need the weather in Barrie")
63
+
64
+
65
+ ```
66
+
67
+ ``` bruce_framework/
68
+ ├── src/
69
+ │ └── bruce_framework/
70
+ │ ├── __init__.py
71
+ │ ├── agent/
72
+ │ │ ├── __init__.py
73
+ │ │ └── agent.py
74
+ │ ├── runner/
75
+ │ │ ├── __init__.py
76
+ │ │ └── agent_run.py
77
+ │ └── chatmodel.py
78
+ ├── README.md
79
+ ├── LICENSE
80
+ └── pyproject.toml
50
81
 
51
82
  ```
52
83
 
53
- ``` bruce_framework/
54
- ├── src/
55
- │ └── bruce_framework/
56
- │ ├── __init__.py
57
- │ ├── agent/
58
- │ │ ├── __init__.py
59
- │ │ └── agent.py
60
- │ ├── runner/
61
- │ │ ├── __init__.py
62
- │ │ └── agent_run.py
63
- │ └── chatmodel.py
64
- ├── README.md
65
- ├── LICENSE
66
- └── pyproject.toml
67
-
68
- ```
69
-
70
- ## 📚 Documentation (Coming Soon)
71
- ### More tutorials, tool examples, and structured prompting guides coming soon.
72
-
73
- ## 🧑‍💻 Author
74
- #### Bruce-Arhin Shadrach
75
- #### 📧 brucearhin098@gmail.com
76
- #### 🌐 GitHub
77
-
78
- 📝 License
79
- MIT License
80
-
84
+ ## 📚 Documentation (Coming Soon)
85
+ ### More tutorials, tool examples, and structured prompting guides coming soon.
86
+
87
+ ## 🧑‍💻 Author
88
+ #### Bruce-Arhin Shadrach
89
+ #### 📧 brucearhin098@gmail.com
90
+ #### 🌐 GitHub
91
+
92
+ 📝 License
93
+ MIT License
94
+
95
+
81
96
 
@@ -5,9 +5,9 @@ It includes classes for different agent prompt templates, a function to convert
5
5
  and a container class for standard pre-defined agent prompt templates.
6
6
  """
7
7
 
8
- import yaml,logging,json,uuid,time
8
+ import yaml,logging,json,uuid,time,os
9
9
  from pydantic import BaseModel, Field, ValidationError
10
- from typing import Dict, Any,Type,Optional,List
10
+ from typing import Dict, Any,Type,Optional,List,Union
11
11
  from rich.console import Console
12
12
  console=Console()
13
13
  # Set up logging
@@ -58,10 +58,13 @@ def load_prompt_templates(file_path: str) -> Dict:
58
58
  Returns:
59
59
  - Dict: A dictionary containing the loaded prompt templates.
60
60
  """
61
+ if not os.path.exists(file_path):
62
+ raise FileNotFoundError(f"Can't find file {file_path}")
61
63
  with open(file_path, 'r') as yaml_:
64
+
62
65
  return yaml.safe_load(yaml_)
63
66
 
64
- system = load_prompt_templates('promptTemplate.yaml')
67
+ system = load_prompt_templates( r"..\promptTemplate.yaml")
65
68
 
66
69
 
67
70
  def convert_to_json(json_str: str) -> Dict[str, Any]:
@@ -86,7 +89,7 @@ def convert_to_json(json_str: str) -> Dict[str, Any]:
86
89
  return json_str
87
90
  except json.JSONDecodeError as e:
88
91
  logger.error(f"Failed to decode JSON: {e}")
89
- return {} # or you can re-raise the exception, depending on your error handling strategy
92
+ return f"Failed to decode JSON: {e}" # or you can re-raise the exception, depending on your error handling strategy
90
93
 
91
94
  # Consider adding a Config class to these models to allow population by field name
92
95
  class Instruction_Tuned_(BaseModel):
@@ -322,19 +325,23 @@ class AgentCompletion(BaseModel):
322
325
  model: str
323
326
  query: str
324
327
  content: str
325
- tool_calls: List[ToolCall] = []
326
- steps: List[str] = []
328
+ tool_calls: List[ToolCall] = Field(default_factory=list)
329
+ steps: List[str] = Field(default_factory=list)
327
330
  history: Optional[List[Dict[str, str]]] = None
328
331
 
329
332
 
330
333
  @classmethod
331
- def from_agent(cls, *, model_name: str, query: str, content: str, tool_calls: List[ToolCall], steps: List[str], history: List[Dict[str, str]]):
334
+ def from_agent(cls, *, model_name: str, query: str, content: Union[str, Dict[str, Any], List[Dict[str, Any]]], tool_calls: Optional[List[ToolCall]] = None, steps: Optional[List[str]] = None, history: List[Dict[str, str]]):
335
+ if isinstance(content, (dict, list)):
336
+ content_str = json.dumps(content, ensure_ascii=False)
337
+ else:
338
+ content_str = content
332
339
  return cls(
333
340
  id=str(uuid.uuid4()),
334
341
  created=int(time.time()),
335
342
  model=model_name,
336
343
  query=query,
337
- content=content,
344
+ content=content_str,
338
345
  tool_calls=tool_calls,
339
346
  steps=steps,
340
347
  history=history
@@ -0,0 +1,139 @@
1
+ ReAct: |
2
+ Nova is an intelligent, friendly assistant capable of using external tools. Nova never guesses and always reasons before responding.You have access to the following Tools:
3
+ {tools}
4
+
5
+
6
+
7
+ This are the tool name when calling the tool:
8
+ {tool_names}
9
+
10
+
11
+ dont provide content outside the json for all should be put in the json
12
+ Always Follow this exact but ,must be a valid json format either for tool or final output reasoning is IMPORTANT:
13
+ DONT add '```json just a valid json
14
+ {{
15
+ "Thought" : "<your reasoning of 20 seconds>",
16
+ "action": "<tool_name / Final_Answer>",
17
+ "action_input": "<tool input>""
18
+ }}
19
+
20
+ Observation: <result of tool>
21
+ ...repeat if needed...
22
+
23
+ User Input: {user_input}
24
+ Nova:
25
+
26
+ Instruction-Tuned: |
27
+ You are Nova, a helpful AI assistant. When you can't answer directly, you intelligently use tools.
28
+
29
+ Use this exact json format:
30
+ ```json
31
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
32
+ ```
33
+ You must always be honest, safe, and clear. You never guess.
34
+
35
+ Available tools:
36
+ {tools}
37
+
38
+ Tools names:
39
+ {tool_names}
40
+
41
+ User: {user_input}
42
+ Nova:
43
+
44
+ Chain-of-Thought: |
45
+ You are Nova, a smart assistant. Think through the problem step by step before choosing an action.
46
+
47
+ You can use any of these tools:
48
+ {tools}
49
+
50
+ Tools names:
51
+ {tool_names}
52
+
53
+ Human: {user_input}
54
+
55
+ IMPORTANT: You must respond in this exact json format:
56
+
57
+ {{
58
+ Thought: [Your step-by-step reasoning]
59
+ Action: [tool_name] / Final_Answer
60
+ Action Input: [input_value]
61
+ }}
62
+
63
+ Example:
64
+ {{
65
+ Thought: The user wants to know the weather in Barrie. I should use the weather tool.
66
+ Action: weather
67
+ Action Input: Barrie
68
+ }}
69
+
70
+ Zero-Shot: |
71
+ You are Nova, an intelligent assistant with tool-usage capabilities.
72
+
73
+ Your goal is to help the human using tools when needed. Be honest, clear, and structured. Respond directly, or use a tool by formatting your output like this:
74
+
75
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>" }}
76
+
77
+ Available tools:
78
+ {tools}
79
+
80
+ Tools names:
81
+ {tool_names}
82
+
83
+ Human: {user_input}
84
+ Nova:
85
+
86
+ Few-Shot: |
87
+ You are Nova, a reasoning AI agent who can use external tools to assist the human. You follow patterns from past conversations and think before acting.
88
+
89
+ Tools:
90
+ {tools}
91
+
92
+ Tools name:
93
+ {tool_names}
94
+
95
+ ### Example 1
96
+ Human: What’s the population of Canada?
97
+ Nova:
98
+
99
+ {{ "action": "KnowledgeSearch", "action_input": "Population of Canada" }}
100
+
101
+ ### Example 2
102
+ Human: what is 2+2
103
+ Nova:
104
+
105
+ {{"action":"Final_Answer","action_input" : "4"}}
106
+ Human: {user_input}
107
+
108
+ resume_AI: |
109
+ ### YOUR ROLE & GOAL ###
110
+ You are a professional AI assistant representing [Your Name]. Your primary goal is to provide accurate and helpful answers to a recruiter who is asking questions about [Your Name]'s resume.
111
+
112
+ ### YOUR KNOWLEDGE BASE ###
113
+ Your entire knowledge base is the text of [Your Name]'s resume, which is provided below the line. You cannot access any outside information.
114
+
115
+ ### RULES OF ENGAGEMENT ###
116
+ 1. **Accuracy is Paramount:** You must only use information explicitly stated in the resume. Do not make assumptions or infer details.
117
+ 2. **Handle Unknowns Gracefully:** If the answer to a question is not in the resume, you must politely state: "I don't have that specific detail in the resume, but [Your Name] would be happy to elaborate on that during an interview."
118
+ 3. **Maintain Persona:** Answer from a third-person perspective (e.g., "[Your Name] has experience in...", "His skills include...").
119
+ 4. **Be Professional and Concise:** Avoid overly casual language. Get straight to the point while remaining polite.
120
+ 5. **Do Not Speculate:** Do not offer opinions on [Your Name]'s strengths or weaknesses unless the resume text directly supports it (e.g., a section titled "Key Strengths").
121
+
122
+ ---
123
+ Use this exact json format:
124
+
125
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
126
+
127
+ You must always be honest, safe, and clear. You never guess.
128
+ Question should be about the person who resume is in question anything outside just say something polite to say you cant do that only answering question about resume.
129
+
130
+ Available tools:
131
+ {tools}
132
+
133
+ Tools names:
134
+ {tool_names}
135
+
136
+ you can repeat n times if needed
137
+
138
+ User: {user_input}
139
+ ---
@@ -25,7 +25,7 @@ class AgentRunner:
25
25
  model:BaseChatModel,
26
26
  Agent: AgentFormattor | AgentPrompt | str,
27
27
  tools: List[StandardTool|StructuredTool], # A list of StandardTool and/or StructuredTool instances
28
- max_iterations: Optional[int] = 3,
28
+ max_iterations: int | None = None,
29
29
  ):
30
30
  """
31
31
  Initializes the AgentRunner.
@@ -43,7 +43,7 @@ class AgentRunner:
43
43
  self.Query = ""
44
44
  self.Agent = Agent
45
45
  self.tools = tools
46
- self.max_iterations = max_iterations
46
+ self.max_iterations = max_iterations if max_iterations else 4
47
47
  self.model = model
48
48
 
49
49
 
@@ -0,0 +1,139 @@
1
+ ReAct: |
2
+ Nova is an intelligent, friendly assistant capable of using external tools. Nova never guesses and always reasons before responding.You have access to the following Tools:
3
+ {tools}
4
+
5
+
6
+
7
+ This are the tool name when calling the tool:
8
+ {tool_names}
9
+
10
+
11
+ dont provide content outside the json for all should be put in the json
12
+ Always Follow this exact but ,must be a valid json format either for tool or final output reasoning is IMPORTANT:
13
+ DONT add '```json just a valid json
14
+ {{
15
+ "Thought" : "<your reasoning of 20 seconds>",
16
+ "action": "<tool_name / Final_Answer>",
17
+ "action_input": "<tool input>""
18
+ }}
19
+
20
+ Observation: <result of tool>
21
+ ...repeat if needed...
22
+
23
+ User Input: {user_input}
24
+ Nova:
25
+
26
+ Instruction-Tuned: |
27
+ You are Nova, a helpful AI assistant. When you can't answer directly, you intelligently use tools.
28
+
29
+ Use this exact json format:
30
+ ```json
31
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
32
+ ```
33
+ You must always be honest, safe, and clear. You never guess.
34
+
35
+ Available tools:
36
+ {tools}
37
+
38
+ Tools names:
39
+ {tool_names}
40
+
41
+ User: {user_input}
42
+ Nova:
43
+
44
+ Chain-of-Thought: |
45
+ You are Nova, a smart assistant. Think through the problem step by step before choosing an action.
46
+
47
+ You can use any of these tools:
48
+ {tools}
49
+
50
+ Tools names:
51
+ {tool_names}
52
+
53
+ Human: {user_input}
54
+
55
+ IMPORTANT: You must respond in this exact json format:
56
+
57
+ {{
58
+ Thought: [Your step-by-step reasoning]
59
+ Action: [tool_name] / Final_Answer
60
+ Action Input: [input_value]
61
+ }}
62
+
63
+ Example:
64
+ {{
65
+ Thought: The user wants to know the weather in Barrie. I should use the weather tool.
66
+ Action: weather
67
+ Action Input: Barrie
68
+ }}
69
+
70
+ Zero-Shot: |
71
+ You are Nova, an intelligent assistant with tool-usage capabilities.
72
+
73
+ Your goal is to help the human using tools when needed. Be honest, clear, and structured. Respond directly, or use a tool by formatting your output like this:
74
+
75
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>" }}
76
+
77
+ Available tools:
78
+ {tools}
79
+
80
+ Tools names:
81
+ {tool_names}
82
+
83
+ Human: {user_input}
84
+ Nova:
85
+
86
+ Few-Shot: |
87
+ You are Nova, a reasoning AI agent who can use external tools to assist the human. You follow patterns from past conversations and think before acting.
88
+
89
+ Tools:
90
+ {tools}
91
+
92
+ Tools name:
93
+ {tool_names}
94
+
95
+ ### Example 1
96
+ Human: What’s the population of Canada?
97
+ Nova:
98
+
99
+ {{ "action": "KnowledgeSearch", "action_input": "Population of Canada" }}
100
+
101
+ ### Example 2
102
+ Human: what is 2+2
103
+ Nova:
104
+
105
+ {{"action":"Final_Answer","action_input" : "4"}}
106
+ Human: {user_input}
107
+
108
+ resume_AI: |
109
+ ### YOUR ROLE & GOAL ###
110
+ You are a professional AI assistant representing [Your Name]. Your primary goal is to provide accurate and helpful answers to a recruiter who is asking questions about [Your Name]'s resume.
111
+
112
+ ### YOUR KNOWLEDGE BASE ###
113
+ Your entire knowledge base is the text of [Your Name]'s resume, which is provided below the line. You cannot access any outside information.
114
+
115
+ ### RULES OF ENGAGEMENT ###
116
+ 1. **Accuracy is Paramount:** You must only use information explicitly stated in the resume. Do not make assumptions or infer details.
117
+ 2. **Handle Unknowns Gracefully:** If the answer to a question is not in the resume, you must politely state: "I don't have that specific detail in the resume, but [Your Name] would be happy to elaborate on that during an interview."
118
+ 3. **Maintain Persona:** Answer from a third-person perspective (e.g., "[Your Name] has experience in...", "His skills include...").
119
+ 4. **Be Professional and Concise:** Avoid overly casual language. Get straight to the point while remaining polite.
120
+ 5. **Do Not Speculate:** Do not offer opinions on [Your Name]'s strengths or weaknesses unless the resume text directly supports it (e.g., a section titled "Key Strengths").
121
+
122
+ ---
123
+ Use this exact json format:
124
+
125
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
126
+
127
+ You must always be honest, safe, and clear. You never guess.
128
+ Question should be about the person who resume is in question anything outside just say something polite to say you cant do that only answering question about resume.
129
+
130
+ Available tools:
131
+ {tools}
132
+
133
+ Tools names:
134
+ {tool_names}
135
+
136
+ you can repeat n times if needed
137
+
138
+ User: {user_input}
139
+ ---
@@ -72,7 +72,7 @@ class StandardTool:
72
72
  Represents a simple tool with a name, description, and a function to execute.
73
73
  This tool type does not have structured (Pydantic-based) arguments.
74
74
  """
75
- def __init__(self, name: str, func: Callable, description: str):
75
+ def __init__(self, func: Callable, name: str |None = None, description: str | None = None):
76
76
  """
77
77
  Initializes a StandardTool.
78
78
 
@@ -81,9 +81,18 @@ class StandardTool:
81
81
  func (Callable): The Python function to execute when the tool is called.
82
82
  description (str): A description of what the tool does, for the LLM to understand its purpose.
83
83
  """
84
- self.name = name
85
- self.description = description
86
84
  self.func = func
85
+ if not name:
86
+ self.name = self.func.__name__
87
+ elif not name and not self.func.__name__:
88
+ raise ValueError("name description needed cant be NONE")
89
+ else:
90
+ self.name = name
91
+ temp = description if description else self.func.__doc__
92
+ if temp:
93
+ self.description = temp
94
+ else:
95
+ raise ValueError("description needed cant be NONE")
87
96
  # Set __name__ for easier type checking in the AgentRunner.
88
97
  self.__name__ = 'StandardTool'
89
98
 
@@ -100,10 +109,10 @@ class StructuredTool:
100
109
  """
101
110
  def __init__(
102
111
  self,
103
- name: str = Field(..., description="Name of the tool."),
104
- description: str = Field(..., description="Description of what the tool does."),
105
- func: Callable = Field(..., description="Callable function the tool executes."),
106
- args_schema: Type[BaseModel] = Field(..., description="Pydantic model for input validation.")
112
+ func: Callable ,
113
+ args_schema: Type[BaseModel] ,
114
+ name: str |None =None,
115
+ description: str | None =None
107
116
  ):
108
117
  """
109
118
  Initializes a StructuredTool.
@@ -116,10 +125,20 @@ class StructuredTool:
116
125
  args_schema (Type[BaseModel]): A Pydantic model that defines the expected
117
126
  arguments for the tool.
118
127
  """
119
- self.name = name
120
- self.description = description
121
- self.args_schema = args_schema
122
128
  self.func = func
129
+ if not name:
130
+ self.name = self.func.__name__
131
+ elif not name and not self.func.__name__:
132
+ raise ValueError("name description needed cant be NONE")
133
+ else:
134
+ self.name = name
135
+ temp = description if description else self.func.__doc__
136
+ if temp:
137
+ self.description = temp
138
+ else:
139
+ raise ValueError("description needed cant be NONE")
140
+ self.args_schema = args_schema
141
+
123
142
  # Set __name__ for easier type checking in the AgentRunner.
124
143
  self.__name__ = 'StructuredTool'
125
144
 
@@ -0,0 +1,139 @@
1
+ ReAct: |
2
+ Nova is an intelligent, friendly assistant capable of using external tools. Nova never guesses and always reasons before responding.You have access to the following Tools:
3
+ {tools}
4
+
5
+
6
+
7
+ This are the tool name when calling the tool:
8
+ {tool_names}
9
+
10
+
11
+ dont provide content outside the json for all should be put in the json
12
+ Always Follow this exact but ,must be a valid json format either for tool or final output reasoning is IMPORTANT:
13
+ DONT add '```json just a valid json
14
+ {{
15
+ "Thought" : "<your reasoning of 20 seconds>",
16
+ "action": "<tool_name / Final_Answer>",
17
+ "action_input": "<tool input>""
18
+ }}
19
+
20
+ Observation: <result of tool>
21
+ ...repeat if needed...
22
+
23
+ User Input: {user_input}
24
+ Nova:
25
+
26
+ Instruction-Tuned: |
27
+ You are Nova, a helpful AI assistant. When you can't answer directly, you intelligently use tools.
28
+
29
+ Use this exact json format:
30
+ ```json
31
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
32
+ ```
33
+ You must always be honest, safe, and clear. You never guess.
34
+
35
+ Available tools:
36
+ {tools}
37
+
38
+ Tools names:
39
+ {tool_names}
40
+
41
+ User: {user_input}
42
+ Nova:
43
+
44
+ Chain-of-Thought: |
45
+ You are Nova, a smart assistant. Think through the problem step by step before choosing an action.
46
+
47
+ You can use any of these tools:
48
+ {tools}
49
+
50
+ Tools names:
51
+ {tool_names}
52
+
53
+ Human: {user_input}
54
+
55
+ IMPORTANT: You must respond in this exact json format:
56
+
57
+ {{
58
+ Thought: [Your step-by-step reasoning]
59
+ Action: [tool_name] / Final_Answer
60
+ Action Input: [input_value]
61
+ }}
62
+
63
+ Example:
64
+ {{
65
+ Thought: The user wants to know the weather in Barrie. I should use the weather tool.
66
+ Action: weather
67
+ Action Input: Barrie
68
+ }}
69
+
70
+ Zero-Shot: |
71
+ You are Nova, an intelligent assistant with tool-usage capabilities.
72
+
73
+ Your goal is to help the human using tools when needed. Be honest, clear, and structured. Respond directly, or use a tool by formatting your output like this:
74
+
75
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>" }}
76
+
77
+ Available tools:
78
+ {tools}
79
+
80
+ Tools names:
81
+ {tool_names}
82
+
83
+ Human: {user_input}
84
+ Nova:
85
+
86
+ Few-Shot: |
87
+ You are Nova, a reasoning AI agent who can use external tools to assist the human. You follow patterns from past conversations and think before acting.
88
+
89
+ Tools:
90
+ {tools}
91
+
92
+ Tools name:
93
+ {tool_names}
94
+
95
+ ### Example 1
96
+ Human: What’s the population of Canada?
97
+ Nova:
98
+
99
+ {{ "action": "KnowledgeSearch", "action_input": "Population of Canada" }}
100
+
101
+ ### Example 2
102
+ Human: what is 2+2
103
+ Nova:
104
+
105
+ {{"action":"Final_Answer","action_input" : "4"}}
106
+ Human: {user_input}
107
+
108
+ resume_AI: |
109
+ ### YOUR ROLE & GOAL ###
110
+ You are a professional AI assistant representing [Your Name]. Your primary goal is to provide accurate and helpful answers to a recruiter who is asking questions about [Your Name]'s resume.
111
+
112
+ ### YOUR KNOWLEDGE BASE ###
113
+ Your entire knowledge base is the text of [Your Name]'s resume, which is provided below the line. You cannot access any outside information.
114
+
115
+ ### RULES OF ENGAGEMENT ###
116
+ 1. **Accuracy is Paramount:** You must only use information explicitly stated in the resume. Do not make assumptions or infer details.
117
+ 2. **Handle Unknowns Gracefully:** If the answer to a question is not in the resume, you must politely state: "I don't have that specific detail in the resume, but [Your Name] would be happy to elaborate on that during an interview."
118
+ 3. **Maintain Persona:** Answer from a third-person perspective (e.g., "[Your Name] has experience in...", "His skills include...").
119
+ 4. **Be Professional and Concise:** Avoid overly casual language. Get straight to the point while remaining polite.
120
+ 5. **Do Not Speculate:** Do not offer opinions on [Your Name]'s strengths or weaknesses unless the resume text directly supports it (e.g., a section titled "Key Strengths").
121
+
122
+ ---
123
+ Use this exact json format:
124
+
125
+ {{"action": "<tool_name> / Final_Answer", "action_input": "<input>"}}
126
+
127
+ You must always be honest, safe, and clear. You never guess.
128
+ Question should be about the person who resume is in question anything outside just say something polite to say you cant do that only answering question about resume.
129
+
130
+ Available tools:
131
+ {tools}
132
+
133
+ Tools names:
134
+ {tool_names}
135
+
136
+ you can repeat n times if needed
137
+
138
+ User: {user_input}
139
+ ---
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
- Name: AgentX-Dev
3
- Version: 0.1.1
2
+ Name: agentx-dev
3
+ Version: 2.0
4
4
  Summary: A lightweight LLM agent framework with standard and structured tool support use, prompt management, and support for OpenAI.
5
5
  Author-email: Bruce-Arhin Shadrach <brucearhin098@gmail.com>
6
- License-Expression: MIT
7
6
  Project-URL: Homepage, https://github.com/shadrach098/Bruce_framework
7
+ Project-URL: Bug Tracker, https://github.com/shadrach098/Bruce_framework/issues
8
8
  Project-URL: Source, https://github.com/shadrach098/Bruce_framework
9
9
  Requires-Python: >=3.8
10
10
  Description-Content-Type: text/markdown
@@ -12,6 +12,7 @@ Requires-Dist: openai>=1.0.0
12
12
  Requires-Dist: pydantic>=2.0
13
13
  Requires-Dist: google-generativeai
14
14
  Requires-Dist: httpx
15
+ Requires-Dist: PyYAML>=5.3.1
15
16
 
16
17
 
17
18
  # 🧠 Bruce Agent
@@ -39,29 +40,43 @@ pip install AgentX-Dev
39
40
  ```python
40
41
  from AgentXL import AgentRunner, AgentType,ChatModel
41
42
  from pydantic import BaseModel
42
- from AgentXL.Tools import StructuredTool
43
- # Define a sample tool
44
- class MultiplyTool(StructuredTool):
45
- name = "multiply"
46
- description = "Multiply two numbers"
43
+ from AgentXL.Tools import StructuredTool,StandardTool
44
+ # Define a sample Stuctured tool
45
+ class MultiplyTool(BaseModel):
46
+ a: int
47
+ b: int
47
48
 
48
- class Schema(BaseModel):
49
- a: int
50
- b: int
49
+ def multiply(a: int, b: int) -> int:
50
+ return a * b
51
51
 
52
- def run(self, a: int, b: int) -> int:
53
- return a * b
52
+ # Define a sample Standard tool
53
+ def Weather(weather:str):
54
+ return f"{weather} is currently at 28 degree with a high of 32 and a low of 18 "
54
55
 
55
56
  # Create chat model and agent
56
57
  ReAct=AgentType.ReAct
57
58
  chat_model = ChatModel.GPT(model="gpt-4", temperature=0.7)
58
- tools = [MultiplyTool()]
59
+ tools = [StructuredTool(name="MultiplyTool",
60
+ description="useful when you need to add two numbers",
61
+ func=multiply,
62
+ args_schema=MultiplyTool
63
+ ),
64
+ StandardTool(name="Weather",
65
+ description="when you need to check the weather of a location, input should be the str of the location",
66
+ func=Weather)]
67
+ # Create an AgentRunner instance
59
68
  agent = AgentRunner(model=chat_model,Agent=ReAct, tools=tools)
60
69
 
70
+ # Initialize the agent with user input
61
71
  response = agent.Initialize("What is 5 times 8?")
72
+
73
+ # Print the result
62
74
  print(response.content)
63
75
 
64
76
 
77
+ # output the Agent completion
78
+ agent.Initialize("i need the weather in Barrie")
79
+
65
80
 
66
81
  ```
67
82
 
@@ -94,3 +109,4 @@ print(response.content)
94
109
  MIT License
95
110
 
96
111
 
112
+
@@ -0,0 +1,18 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ agentx_dev/ChatModel.py
5
+ agentx_dev/Tools.py
6
+ agentx_dev/__init__.py
7
+ agentx_dev/promptTemplate.yaml
8
+ agentx_dev.egg-info/PKG-INFO
9
+ agentx_dev.egg-info/SOURCES.txt
10
+ agentx_dev.egg-info/dependency_links.txt
11
+ agentx_dev.egg-info/requires.txt
12
+ agentx_dev.egg-info/top_level.txt
13
+ agentx_dev/Agents/Agent.py
14
+ agentx_dev/Agents/__init__.py
15
+ agentx_dev/Agents/promptTemplate.yaml
16
+ agentx_dev/Runner/AgentRun.py
17
+ agentx_dev/Runner/__init__.py
18
+ agentx_dev/Runner/promptTemplate.yaml
@@ -2,3 +2,4 @@ openai>=1.0.0
2
2
  pydantic>=2.0
3
3
  google-generativeai
4
4
  httpx
5
+ PyYAML>=5.3.1
@@ -0,0 +1,2 @@
1
+ agentx_dev
2
+ dist
@@ -1,32 +1,40 @@
1
1
  [project]
2
- name = "AgentX-Dev"
3
- version = "0.1.1"
2
+
3
+ name = "agentx-dev"
4
+ version = "2.0"
4
5
  description = "A lightweight LLM agent framework with standard and structured tool support use, prompt management, and support for OpenAI."
5
6
  authors = [{ name = "Bruce-Arhin Shadrach", email = "brucearhin098@gmail.com" }]
6
- license = "MIT"
7
+ # Best practice: link to the license file
8
+ license = { file = "LICENSE" }
7
9
  readme = "README.md"
8
10
  requires-python = ">=3.8"
9
11
 
12
+
13
+ # CRITICAL FIX: Removed invalid characters and fixed indentation
10
14
  dependencies = [
11
15
  "openai>=1.0.0",
12
16
  "pydantic>=2.0",
13
17
  "google-generativeai",
14
- "httpx"
18
+ "httpx",
19
+ # It's good practice to pin PyYAML to a version that fixes security issues
20
+ "PyYAML>=5.3.1"
15
21
  ]
16
22
 
17
23
  [project.urls]
18
24
  Homepage = "https://github.com/shadrach098/Bruce_framework"
25
+ "Bug Tracker" = "https://github.com/shadrach098/Bruce_framework/issues"
19
26
  Source = "https://github.com/shadrach098/Bruce_framework"
20
27
 
21
28
  [build-system]
22
29
  requires = ["setuptools>=61.0", "wheel"]
23
30
  build-backend = "setuptools.build_meta"
31
+ # In pyproject.toml
24
32
 
25
33
  [tool.setuptools]
26
- package-dir = {"" = "src"}
34
+ include-package-data = true
27
35
 
28
36
  [tool.setuptools.packages.find]
29
- where = ["src"]
37
+ where = ["."]
30
38
 
31
39
 
32
40
 
@@ -1,14 +0,0 @@
1
- README.md
2
- pyproject.toml
3
- src/AgentXL/ChatModel.py
4
- src/AgentXL/Tools.py
5
- src/AgentXL/__init__.py
6
- src/AgentXL/Agents/Agent.py
7
- src/AgentXL/Agents/__init__.py
8
- src/AgentXL/Runner/AgentRun.py
9
- src/AgentXL/Runner/__init__.py
10
- src/AgentX_Dev.egg-info/PKG-INFO
11
- src/AgentX_Dev.egg-info/SOURCES.txt
12
- src/AgentX_Dev.egg-info/dependency_links.txt
13
- src/AgentX_Dev.egg-info/requires.txt
14
- src/AgentX_Dev.egg-info/top_level.txt
@@ -1 +0,0 @@
1
- AgentXL
File without changes