65 lines
1.6 KiB
Python
65 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Quick test of curator with simple input"""
|
|
import json
|
|
import requests
|
|
|
|
# Load prompt from v1
|
|
with open('/root/.openclaw/workspace/.projects/true-recall-v1/curator-prompt.md') as f:
|
|
prompt = f.read()
|
|
|
|
# Test with a simple conversation
|
|
test_turns = [
|
|
{
|
|
'turn': 1,
|
|
'user_id': 'rob',
|
|
'user': 'I want to switch from Redis to Qdrant for memory storage',
|
|
'ai': 'Got it - Qdrant is a good choice for vector storage.',
|
|
'conversation_id': 'test123',
|
|
'timestamp': '2026-02-23T10:00:00',
|
|
'date': '2026-02-23'
|
|
},
|
|
{
|
|
'turn': 2,
|
|
'user_id': 'rob',
|
|
'user': 'Yes, and I want the curator to read from Qdrant directly',
|
|
'ai': 'Makes sense - we can modify the curator to query Qdrant instead of Redis.',
|
|
'conversation_id': 'test123',
|
|
'timestamp': '2026-02-23T10:01:00',
|
|
'date': '2026-02-23'
|
|
}
|
|
]
|
|
|
|
conversation_json = json.dumps(test_turns, indent=2)
|
|
|
|
prompt_text = f"""## Input Conversation
|
|
|
|
```json
|
|
{conversation_json}
|
|
```
|
|
|
|
## Output
|
|
"""
|
|
|
|
response = requests.post(
|
|
'http://10.0.0.10:11434/api/generate',
|
|
json={
|
|
'model': 'qwen3:4b-instruct',
|
|
'system': prompt,
|
|
'prompt': prompt_text,
|
|
'stream': False,
|
|
'options': {'temperature': 0.1, 'num_predict': 2000}
|
|
},
|
|
timeout=120
|
|
)
|
|
|
|
result = response.json()
|
|
output = result.get('response', '').strip()
|
|
print('=== RAW OUTPUT ===')
|
|
print(output[:2000])
|
|
print()
|
|
print('=== PARSED ===')
|
|
# Try to extract JSON
|
|
if '```json' in output:
|
|
parsed = output.split('```json')[1].split('```')[0].strip()
|
|
print(parsed)
|