hanzo 0.3.28__py3-none-any.whl → 0.3.29__py3-none-any.whl
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.
- hanzo/__init__.py +1 -1
- hanzo/interactive/enhanced_repl.py +19 -2
- hanzo/tools/detector.py +42 -15
- {hanzo-0.3.28.dist-info → hanzo-0.3.29.dist-info}/METADATA +1 -1
- {hanzo-0.3.28.dist-info → hanzo-0.3.29.dist-info}/RECORD +7 -7
- {hanzo-0.3.28.dist-info → hanzo-0.3.29.dist-info}/WHEEL +0 -0
- {hanzo-0.3.28.dist-info → hanzo-0.3.29.dist-info}/entry_points.txt +0 -0
hanzo/__init__.py
CHANGED
|
@@ -645,8 +645,25 @@ class EnhancedHanzoREPL:
|
|
|
645
645
|
if success:
|
|
646
646
|
self.console.print(output)
|
|
647
647
|
else:
|
|
648
|
-
#
|
|
649
|
-
self.console.print(f"[
|
|
648
|
+
# Show error and try fallback
|
|
649
|
+
self.console.print(f"[red]Error: {output}[/red]")
|
|
650
|
+
|
|
651
|
+
# Try to find next available tool
|
|
652
|
+
if self.tool_detector and self.tool_detector.detected_tools:
|
|
653
|
+
for fallback_tool in self.tool_detector.detected_tools:
|
|
654
|
+
if fallback_tool != self.current_tool:
|
|
655
|
+
self.console.print(f"[yellow]Trying {fallback_tool.display_name}...[/yellow]")
|
|
656
|
+
success, output = self.tool_detector.execute_with_tool(fallback_tool, message)
|
|
657
|
+
if success:
|
|
658
|
+
self.console.print(output)
|
|
659
|
+
# Suggest switching to working tool
|
|
660
|
+
self.console.print(f"\n[dim]Tip: Switch to {fallback_tool.display_name} with /model {fallback_tool.name}[/dim]")
|
|
661
|
+
return
|
|
662
|
+
else:
|
|
663
|
+
self.console.print(f"[red]{fallback_tool.display_name} also failed[/red]")
|
|
664
|
+
|
|
665
|
+
# Final fallback to cloud model
|
|
666
|
+
self.console.print(f"[yellow]Falling back to cloud model...[/yellow]")
|
|
650
667
|
await self.execute_command("ask", f"--cloud --model gpt-3.5-turbo {message}")
|
|
651
668
|
else:
|
|
652
669
|
# Use regular model through hanzo ask
|
hanzo/tools/detector.py
CHANGED
|
@@ -170,22 +170,46 @@ class ToolDetector:
|
|
|
170
170
|
try:
|
|
171
171
|
response = httpx.get(tool.api_endpoint, timeout=1.0)
|
|
172
172
|
if response.status_code == 200:
|
|
173
|
-
|
|
174
|
-
tool.version = "Running"
|
|
175
|
-
|
|
176
|
-
# Special handling for Hanzo services
|
|
173
|
+
# For Hanzo Node, verify it can actually handle chat completions
|
|
177
174
|
if tool.name == "hanzod":
|
|
178
|
-
# Check if models are loaded
|
|
179
175
|
try:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
176
|
+
# Check if the chat completions endpoint works
|
|
177
|
+
test_response = httpx.post(
|
|
178
|
+
"http://localhost:8000/v1/chat/completions",
|
|
179
|
+
json={
|
|
180
|
+
"messages": [{"role": "user", "content": "test"}],
|
|
181
|
+
"model": "test",
|
|
182
|
+
"max_tokens": 1
|
|
183
|
+
},
|
|
184
|
+
timeout=2.0
|
|
185
|
+
)
|
|
186
|
+
# Only mark as detected if we get a valid response or specific error
|
|
187
|
+
# 404 means the endpoint doesn't exist
|
|
188
|
+
if test_response.status_code == 404:
|
|
189
|
+
return False
|
|
190
|
+
|
|
191
|
+
tool.detected = True
|
|
192
|
+
tool.version = "Running (Local AI)"
|
|
193
|
+
|
|
194
|
+
# Try to get model info
|
|
195
|
+
try:
|
|
196
|
+
models_response = httpx.get("http://localhost:8000/v1/models", timeout=1.0)
|
|
197
|
+
if models_response.status_code == 200:
|
|
198
|
+
models = models_response.json().get("data", [])
|
|
199
|
+
if models:
|
|
200
|
+
tool.version = f"Running ({len(models)} models)"
|
|
201
|
+
except:
|
|
202
|
+
pass
|
|
203
|
+
|
|
204
|
+
return True
|
|
185
205
|
except:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
206
|
+
# If chat endpoint doesn't work, node isn't useful
|
|
207
|
+
return False
|
|
208
|
+
else:
|
|
209
|
+
# For other services, just check health endpoint
|
|
210
|
+
tool.detected = True
|
|
211
|
+
tool.version = "Running"
|
|
212
|
+
return True
|
|
189
213
|
except:
|
|
190
214
|
pass
|
|
191
215
|
|
|
@@ -318,12 +342,13 @@ class ToolDetector:
|
|
|
318
342
|
try:
|
|
319
343
|
# Special handling for Hanzo services
|
|
320
344
|
if tool.name == "hanzod":
|
|
321
|
-
# Use the local API directly
|
|
345
|
+
# Use the local API directly with correct endpoint
|
|
322
346
|
try:
|
|
323
347
|
response = httpx.post(
|
|
324
|
-
"http://localhost:8000/chat/completions",
|
|
348
|
+
"http://localhost:8000/v1/chat/completions",
|
|
325
349
|
json={
|
|
326
350
|
"messages": [{"role": "user", "content": prompt}],
|
|
351
|
+
"model": "default", # Use default model
|
|
327
352
|
"stream": False
|
|
328
353
|
},
|
|
329
354
|
timeout=30.0
|
|
@@ -331,6 +356,8 @@ class ToolDetector:
|
|
|
331
356
|
if response.status_code == 200:
|
|
332
357
|
result = response.json()
|
|
333
358
|
return True, result.get("choices", [{}])[0].get("message", {}).get("content", "")
|
|
359
|
+
else:
|
|
360
|
+
return False, f"Hanzo Node returned {response.status_code}: {response.text}"
|
|
334
361
|
except Exception as e:
|
|
335
362
|
return False, f"Hanzo Node error: {e}"
|
|
336
363
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hanzo
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.29
|
|
4
4
|
Summary: Hanzo AI - Complete AI Infrastructure Platform with CLI, Router, MCP, and Agent Runtime
|
|
5
5
|
Project-URL: Homepage, https://hanzo.ai
|
|
6
6
|
Project-URL: Repository, https://github.com/hanzoai/python-sdk
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
hanzo/__init__.py,sha256=
|
|
1
|
+
hanzo/__init__.py,sha256=UijC5dH9CJe4QLC_IgQEkfv59evBzIHDNeuOUnfjIRg,185
|
|
2
2
|
hanzo/__main__.py,sha256=F3Vz0Ty3bdAj_8oxyETMIqxlmNRnJOAFB1XPxbyfouI,105
|
|
3
3
|
hanzo/base_agent.py,sha256=ojPaSgFETYl7iARWnNpg8eyAt7sg8eKhn9xZThyvxRA,15324
|
|
4
4
|
hanzo/batch_orchestrator.py,sha256=vn6n5i9gTfZ4DtowFDd5iWgYKjgNTioIomkffKbipSM,35827
|
|
@@ -27,13 +27,13 @@ hanzo/commands/router.py,sha256=kB8snUM82cFk3znjFvs3jOJGqv5giKn8DiTkdbXnWYU,5332
|
|
|
27
27
|
hanzo/commands/tools.py,sha256=fG27wRweVmaFJowBpmwp5PgkRUtIF8bIlu_hGWr69Ss,10393
|
|
28
28
|
hanzo/interactive/__init__.py,sha256=ENHkGOqu-JYI05lqoOKDczJGl96oq6nM476EPhflAbI,74
|
|
29
29
|
hanzo/interactive/dashboard.py,sha256=XB5H_PMlReriCip-wW9iuUiJQOAtSATFG8EyhhFhItU,3842
|
|
30
|
-
hanzo/interactive/enhanced_repl.py,sha256=
|
|
30
|
+
hanzo/interactive/enhanced_repl.py,sha256=8tA7ch_DpHq_M1ZHx7_bYgTqxhyq4ORH9fcGCCGajGo,35325
|
|
31
31
|
hanzo/interactive/model_selector.py,sha256=4HcXvr8AI8Y5IttMH7Dhb8M0vqzP5y3S5kQrQmopYuw,5519
|
|
32
32
|
hanzo/interactive/repl.py,sha256=PXpRw1Cfqdqy1pQsKLqz9AwKJBFZ_Y758MpDlJIb9ao,6938
|
|
33
33
|
hanzo/interactive/todo_manager.py,sha256=tKsmfN4snILLkgwnjQcStP4CxYfNCXS5_pvQfmxkIjw,14640
|
|
34
34
|
hanzo/router/__init__.py,sha256=_cRG9nHC_wwq17iVYZSUNBYiJDdByfLDVEuIQn5-ePM,978
|
|
35
35
|
hanzo/tools/__init__.py,sha256=SsgmDvw5rO--NF4vKL9tV3O4WCNEl9aAIuqyTGSZ4RQ,122
|
|
36
|
-
hanzo/tools/detector.py,sha256
|
|
36
|
+
hanzo/tools/detector.py,sha256=-qPqOWF5C5YEpLsNnEnyggicdjhI8cUhsJWT49fwkkY,15664
|
|
37
37
|
hanzo/ui/__init__.py,sha256=Ea22ereOm5Y0DDfyonA6qsO9Qkzofzd1CUE-VGW2lqw,241
|
|
38
38
|
hanzo/ui/inline_startup.py,sha256=7Y5dwqzt-L1J0F9peyqJ8XZgjHSua2nkItDTrLlBnhU,4265
|
|
39
39
|
hanzo/ui/startup.py,sha256=s7gP1QleQEIoCS1K0XBY7d6aufnwhicRLZDL7ej8ZZY,12235
|
|
@@ -41,7 +41,7 @@ hanzo/utils/__init__.py,sha256=5RRwKI852vp8smr4xCRgeKfn7dLEnHbdXGfVYTZ5jDQ,69
|
|
|
41
41
|
hanzo/utils/config.py,sha256=FD_LoBpcoF5dgJ7WL4o6LDp2pdOy8kS-dJ6iRO2GcGM,4728
|
|
42
42
|
hanzo/utils/net_check.py,sha256=YFbJ65SzfDYHkHLZe3n51VhId1VI3zhyx8p6BM-l6jE,3017
|
|
43
43
|
hanzo/utils/output.py,sha256=W0j3psF07vJiX4s02gbN4zYWfbKNsb8TSIoagBSf5vA,2704
|
|
44
|
-
hanzo-0.3.
|
|
45
|
-
hanzo-0.3.
|
|
46
|
-
hanzo-0.3.
|
|
47
|
-
hanzo-0.3.
|
|
44
|
+
hanzo-0.3.29.dist-info/METADATA,sha256=Z4-d35SChxL0tnUE6TKgRZPoDVL42EiCQJcfyDJ6SA4,6061
|
|
45
|
+
hanzo-0.3.29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
46
|
+
hanzo-0.3.29.dist-info/entry_points.txt,sha256=pQLPMdqOXU_2BfTcMDhkqTCDNk_H6ApvYuSaWcuQOOw,171
|
|
47
|
+
hanzo-0.3.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|