pyagentkit 0.1.2__tar.gz → 0.1.5__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.
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/PKG-INFO +10 -5
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/README.md +9 -4
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/USAGE.md +6 -1
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/pyproject.toml +1 -1
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/src/pyagentkit/agent.py +2 -2
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/.github/workflows/publish.yml +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/.github/workflows/python-publish.yml +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/.gitignore +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/.python-version +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/LICENSE +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/src/pyagentkit/__init__.py +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/src/pyagentkit/definitions.py +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/src/pyagentkit/exceptions.py +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/src/pyagentkit/helpers.py +0 -0
- {pyagentkit-0.1.2 → pyagentkit-0.1.5}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyagentkit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Agent toolkit for Ollama
|
|
5
5
|
Project-URL: Homepage, https://github.com/TarikEren/pyagentkit
|
|
6
6
|
Project-URL: Issues, https://github.com/TarikEren/pyagentkit/issues
|
|
@@ -44,7 +44,10 @@ pip install pyagentkit
|
|
|
44
44
|
## Example
|
|
45
45
|
|
|
46
46
|
```python
|
|
47
|
-
from ollama_agentkit import Agent, tool, AgentResponse
|
|
47
|
+
from ollama_agentkit import Agent, tool, AgentResponse, configure_logging
|
|
48
|
+
|
|
49
|
+
# For configuring agent logging
|
|
50
|
+
configure_logging()
|
|
48
51
|
|
|
49
52
|
# Custom output class to manipulate LLM output
|
|
50
53
|
class CustomOutput(AgentResponse):
|
|
@@ -58,9 +61,7 @@ agent = Agent(
|
|
|
58
61
|
response_model=CustomOutput
|
|
59
62
|
)
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
@agent.register_tool
|
|
63
|
-
def add_tool(n1: int, n2: int):
|
|
64
|
+
def sum_tool(n1: int, n2: int):
|
|
64
65
|
"""Adds two numbers""" # All tooling must have a one-liner docstring that defines what the function does
|
|
65
66
|
# Every tool must return a `ToolResult` object
|
|
66
67
|
return ToolResult(
|
|
@@ -69,8 +70,12 @@ def add_tool(n1: int, n2: int):
|
|
|
69
70
|
content=f"Result: {n1 + n2}" # The part which the agent will read
|
|
70
71
|
)
|
|
71
72
|
|
|
73
|
+
agent.add_tool(sum_tool)
|
|
74
|
+
|
|
72
75
|
# Messages get printed during the response handling
|
|
73
76
|
result = agent.handle_response(prompt="What is 2 + 2")
|
|
77
|
+
|
|
78
|
+
# Custom output class fields can be accessed as such
|
|
74
79
|
print(result.sum_result)
|
|
75
80
|
|
|
76
81
|
```
|
|
@@ -24,7 +24,10 @@ pip install pyagentkit
|
|
|
24
24
|
## Example
|
|
25
25
|
|
|
26
26
|
```python
|
|
27
|
-
from ollama_agentkit import Agent, tool, AgentResponse
|
|
27
|
+
from ollama_agentkit import Agent, tool, AgentResponse, configure_logging
|
|
28
|
+
|
|
29
|
+
# For configuring agent logging
|
|
30
|
+
configure_logging()
|
|
28
31
|
|
|
29
32
|
# Custom output class to manipulate LLM output
|
|
30
33
|
class CustomOutput(AgentResponse):
|
|
@@ -38,9 +41,7 @@ agent = Agent(
|
|
|
38
41
|
response_model=CustomOutput
|
|
39
42
|
)
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
@agent.register_tool
|
|
43
|
-
def add_tool(n1: int, n2: int):
|
|
44
|
+
def sum_tool(n1: int, n2: int):
|
|
44
45
|
"""Adds two numbers""" # All tooling must have a one-liner docstring that defines what the function does
|
|
45
46
|
# Every tool must return a `ToolResult` object
|
|
46
47
|
return ToolResult(
|
|
@@ -49,8 +50,12 @@ def add_tool(n1: int, n2: int):
|
|
|
49
50
|
content=f"Result: {n1 + n2}" # The part which the agent will read
|
|
50
51
|
)
|
|
51
52
|
|
|
53
|
+
agent.add_tool(sum_tool)
|
|
54
|
+
|
|
52
55
|
# Messages get printed during the response handling
|
|
53
56
|
result = agent.handle_response(prompt="What is 2 + 2")
|
|
57
|
+
|
|
58
|
+
# Custom output class fields can be accessed as such
|
|
54
59
|
print(result.sum_result)
|
|
55
60
|
|
|
56
61
|
```
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# How To Use Pyagentkit
|
|
2
2
|
|
|
3
|
+
- Important: To configure agent logging, run `configure_logging()`
|
|
4
|
+
|
|
3
5
|
## Defining Agents
|
|
4
6
|
|
|
5
7
|
- Defining a `base` agent is as easy as:
|
|
6
8
|
|
|
7
9
|
```python
|
|
8
10
|
|
|
9
|
-
from pyagentkit import Agent
|
|
11
|
+
from pyagentkit import Agent, configure_logging
|
|
12
|
+
|
|
13
|
+
configure_logging() # For logging agents' logging
|
|
14
|
+
configure_logging(level=logging.DEBUG) # For logging with debugging (Useful for detecting any issues with the agents' responses)
|
|
10
15
|
|
|
11
16
|
agent = Agent(llm_name="<llm_name>")
|
|
12
17
|
response = agent.handle_response(prompt="Hello, World!")
|
|
@@ -33,7 +33,7 @@ from .exceptions import (
|
|
|
33
33
|
|
|
34
34
|
T = TypeVar("T", bound=AgentResponse)
|
|
35
35
|
|
|
36
|
-
logger = logging.
|
|
36
|
+
logger = logging.getLogger("pyagentkit")
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
class Agent(Generic[T]):
|
|
@@ -450,7 +450,7 @@ If task is done, generate `final` response and stop.""",
|
|
|
450
450
|
|
|
451
451
|
validated = self.response_model.model_validate_json(content)
|
|
452
452
|
|
|
453
|
-
|
|
453
|
+
logger.info("[%s]: %s", self.agent_name, validated.message)
|
|
454
454
|
self._validate_agent_logic(response=validated)
|
|
455
455
|
if validated.response.type == "final":
|
|
456
456
|
return validated
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|