roy-ollama-toolkit 0.2.2__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.
- roy_ollama_toolkit-0.2.2/PKG-INFO +454 -0
- roy_ollama_toolkit-0.2.2/README.md +410 -0
- roy_ollama_toolkit-0.2.2/pyproject.toml +67 -0
- roy_ollama_toolkit-0.2.2/setup.cfg +4 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/__init__.py +157 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/agent.py +11 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/agents/__init__.py +46 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/agents/memory.py +361 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/agents/role.py +93 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/agents/simple.py +762 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/agents/team.py +451 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/callbacks.py +100 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/cli.py +615 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client.py +16 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/__init__.py +40 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/async_client.py +297 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/common.py +146 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/inference.py +453 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/models.py +573 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/openai_compat.py +306 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/sync_client.py +416 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/transport.py +188 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/client_api/web.py +91 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/common/utils.py +124 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/config/__init__.py +41 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/config/core.py +394 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/config/presets.py +313 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/config.py +219 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/connector.py +189 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/dashboard.py +189 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/exceptions.py +281 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/extractor.py +113 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/models/__init__.py +31 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/models/selector.py +412 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/openai_types.py +178 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/py.typed +0 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/telemetry.py +114 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tool_registry.py +792 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/__init__.py +36 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/benchmark.py +706 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/cache.py +446 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/db.py +172 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/document.py +784 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/email.py +375 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/files.py +359 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/math.py +130 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/mcp.py +233 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/models.py +502 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/pdf.py +67 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/schema.py +333 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/server.py +125 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/system.py +324 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/system_health.py +44 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/vector.py +363 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/vision/__init__.py +156 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/vision/analysis.py +31 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/vision/metadata.py +56 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/vision/ocr.py +59 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/vision/spatial.py +84 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/vision/tiling.py +67 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/vision/video.py +100 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/tools/web.py +166 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/types.py +515 -0
- roy_ollama_toolkit-0.2.2/src/ollamatoolkit/utils.py +293 -0
- roy_ollama_toolkit-0.2.2/src/roy_ollama_toolkit.egg-info/PKG-INFO +454 -0
- roy_ollama_toolkit-0.2.2/src/roy_ollama_toolkit.egg-info/SOURCES.txt +77 -0
- roy_ollama_toolkit-0.2.2/src/roy_ollama_toolkit.egg-info/dependency_links.txt +1 -0
- roy_ollama_toolkit-0.2.2/src/roy_ollama_toolkit.egg-info/entry_points.txt +2 -0
- roy_ollama_toolkit-0.2.2/src/roy_ollama_toolkit.egg-info/requires.txt +30 -0
- roy_ollama_toolkit-0.2.2/src/roy_ollama_toolkit.egg-info/top_level.txt +1 -0
- roy_ollama_toolkit-0.2.2/tests/test_client.py +451 -0
- roy_ollama_toolkit-0.2.2/tests/test_client_openai_compat.py +279 -0
- roy_ollama_toolkit-0.2.2/tests/test_client_stream_events.py +136 -0
- roy_ollama_toolkit-0.2.2/tests/test_comprehensive.py +574 -0
- roy_ollama_toolkit-0.2.2/tests/test_config.py +126 -0
- roy_ollama_toolkit-0.2.2/tests/test_connector.py +74 -0
- roy_ollama_toolkit-0.2.2/tests/test_live_ollama_integration.py +287 -0
- roy_ollama_toolkit-0.2.2/tests/test_thorough.py +232 -0
- roy_ollama_toolkit-0.2.2/tests/test_types.py +246 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: roy-ollama-toolkit
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: A Professional-Grade, Modular Agentic Framework for Ollama & LiteLLM.
|
|
5
|
+
Project-URL: Homepage, https://github.com/imyourboyroy/ollamatoolkit
|
|
6
|
+
Project-URL: Repository, https://github.com/imyourboyroy/ollamatoolkit
|
|
7
|
+
Project-URL: Issues, https://github.com/imyourboyroy/ollamatoolkit/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: ollama>=0.6.1
|
|
19
|
+
Requires-Dist: httpx>=0.28.1
|
|
20
|
+
Requires-Dist: litellm>=1.50.0
|
|
21
|
+
Requires-Dist: llm-telemetry-toolkit>=0.1.0
|
|
22
|
+
Requires-Dist: numpy>=2.0.0
|
|
23
|
+
Requires-Dist: pydantic>=2.12.5
|
|
24
|
+
Requires-Dist: requests>=2.32.5
|
|
25
|
+
Requires-Dist: rich>=14.2.0
|
|
26
|
+
Requires-Dist: web-scraper-toolkit>=0.1.7
|
|
27
|
+
Requires-Dist: pymupdf>=1.26.7
|
|
28
|
+
Requires-Dist: pypdf>=6.5.0
|
|
29
|
+
Requires-Dist: emailtoolkit>=0.1.0
|
|
30
|
+
Provides-Extra: system
|
|
31
|
+
Requires-Dist: psutil>=7.1.3; extra == "system"
|
|
32
|
+
Provides-Extra: files
|
|
33
|
+
Requires-Dist: pypdf>=6.4.1; extra == "files"
|
|
34
|
+
Requires-Dist: pdf2image>=1.16.0; extra == "files"
|
|
35
|
+
Requires-Dist: opencv-python-headless>=4.0.0; extra == "files"
|
|
36
|
+
Provides-Extra: email
|
|
37
|
+
Requires-Dist: emailtoolkit[dns]>=0.1.0; extra == "email"
|
|
38
|
+
Provides-Extra: full
|
|
39
|
+
Requires-Dist: psutil>=7.1.3; extra == "full"
|
|
40
|
+
Requires-Dist: pypdf>=6.4.1; extra == "full"
|
|
41
|
+
Requires-Dist: pdf2image>=1.16.0; extra == "full"
|
|
42
|
+
Requires-Dist: opencv-python-headless>=4.0.0; extra == "full"
|
|
43
|
+
Requires-Dist: emailtoolkit[dns]>=0.1.0; extra == "full"
|
|
44
|
+
|
|
45
|
+
# OllamaToolkit
|
|
46
|
+
|
|
47
|
+
## Use Case Synopsis
|
|
48
|
+
`ollamatoolkit` is a modular, pip-installable toolkit for building reliable local-AI and hybrid-AI systems on top of Ollama. It is designed for:
|
|
49
|
+
- **agentic workflows** (single agent + multi-agent teams),
|
|
50
|
+
- **programmatic automation** (sync/async clients, typed responses, streaming events),
|
|
51
|
+
- **tool orchestration** (web, files, vector/RAG, DB, system, email, schema, vision), and
|
|
52
|
+
- **integration into larger systems** (research pipelines, MCP-connected tools, telemetry-enabled apps).
|
|
53
|
+
|
|
54
|
+
If your goal is “make smaller local models perform consistently through good scaffolding,” this package is built for exactly that.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Core
|
|
62
|
+
pip install roy-ollama-toolkit
|
|
63
|
+
|
|
64
|
+
# Full extras (system + file/image + email tooling)
|
|
65
|
+
pip install "roy-ollama-toolkit[full]"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Supported Python versions: **3.10–3.13**.
|
|
69
|
+
Import path remains `ollamatoolkit` after installation.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Integration Guide
|
|
74
|
+
|
|
75
|
+
### 1) Standalone usage (direct Python)
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from ollamatoolkit.client import OllamaClient
|
|
79
|
+
|
|
80
|
+
with OllamaClient(base_url="http://localhost:11434") as client:
|
|
81
|
+
reply = client.chat(
|
|
82
|
+
model="qwen3:8b",
|
|
83
|
+
messages=[{"role": "user", "content": "Give me a 1-line business summary."}],
|
|
84
|
+
)
|
|
85
|
+
print(reply.message.content)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 2) Agentic usage (SimpleAgent + tools)
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from ollamatoolkit.agents.simple import SimpleAgent
|
|
92
|
+
|
|
93
|
+
agent = SimpleAgent(
|
|
94
|
+
name="research-assistant",
|
|
95
|
+
system_message="You are concise, evidence-focused, and tool-using.",
|
|
96
|
+
model_config={"model": "ollama/qwen3:8b", "base_url": "http://localhost:11434"},
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
@agent.tool()
|
|
100
|
+
def add(a: int, b: int) -> int:
|
|
101
|
+
"""Add two integers."""
|
|
102
|
+
return a + b
|
|
103
|
+
|
|
104
|
+
print(agent.run("What is 19 + 23?"))
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3) Agentic + MCP tool servers (stdio bridge)
|
|
108
|
+
|
|
109
|
+
`ollamatoolkit.tools.mcp` connects to MCP servers via **command + args** (stdio JSON-RPC).
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from ollamatoolkit.tools.mcp import MCPToolManager
|
|
113
|
+
from ollamatoolkit.agents.simple import SimpleAgent
|
|
114
|
+
|
|
115
|
+
mcp = MCPToolManager(
|
|
116
|
+
{
|
|
117
|
+
"web": {
|
|
118
|
+
"command": "python",
|
|
119
|
+
"args": ["-m", "web_scraper_toolkit.server.mcp_server"],
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
mcp.start_all()
|
|
124
|
+
|
|
125
|
+
agent = SimpleAgent(
|
|
126
|
+
name="mcp-agent",
|
|
127
|
+
system_message="Use tools when helpful.",
|
|
128
|
+
model_config={"model": "ollama/qwen3:8b", "base_url": "http://localhost:11434"},
|
|
129
|
+
tools=mcp.get_tool_schemas(),
|
|
130
|
+
function_map=mcp.get_proxy_functions(),
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
print(agent.run("Find contact info for example.com and summarize it."))
|
|
134
|
+
mcp.shutdown()
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
> For remote MCP hosting, run the server on the remote machine and use a transport command that exposes stdio locally (for example via SSH command invocation).
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Quick API Starts
|
|
142
|
+
|
|
143
|
+
### Sync + Async parity
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
import asyncio
|
|
147
|
+
from ollamatoolkit.client import OllamaClient, AsyncOllamaClient
|
|
148
|
+
|
|
149
|
+
with OllamaClient() as client:
|
|
150
|
+
print(client.version())
|
|
151
|
+
|
|
152
|
+
async def main() -> None:
|
|
153
|
+
async with AsyncOllamaClient() as client:
|
|
154
|
+
print(await client.version())
|
|
155
|
+
|
|
156
|
+
asyncio.run(main())
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Stream structured events
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from ollamatoolkit.client import OllamaClient
|
|
163
|
+
|
|
164
|
+
with OllamaClient() as client:
|
|
165
|
+
for event in client.stream_chat_events(
|
|
166
|
+
model="qwen3:8b",
|
|
167
|
+
messages=[{"role": "user", "content": "Explain caching in 2 bullets."}],
|
|
168
|
+
):
|
|
169
|
+
if event.event == "token":
|
|
170
|
+
print(event.text, end="", flush=True)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### OpenAI-compatible `/v1/*` helpers
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from ollamatoolkit.client import OllamaClient
|
|
177
|
+
|
|
178
|
+
with OllamaClient() as client:
|
|
179
|
+
models = client.openai_list_models()
|
|
180
|
+
chat = client.openai_chat_completions(
|
|
181
|
+
model="qwen3:8b",
|
|
182
|
+
messages=[{"role": "user", "content": "One sentence about B2B lead qualification."}],
|
|
183
|
+
)
|
|
184
|
+
print(chat.choices[0].message.content)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Structured extraction
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
from pydantic import BaseModel
|
|
191
|
+
from ollamatoolkit.agents.simple import SimpleAgent
|
|
192
|
+
|
|
193
|
+
class CompanyFacts(BaseModel):
|
|
194
|
+
website: str
|
|
195
|
+
ceo_name: str
|
|
196
|
+
|
|
197
|
+
agent = SimpleAgent(
|
|
198
|
+
name="extractor",
|
|
199
|
+
system_message="Return valid JSON only.",
|
|
200
|
+
model_config={"model": "ollama/qwen3:8b", "base_url": "http://localhost:11434"},
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
facts = agent.run_structured("Extract website and CEO from: ...", CompanyFacts)
|
|
204
|
+
print(facts.model_dump())
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## CLI Usage
|
|
210
|
+
|
|
211
|
+
Entry point:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
ollamatoolkit --help
|
|
215
|
+
# or
|
|
216
|
+
python -m ollamatoolkit.cli --help
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Commands
|
|
220
|
+
|
|
221
|
+
#### `config`
|
|
222
|
+
- `--init` create sample config JSON.
|
|
223
|
+
|
|
224
|
+
#### `run`
|
|
225
|
+
- positional: `role_file`
|
|
226
|
+
- `--task/-t`
|
|
227
|
+
- `--interactive/-i`
|
|
228
|
+
- `--dashboard/-d`
|
|
229
|
+
- `--model/-m`
|
|
230
|
+
- `--tools` (`all files math db server system web vision`)
|
|
231
|
+
- `--db-path`
|
|
232
|
+
- `--config/-c`
|
|
233
|
+
- `--batch-file/-b`
|
|
234
|
+
- `--output-dir/-o`
|
|
235
|
+
- `--streaming/-s`
|
|
236
|
+
|
|
237
|
+
#### `models`
|
|
238
|
+
- `--capability/-c` (`vision embedding tools completion reasoning`)
|
|
239
|
+
- `--json`
|
|
240
|
+
- `--base-url`
|
|
241
|
+
|
|
242
|
+
#### `chat`
|
|
243
|
+
- `--model/-m`
|
|
244
|
+
- `--base-url`
|
|
245
|
+
- `--system/-s`
|
|
246
|
+
|
|
247
|
+
### Example commands
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Generate sample config
|
|
251
|
+
python -m ollamatoolkit.cli config --init
|
|
252
|
+
|
|
253
|
+
# Quick chat
|
|
254
|
+
python -m ollamatoolkit.cli chat --model qwen3:8b
|
|
255
|
+
|
|
256
|
+
# Run role-based agent with streaming
|
|
257
|
+
python -m ollamatoolkit.cli run .\roles\researcher.json -t "Research Acme Corp" --streaming
|
|
258
|
+
|
|
259
|
+
# List only embedding-capable models as JSON
|
|
260
|
+
python -m ollamatoolkit.cli models --capability embedding --json
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Configuration Hierarchy
|
|
266
|
+
|
|
267
|
+
When running through CLI/runtime patterns, prefer this precedence:
|
|
268
|
+
1. **Explicit runtime arguments** (CLI flags / constructor args)
|
|
269
|
+
2. **Config file values** (`config.json` or generated sample config)
|
|
270
|
+
3. **Dataclass defaults** in `ToolkitConfig`
|
|
271
|
+
|
|
272
|
+
Primary config sections:
|
|
273
|
+
- `agent`
|
|
274
|
+
- `tools` (including `mcp_servers`)
|
|
275
|
+
- `web`
|
|
276
|
+
- `vision`
|
|
277
|
+
- `vector`
|
|
278
|
+
- `models` (per-capability slot config)
|
|
279
|
+
- `memory`
|
|
280
|
+
- `document`
|
|
281
|
+
- `benchmark`
|
|
282
|
+
- `telemetry`
|
|
283
|
+
- `logging`
|
|
284
|
+
- `dashboard`
|
|
285
|
+
|
|
286
|
+
Load and save:
|
|
287
|
+
|
|
288
|
+
```python
|
|
289
|
+
from ollamatoolkit.config import ToolkitConfig
|
|
290
|
+
|
|
291
|
+
cfg = ToolkitConfig.load("config.json")
|
|
292
|
+
cfg.save("config.generated.json")
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Architecture (high level)
|
|
298
|
+
|
|
299
|
+
- **Client layer**: `ollamatoolkit.client` + `client_api/*`
|
|
300
|
+
- sync + async clients
|
|
301
|
+
- transport + retries/backoff/circuit breaker
|
|
302
|
+
- chat/generate/embed/model-management/web
|
|
303
|
+
- OpenAI-compat wrappers
|
|
304
|
+
- **Agent layer**: `agents/simple.py`, `agents/team.py`, `agents/role.py`, `agents/memory.py`
|
|
305
|
+
- tool calling
|
|
306
|
+
- streaming token loops
|
|
307
|
+
- structured Pydantic responses
|
|
308
|
+
- multi-agent orchestration
|
|
309
|
+
- **Tool layer**: `tools/*`
|
|
310
|
+
- vector, document, web, files, DB, math, email, schema, system, server
|
|
311
|
+
- vision subpackage for OCR/analysis/video/spatial tasks
|
|
312
|
+
- MCP client for external tool servers
|
|
313
|
+
- **Model intelligence**: `models/selector.py`
|
|
314
|
+
- choose best model by capability
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Source File Map (what each file does)
|
|
319
|
+
|
|
320
|
+
| File | Responsibility |
|
|
321
|
+
|---|---|
|
|
322
|
+
| `ollamatoolkit/__init__.py` | Ollama Toolkit - A Professional-Grade Agentic Framework |
|
|
323
|
+
| `ollamatoolkit/agent.py` | Ollama Toolkit - Agent Shim |
|
|
324
|
+
| `ollamatoolkit/agents/__init__.py` | Ollama Toolkit - Agent Components |
|
|
325
|
+
| `ollamatoolkit/agents/memory.py` | Ollama Toolkit - Agent Memory Management |
|
|
326
|
+
| `ollamatoolkit/agents/role.py` | Ollama Toolkit - Role Agent |
|
|
327
|
+
| `ollamatoolkit/agents/simple.py` | Simple agent runtime for synchronous/async LiteLLM conversations with tool execution. |
|
|
328
|
+
| `ollamatoolkit/agents/team.py` | Ollama Toolkit - Multi-Agent Team Orchestration |
|
|
329
|
+
| `ollamatoolkit/callbacks.py` | OllamaToolkit Callbacks |
|
|
330
|
+
| `ollamatoolkit/cli.py` | Ollama Toolkit - CLI Runner |
|
|
331
|
+
| `ollamatoolkit/client.py` | Public client module for OllamaToolkit. |
|
|
332
|
+
| `ollamatoolkit/client_api/__init__.py` | Composable client-domain adapters used by OllamaToolkit public client façades. |
|
|
333
|
+
| `ollamatoolkit/client_api/async_client.py` | Public asynchronous Ollama client composed from endpoint-domain adapters. |
|
|
334
|
+
| `ollamatoolkit/client_api/common.py` | Shared helpers for OllamaToolkit API clients. |
|
|
335
|
+
| `ollamatoolkit/client_api/inference.py` | Inference endpoint adapters for OllamaToolkit clients. |
|
|
336
|
+
| `ollamatoolkit/client_api/models.py` | Model-management endpoint adapters for OllamaToolkit clients. |
|
|
337
|
+
| `ollamatoolkit/client_api/openai_compat.py` | OpenAI-compatible (`/v1/*`) endpoint adapters for OllamaToolkit clients. |
|
|
338
|
+
| `ollamatoolkit/client_api/sync_client.py` | Public synchronous Ollama client composed from endpoint-domain adapters. |
|
|
339
|
+
| `ollamatoolkit/client_api/transport.py` | HTTP transport layer used by OllamaToolkit client domain modules. |
|
|
340
|
+
| `ollamatoolkit/client_api/web.py` | Web endpoint adapters for OllamaToolkit clients. |
|
|
341
|
+
| `ollamatoolkit/common/utils.py` | Ollama Toolkit - Utilities |
|
|
342
|
+
| `ollamatoolkit/config/__init__.py` | Ollama Toolkit - Configuration Package |
|
|
343
|
+
| `ollamatoolkit/config/core.py` | Ollama Toolkit - Core Configuration |
|
|
344
|
+
| `ollamatoolkit/config/presets.py` | Ollama Toolkit - Model Presets |
|
|
345
|
+
| `ollamatoolkit/config.py` | Ollama Toolkit - Configuration |
|
|
346
|
+
| `ollamatoolkit/connector.py` | High-level Ollama connector façade used by toolkit consumers and dependent apps. |
|
|
347
|
+
| `ollamatoolkit/dashboard.py` | Ollama Toolkit - Mission Control Dashboard |
|
|
348
|
+
| `ollamatoolkit/exceptions.py` | OllamaToolkit Exception Hierarchy |
|
|
349
|
+
| `ollamatoolkit/extractor.py` | Schema-first field extraction helper built on top of ``SimpleAgent``. |
|
|
350
|
+
| `ollamatoolkit/models/__init__.py` | Ollama Toolkit - Model Utilities |
|
|
351
|
+
| `ollamatoolkit/models/selector.py` | Ollama Toolkit - Smart Model Selector |
|
|
352
|
+
| `ollamatoolkit/openai_types.py` | Typed models for Ollama OpenAI-compatible (`/v1/*`) endpoints. |
|
|
353
|
+
| `ollamatoolkit/telemetry.py` | Ollama Toolkit - Telemetry Integration |
|
|
354
|
+
| `ollamatoolkit/tool_registry.py` | OllamaToolkit - LLM Tool Registry |
|
|
355
|
+
| `ollamatoolkit/tools/__init__.py` | Ollama Toolkit - Tools Package |
|
|
356
|
+
| `ollamatoolkit/tools/benchmark.py` | Ollama Toolkit - Model Benchmarking (GPU-Aware) |
|
|
357
|
+
| `ollamatoolkit/tools/cache.py` | OllamaToolkit - Cache Tools |
|
|
358
|
+
| `ollamatoolkit/tools/db.py` | Ollama Toolkit - Database Tools |
|
|
359
|
+
| `ollamatoolkit/tools/document.py` | Ollama Toolkit - Document Processor |
|
|
360
|
+
| `ollamatoolkit/tools/email.py` | OllamaToolkit - Email Tools |
|
|
361
|
+
| `ollamatoolkit/tools/files.py` | Ollama Toolkit - File Tools |
|
|
362
|
+
| `ollamatoolkit/tools/math.py` | Ollama Toolkit - Math Tools |
|
|
363
|
+
| `ollamatoolkit/tools/mcp.py` | Ollama Toolkit - MCP Client |
|
|
364
|
+
| `ollamatoolkit/tools/models.py` | Ollama Toolkit - Model Inspector |
|
|
365
|
+
| `ollamatoolkit/tools/pdf.py` | PDF helper utilities shared by vision/document workflows. |
|
|
366
|
+
| `ollamatoolkit/tools/schema.py` | OllamaToolkit - JSON Schema Tools |
|
|
367
|
+
| `ollamatoolkit/tools/server.py` | Ollama Toolkit - Server Tools |
|
|
368
|
+
| `ollamatoolkit/tools/system.py` | Ollama Toolkit - System Tools |
|
|
369
|
+
| `ollamatoolkit/tools/system_health.py` | Ollama Toolkit - System Health Tool |
|
|
370
|
+
| `ollamatoolkit/tools/vector.py` | Ollama Toolkit - Vector Intelligence (RAG) |
|
|
371
|
+
| `ollamatoolkit/tools/vision/__init__.py` | Ollama Toolkit - Vision Package |
|
|
372
|
+
| `ollamatoolkit/tools/vision/analysis.py` | Ollama Toolkit - Vision Analysis |
|
|
373
|
+
| `ollamatoolkit/tools/vision/metadata.py` | Ollama Toolkit - Vision Metadata |
|
|
374
|
+
| `ollamatoolkit/tools/vision/ocr.py` | OCR helper that routes image/PDF inputs through a vision-capable model. |
|
|
375
|
+
| `ollamatoolkit/tools/vision/spatial.py` | Ollama Toolkit - Vision Spatial |
|
|
376
|
+
| `ollamatoolkit/tools/vision/tiling.py` | Ollama Toolkit - Vision Tiling |
|
|
377
|
+
| `ollamatoolkit/tools/vision/video.py` | Ollama Toolkit - Smart Video Processor |
|
|
378
|
+
| `ollamatoolkit/tools/web.py` | Ollama Toolkit - Web Tools |
|
|
379
|
+
| `ollamatoolkit/types.py` | Ollama Toolkit - Type Definitions |
|
|
380
|
+
| `ollamatoolkit/utils.py` | Ollama Toolkit - Utilities |
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Examples Directory
|
|
385
|
+
|
|
386
|
+
The `examples/` folder includes runnable patterns:
|
|
387
|
+
- `01_basic_chat.py`
|
|
388
|
+
- `02_with_tools.py`
|
|
389
|
+
- `03_vision_ocr.py`
|
|
390
|
+
- `04_rag_pipeline.py`
|
|
391
|
+
- `05_multi_agent_team.py`
|
|
392
|
+
- `06_streaming_ui.py`
|
|
393
|
+
- `07_schema_cache.py`
|
|
394
|
+
- `08_email_tools.py`
|
|
395
|
+
- `09_tool_registry.py`
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Testing and Quality
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
# Lint
|
|
403
|
+
python -m ruff check .
|
|
404
|
+
|
|
405
|
+
# Format
|
|
406
|
+
python -m ruff format .
|
|
407
|
+
|
|
408
|
+
# Type-check
|
|
409
|
+
python -m mypy src/ollamatoolkit
|
|
410
|
+
|
|
411
|
+
# Tests
|
|
412
|
+
python -B -m pytest -q
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Optional live Ollama integration tests (env-gated):
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
# PowerShell example (do not hardcode private hosts in tracked files)
|
|
419
|
+
$env:OLLAMA_TEST_BASE_URL="http://YOUR_HOST:11434"
|
|
420
|
+
python -m pytest tests/test_live_ollama_integration.py -m integration -v
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Workspace gateway (run from workspace root):
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
python .\tools\run_quality_gate.py --project .\OllamaToolkit
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## Publishing Checklist (GitHub + PyPI)
|
|
432
|
+
|
|
433
|
+
From workspace root:
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
python .\tools\run_quality_gate.py --project .\OllamaToolkit
|
|
437
|
+
python .\tools\publish_release.py --project .\OllamaToolkit
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## Security & Privacy Notes
|
|
443
|
+
|
|
444
|
+
- Do not commit private server IPs, API keys, or machine-specific paths.
|
|
445
|
+
- Use environment variables for private runtime endpoints.
|
|
446
|
+
- Keep local-only testing settings in ignored files (e.g., local config files excluded by `.gitignore`).
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## Author
|
|
451
|
+
|
|
452
|
+
**Created by**: Roy Dawson IV
|
|
453
|
+
**GitHub**: [https://github.com/imyourboyroy](https://github.com/imyourboyroy)
|
|
454
|
+
**PyPI**: [https://pypi.org/user/ImYourBoyRoy/](https://pypi.org/user/ImYourBoyRoy/)
|