patchpal 0.1.1__tar.gz → 0.1.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.
- {patchpal-0.1.1/patchpal.egg-info → patchpal-0.1.2}/PKG-INFO +81 -8
- {patchpal-0.1.1 → patchpal-0.1.2}/README.md +80 -7
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal/__init__.py +1 -1
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal/agent.py +16 -0
- {patchpal-0.1.1 → patchpal-0.1.2/patchpal.egg-info}/PKG-INFO +81 -8
- {patchpal-0.1.1 → patchpal-0.1.2}/LICENSE +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/MANIFEST.in +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal/cli.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal/context.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal/permissions.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal/skills.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal/system_prompt.md +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal/tools.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal.egg-info/SOURCES.txt +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal.egg-info/dependency_links.txt +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal.egg-info/entry_points.txt +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal.egg-info/requires.txt +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/patchpal.egg-info/top_level.txt +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/pyproject.toml +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/setup.cfg +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/tests/test_agent.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/tests/test_cli.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/tests/test_context.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/tests/test_guardrails.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/tests/test_operational_safety.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/tests/test_skills.py +0 -0
- {patchpal-0.1.1 → patchpal-0.1.2}/tests/test_tools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: patchpal
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A lean Claude Code clone in pure Python
|
|
5
5
|
Author: PatchPal Contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -69,7 +69,7 @@ pip install patchpal
|
|
|
69
69
|
- **[Cloud]** For Anthropic models (default): Sign up at https://console.anthropic.com/
|
|
70
70
|
- **[Cloud]** For OpenAI models: Get a key from https://platform.openai.com/
|
|
71
71
|
- **[Local]** For vLLM: Install from https://docs.vllm.ai/ (free - no API charges) **Recommended for Local Use**
|
|
72
|
-
- **[Local]** For Ollama: Install from https://ollama.com/ (⚠️
|
|
72
|
+
- **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ requires `OLLAMA_CONTEXT_LENGTH=32768` - see Ollama section below)
|
|
73
73
|
- For other providers: Check the [LiteLLM documentation](https://docs.litellm.ai/docs/providers)
|
|
74
74
|
|
|
75
75
|
2. **Set up your API key as environment variable**:
|
|
@@ -103,8 +103,9 @@ export HOSTED_VLLM_API_BASE=http://localhost:8000
|
|
|
103
103
|
export HOSTED_VLLM_API_KEY=token-abc123
|
|
104
104
|
patchpal --model hosted_vllm/openai/gpt-oss-20b
|
|
105
105
|
|
|
106
|
-
# Use Ollama (local
|
|
107
|
-
|
|
106
|
+
# Use Ollama (local - requires OLLAMA_CONTEXT_LENGTH=32768)
|
|
107
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
108
|
+
patchpal --model ollama_chat/qwen3:32b
|
|
108
109
|
|
|
109
110
|
# Or set the model via environment variable
|
|
110
111
|
export PATCHPAL_MODEL=openai/gpt-5
|
|
@@ -401,14 +402,86 @@ Different models require different parsers. Common parsers include: `qwen3_xml`,
|
|
|
401
402
|
|
|
402
403
|
#### Ollama
|
|
403
404
|
|
|
404
|
-
|
|
405
|
+
Ollama v0.14+ supports tool calling for agentic workflows. However, proper configuration is **critical** for reliable operation.
|
|
406
|
+
|
|
407
|
+
**Requirements:**
|
|
408
|
+
|
|
409
|
+
1. **Ollama v0.14.0 or later** - Required for tool calling support
|
|
410
|
+
2. **Sufficient context window** - Default 4096 tokens is too small; increase to at least 32K
|
|
411
|
+
|
|
412
|
+
**Setup Instructions:**
|
|
413
|
+
|
|
414
|
+
**For Native Ollama Installation:**
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
# Set context window size (required!)
|
|
418
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
419
|
+
|
|
420
|
+
# Start Ollama server
|
|
421
|
+
ollama serve
|
|
422
|
+
|
|
423
|
+
# In another terminal, use with PatchPal
|
|
424
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**For Docker:**
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
# Stop existing container (if running)
|
|
431
|
+
docker stop ollama
|
|
432
|
+
docker rm ollama
|
|
433
|
+
|
|
434
|
+
# Start with proper configuration
|
|
435
|
+
docker run -d \
|
|
436
|
+
-e OLLAMA_CONTEXT_LENGTH=32768 \
|
|
437
|
+
-v ollama:/root/.ollama \
|
|
438
|
+
-p 11434:11434 \
|
|
439
|
+
--name ollama \
|
|
440
|
+
ollama/ollama
|
|
441
|
+
|
|
442
|
+
# Verify configuration
|
|
443
|
+
docker exec -it ollama ollama run gpt-oss:20b
|
|
444
|
+
# In the Ollama prompt, type: /show parameters
|
|
445
|
+
# Should show num_ctx much larger than default 4096
|
|
446
|
+
|
|
447
|
+
# Use with PatchPal
|
|
448
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
**Verifying Context Window Size:**
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
# Check your Ollama container configuration
|
|
455
|
+
docker inspect ollama | grep OLLAMA_CONTEXT_LENGTH
|
|
456
|
+
|
|
457
|
+
# Or run a model and check parameters
|
|
458
|
+
docker exec -it ollama ollama run gpt-oss:20b
|
|
459
|
+
>>> /show parameters
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
**Recommended Models for Tool Calling:**
|
|
463
|
+
|
|
464
|
+
- `gpt-oss:20b` - OpenAI's open-source model, excellent tool calling
|
|
465
|
+
- `qwen3:32b` - Qwen3 model with good agentic capabilities
|
|
466
|
+
- `qwen3-coder` - Specialized for coding tasks
|
|
467
|
+
|
|
468
|
+
**Performance Note:**
|
|
469
|
+
|
|
470
|
+
While Ollama now works with proper configuration, vLLM is still recommended for production use due to:
|
|
471
|
+
- 3-10x faster inference
|
|
472
|
+
- More robust tool calling implementation
|
|
473
|
+
- Better memory management
|
|
405
474
|
|
|
406
475
|
**Examples:**
|
|
407
476
|
|
|
408
477
|
```bash
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
patchpal --model
|
|
478
|
+
# Ollama (works with proper configuration)
|
|
479
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
480
|
+
patchpal --model ollama_chat/qwen3:32b
|
|
481
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
482
|
+
|
|
483
|
+
# vLLM (recommended for production)
|
|
484
|
+
patchpal --model hosted_vllm/openai/gpt-oss-20b
|
|
412
485
|
```
|
|
413
486
|
|
|
414
487
|
### Air-Gapped and Offline Environments
|
|
@@ -33,7 +33,7 @@ pip install patchpal
|
|
|
33
33
|
- **[Cloud]** For Anthropic models (default): Sign up at https://console.anthropic.com/
|
|
34
34
|
- **[Cloud]** For OpenAI models: Get a key from https://platform.openai.com/
|
|
35
35
|
- **[Local]** For vLLM: Install from https://docs.vllm.ai/ (free - no API charges) **Recommended for Local Use**
|
|
36
|
-
- **[Local]** For Ollama: Install from https://ollama.com/ (⚠️
|
|
36
|
+
- **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ requires `OLLAMA_CONTEXT_LENGTH=32768` - see Ollama section below)
|
|
37
37
|
- For other providers: Check the [LiteLLM documentation](https://docs.litellm.ai/docs/providers)
|
|
38
38
|
|
|
39
39
|
2. **Set up your API key as environment variable**:
|
|
@@ -67,8 +67,9 @@ export HOSTED_VLLM_API_BASE=http://localhost:8000
|
|
|
67
67
|
export HOSTED_VLLM_API_KEY=token-abc123
|
|
68
68
|
patchpal --model hosted_vllm/openai/gpt-oss-20b
|
|
69
69
|
|
|
70
|
-
# Use Ollama (local
|
|
71
|
-
|
|
70
|
+
# Use Ollama (local - requires OLLAMA_CONTEXT_LENGTH=32768)
|
|
71
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
72
|
+
patchpal --model ollama_chat/qwen3:32b
|
|
72
73
|
|
|
73
74
|
# Or set the model via environment variable
|
|
74
75
|
export PATCHPAL_MODEL=openai/gpt-5
|
|
@@ -365,14 +366,86 @@ Different models require different parsers. Common parsers include: `qwen3_xml`,
|
|
|
365
366
|
|
|
366
367
|
#### Ollama
|
|
367
368
|
|
|
368
|
-
|
|
369
|
+
Ollama v0.14+ supports tool calling for agentic workflows. However, proper configuration is **critical** for reliable operation.
|
|
370
|
+
|
|
371
|
+
**Requirements:**
|
|
372
|
+
|
|
373
|
+
1. **Ollama v0.14.0 or later** - Required for tool calling support
|
|
374
|
+
2. **Sufficient context window** - Default 4096 tokens is too small; increase to at least 32K
|
|
375
|
+
|
|
376
|
+
**Setup Instructions:**
|
|
377
|
+
|
|
378
|
+
**For Native Ollama Installation:**
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# Set context window size (required!)
|
|
382
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
383
|
+
|
|
384
|
+
# Start Ollama server
|
|
385
|
+
ollama serve
|
|
386
|
+
|
|
387
|
+
# In another terminal, use with PatchPal
|
|
388
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**For Docker:**
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
# Stop existing container (if running)
|
|
395
|
+
docker stop ollama
|
|
396
|
+
docker rm ollama
|
|
397
|
+
|
|
398
|
+
# Start with proper configuration
|
|
399
|
+
docker run -d \
|
|
400
|
+
-e OLLAMA_CONTEXT_LENGTH=32768 \
|
|
401
|
+
-v ollama:/root/.ollama \
|
|
402
|
+
-p 11434:11434 \
|
|
403
|
+
--name ollama \
|
|
404
|
+
ollama/ollama
|
|
405
|
+
|
|
406
|
+
# Verify configuration
|
|
407
|
+
docker exec -it ollama ollama run gpt-oss:20b
|
|
408
|
+
# In the Ollama prompt, type: /show parameters
|
|
409
|
+
# Should show num_ctx much larger than default 4096
|
|
410
|
+
|
|
411
|
+
# Use with PatchPal
|
|
412
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**Verifying Context Window Size:**
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
# Check your Ollama container configuration
|
|
419
|
+
docker inspect ollama | grep OLLAMA_CONTEXT_LENGTH
|
|
420
|
+
|
|
421
|
+
# Or run a model and check parameters
|
|
422
|
+
docker exec -it ollama ollama run gpt-oss:20b
|
|
423
|
+
>>> /show parameters
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**Recommended Models for Tool Calling:**
|
|
427
|
+
|
|
428
|
+
- `gpt-oss:20b` - OpenAI's open-source model, excellent tool calling
|
|
429
|
+
- `qwen3:32b` - Qwen3 model with good agentic capabilities
|
|
430
|
+
- `qwen3-coder` - Specialized for coding tasks
|
|
431
|
+
|
|
432
|
+
**Performance Note:**
|
|
433
|
+
|
|
434
|
+
While Ollama now works with proper configuration, vLLM is still recommended for production use due to:
|
|
435
|
+
- 3-10x faster inference
|
|
436
|
+
- More robust tool calling implementation
|
|
437
|
+
- Better memory management
|
|
369
438
|
|
|
370
439
|
**Examples:**
|
|
371
440
|
|
|
372
441
|
```bash
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
patchpal --model
|
|
442
|
+
# Ollama (works with proper configuration)
|
|
443
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
444
|
+
patchpal --model ollama_chat/qwen3:32b
|
|
445
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
446
|
+
|
|
447
|
+
# vLLM (recommended for production)
|
|
448
|
+
patchpal --model hosted_vllm/openai/gpt-oss-20b
|
|
376
449
|
```
|
|
377
450
|
|
|
378
451
|
### Air-Gapped and Offline Environments
|
|
@@ -540,6 +540,22 @@ class PatchPalAgent:
|
|
|
540
540
|
|
|
541
541
|
self.model_id = _normalize_bedrock_model_id(model_id)
|
|
542
542
|
|
|
543
|
+
# Register Ollama models as supporting native function calling
|
|
544
|
+
# LiteLLM defaults to JSON mode if not explicitly registered
|
|
545
|
+
if self.model_id.startswith("ollama_chat/"):
|
|
546
|
+
# Suppress verbose output from register_model
|
|
547
|
+
import sys
|
|
548
|
+
from io import StringIO
|
|
549
|
+
|
|
550
|
+
old_stdout = sys.stdout
|
|
551
|
+
sys.stdout = StringIO()
|
|
552
|
+
try:
|
|
553
|
+
litellm.register_model(
|
|
554
|
+
{"model_cost": {self.model_id: {"supports_function_calling": True}}}
|
|
555
|
+
)
|
|
556
|
+
finally:
|
|
557
|
+
sys.stdout = old_stdout
|
|
558
|
+
|
|
543
559
|
# Set up Bedrock environment if needed
|
|
544
560
|
if self.model_id.startswith("bedrock/"):
|
|
545
561
|
_setup_bedrock_env()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: patchpal
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A lean Claude Code clone in pure Python
|
|
5
5
|
Author: PatchPal Contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -69,7 +69,7 @@ pip install patchpal
|
|
|
69
69
|
- **[Cloud]** For Anthropic models (default): Sign up at https://console.anthropic.com/
|
|
70
70
|
- **[Cloud]** For OpenAI models: Get a key from https://platform.openai.com/
|
|
71
71
|
- **[Local]** For vLLM: Install from https://docs.vllm.ai/ (free - no API charges) **Recommended for Local Use**
|
|
72
|
-
- **[Local]** For Ollama: Install from https://ollama.com/ (⚠️
|
|
72
|
+
- **[Local]** For Ollama: Install from https://ollama.com/ (⚠️ requires `OLLAMA_CONTEXT_LENGTH=32768` - see Ollama section below)
|
|
73
73
|
- For other providers: Check the [LiteLLM documentation](https://docs.litellm.ai/docs/providers)
|
|
74
74
|
|
|
75
75
|
2. **Set up your API key as environment variable**:
|
|
@@ -103,8 +103,9 @@ export HOSTED_VLLM_API_BASE=http://localhost:8000
|
|
|
103
103
|
export HOSTED_VLLM_API_KEY=token-abc123
|
|
104
104
|
patchpal --model hosted_vllm/openai/gpt-oss-20b
|
|
105
105
|
|
|
106
|
-
# Use Ollama (local
|
|
107
|
-
|
|
106
|
+
# Use Ollama (local - requires OLLAMA_CONTEXT_LENGTH=32768)
|
|
107
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
108
|
+
patchpal --model ollama_chat/qwen3:32b
|
|
108
109
|
|
|
109
110
|
# Or set the model via environment variable
|
|
110
111
|
export PATCHPAL_MODEL=openai/gpt-5
|
|
@@ -401,14 +402,86 @@ Different models require different parsers. Common parsers include: `qwen3_xml`,
|
|
|
401
402
|
|
|
402
403
|
#### Ollama
|
|
403
404
|
|
|
404
|
-
|
|
405
|
+
Ollama v0.14+ supports tool calling for agentic workflows. However, proper configuration is **critical** for reliable operation.
|
|
406
|
+
|
|
407
|
+
**Requirements:**
|
|
408
|
+
|
|
409
|
+
1. **Ollama v0.14.0 or later** - Required for tool calling support
|
|
410
|
+
2. **Sufficient context window** - Default 4096 tokens is too small; increase to at least 32K
|
|
411
|
+
|
|
412
|
+
**Setup Instructions:**
|
|
413
|
+
|
|
414
|
+
**For Native Ollama Installation:**
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
# Set context window size (required!)
|
|
418
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
419
|
+
|
|
420
|
+
# Start Ollama server
|
|
421
|
+
ollama serve
|
|
422
|
+
|
|
423
|
+
# In another terminal, use with PatchPal
|
|
424
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**For Docker:**
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
# Stop existing container (if running)
|
|
431
|
+
docker stop ollama
|
|
432
|
+
docker rm ollama
|
|
433
|
+
|
|
434
|
+
# Start with proper configuration
|
|
435
|
+
docker run -d \
|
|
436
|
+
-e OLLAMA_CONTEXT_LENGTH=32768 \
|
|
437
|
+
-v ollama:/root/.ollama \
|
|
438
|
+
-p 11434:11434 \
|
|
439
|
+
--name ollama \
|
|
440
|
+
ollama/ollama
|
|
441
|
+
|
|
442
|
+
# Verify configuration
|
|
443
|
+
docker exec -it ollama ollama run gpt-oss:20b
|
|
444
|
+
# In the Ollama prompt, type: /show parameters
|
|
445
|
+
# Should show num_ctx much larger than default 4096
|
|
446
|
+
|
|
447
|
+
# Use with PatchPal
|
|
448
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
**Verifying Context Window Size:**
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
# Check your Ollama container configuration
|
|
455
|
+
docker inspect ollama | grep OLLAMA_CONTEXT_LENGTH
|
|
456
|
+
|
|
457
|
+
# Or run a model and check parameters
|
|
458
|
+
docker exec -it ollama ollama run gpt-oss:20b
|
|
459
|
+
>>> /show parameters
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
**Recommended Models for Tool Calling:**
|
|
463
|
+
|
|
464
|
+
- `gpt-oss:20b` - OpenAI's open-source model, excellent tool calling
|
|
465
|
+
- `qwen3:32b` - Qwen3 model with good agentic capabilities
|
|
466
|
+
- `qwen3-coder` - Specialized for coding tasks
|
|
467
|
+
|
|
468
|
+
**Performance Note:**
|
|
469
|
+
|
|
470
|
+
While Ollama now works with proper configuration, vLLM is still recommended for production use due to:
|
|
471
|
+
- 3-10x faster inference
|
|
472
|
+
- More robust tool calling implementation
|
|
473
|
+
- Better memory management
|
|
405
474
|
|
|
406
475
|
**Examples:**
|
|
407
476
|
|
|
408
477
|
```bash
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
patchpal --model
|
|
478
|
+
# Ollama (works with proper configuration)
|
|
479
|
+
export OLLAMA_CONTEXT_LENGTH=32768
|
|
480
|
+
patchpal --model ollama_chat/qwen3:32b
|
|
481
|
+
patchpal --model ollama_chat/gpt-oss:20b
|
|
482
|
+
|
|
483
|
+
# vLLM (recommended for production)
|
|
484
|
+
patchpal --model hosted_vllm/openai/gpt-oss-20b
|
|
412
485
|
```
|
|
413
486
|
|
|
414
487
|
### Air-Gapped and Offline Environments
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|