mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 19:02:16 +00:00
Complete implementation across six development phases (v0.1 through v1.0): - Core: Registry system, config, event bus, types (Phase 0) - Intelligence + Inference: Model routing, Ollama/vLLM/llama.cpp/Cloud engines (Phase 1) - Memory: SQLite/FAISS/ColBERT/BM25/Hybrid backends, document ingest, context injection (Phase 2) - Agents: Simple/Orchestrator/Custom/OpenClaw agents, tool system (Phase 3) - Learning: HeuristicRouter, reward functions, GRPO stub, telemetry aggregation (Phase 4) - SDK: Jarvis class, OpenClaw protocol/transport, benchmarks, Docker deployment (Phase 5) 520 tests passing, 8 skipped (optional deps). Ruff lint clean. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""Tests for the think tool."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from openjarvis.tools.think import ThinkTool
|
|
|
|
|
|
class TestThinkTool:
|
|
def test_spec(self):
|
|
tool = ThinkTool()
|
|
assert tool.spec.name == "think"
|
|
assert tool.spec.category == "reasoning"
|
|
assert tool.spec.cost_estimate == 0.0
|
|
|
|
def test_echoes_thought(self):
|
|
tool = ThinkTool()
|
|
result = tool.execute(thought="Let me think step by step...")
|
|
assert result.success is True
|
|
assert result.content == "Let me think step by step..."
|
|
|
|
def test_empty_thought(self):
|
|
tool = ThinkTool()
|
|
result = tool.execute(thought="")
|
|
assert result.success is True
|
|
assert result.content == ""
|
|
|
|
def test_no_thought(self):
|
|
tool = ThinkTool()
|
|
result = tool.execute()
|
|
assert result.success is True
|
|
assert result.content == ""
|
|
|
|
def test_openai_function(self):
|
|
tool = ThinkTool()
|
|
fn = tool.to_openai_function()
|
|
assert fn["function"]["name"] == "think"
|
|
assert "thought" in fn["function"]["parameters"]["properties"]
|