diff --git a/docs/configuration/qa-research.md b/docs/configuration/qa-research.md index 4d874652..7a0e9fc5 100644 --- a/docs/configuration/qa-research.md +++ b/docs/configuration/qa-research.md @@ -72,13 +72,11 @@ rlm: provider: anthropic name: claude-sonnet-4-20250514 code_timeout: 60.0 # Max seconds for code execution - max_tool_calls: 20 # Max execute_code calls per question max_output_chars: 50000 # Truncate output after this many chars ``` - **model**: LLM configuration (see [Providers](providers.md#model-settings)) - **code_timeout**: Maximum seconds for each code execution (default: 60) -- **max_tool_calls**: Maximum number of code execution calls per question (default: 20) - **max_output_chars**: Truncate code output after this many characters (default: 50000) See [RLM Agent](../rlm.md) for usage details. diff --git a/docs/rlm.md b/docs/rlm.md index 24b6a2d5..f4aff8e0 100644 --- a/docs/rlm.md +++ b/docs/rlm.md @@ -192,7 +192,6 @@ rlm: provider: anthropic name: claude-sonnet-4-20250514 code_timeout: 60.0 # Max seconds for code execution - max_tool_calls: 20 # Max execute_code calls per question max_output_chars: 50000 # Truncate output after this many chars docker_image: "ghcr.io/ggozad/haiku.rag-slim:latest" # Container image docker_memory_limit: "512m" # Container memory limit diff --git a/haiku_rag_slim/haiku/rag/agents/rlm/agent.py b/haiku_rag_slim/haiku/rag/agents/rlm/agent.py index 37fb065e..1b009811 100644 --- a/haiku_rag_slim/haiku/rag/agents/rlm/agent.py +++ b/haiku_rag_slim/haiku/rag/agents/rlm/agent.py @@ -55,8 +55,6 @@ def create_rlm_agent(config: AppConfig) -> Agent[RLMDeps, RLMResult]: success=result.success, ) - ctx.deps.context.code_executions.append(execution) - return execution return agent diff --git a/haiku_rag_slim/haiku/rag/agents/rlm/dependencies.py b/haiku_rag_slim/haiku/rag/agents/rlm/dependencies.py index 1644b291..11ccaee6 100644 --- a/haiku_rag_slim/haiku/rag/agents/rlm/dependencies.py +++ b/haiku_rag_slim/haiku/rag/agents/rlm/dependencies.py @@ -1,11 +1,10 @@ from dataclasses import dataclass, field from typing import TYPE_CHECKING -from haiku.rag.store.models import Document, SearchResult +from haiku.rag.store.models import Document if TYPE_CHECKING: from haiku.rag.agents.rlm.docker_sandbox import DockerSandbox - from haiku.rag.agents.rlm.models import CodeExecution @dataclass @@ -14,8 +13,6 @@ class RLMContext: documents: list[Document] | None = None filter: str | None = None - search_results: list[SearchResult] = field(default_factory=list) - code_executions: "list[CodeExecution]" = field(default_factory=list) @dataclass diff --git a/haiku_rag_slim/haiku/rag/agents/rlm/prompts.py b/haiku_rag_slim/haiku/rag/agents/rlm/prompts.py index e8f41551..10991517 100644 --- a/haiku_rag_slim/haiku/rag/agents/rlm/prompts.py +++ b/haiku_rag_slim/haiku/rag/agents/rlm/prompts.py @@ -50,7 +50,7 @@ You can import any Python standard library module. 1. **Explore First**: Start by listing documents or searching to understand what's available. Document names may differ from filenames (e.g., "tbmed593.pdf" might be stored as "TB MED 593" or similar). 2. **If get_document returns None**: Use `list_documents()` to see actual document titles, or `search()` to find relevant content. 3. **Iterative Refinement**: Run code, examine results, adjust your approach based on what you find. -4. **Use print() Liberally**: The REPL captures stdout - print intermediate results to see what you're working with. +4. **Use print() Liberally**: The sandbox captures stdout - print intermediate results to see what you're working with. 5. **Aggregate with Code**: For counting, averaging, or comparing across documents, write loops and use collections. 6. **Use llm() for Classification/Extraction**: When you need to classify, summarize, or extract structured data from content you already have, use llm(). 7. **Cite Your Sources**: Track which documents/chunks informed your answer for citation. diff --git a/haiku_rag_slim/haiku/rag/agents/rlm/runner.py b/haiku_rag_slim/haiku/rag/agents/rlm/runner.py index b2a4c758..97e0047a 100644 --- a/haiku_rag_slim/haiku/rag/agents/rlm/runner.py +++ b/haiku_rag_slim/haiku/rag/agents/rlm/runner.py @@ -23,7 +23,6 @@ def build_namespace( return await client.search(query, limit=limit, filter=context.filter) results = run_async(_search()) - context.search_results.extend(results) return [ { "chunk_id": r.chunk_id, diff --git a/haiku_rag_slim/haiku/rag/config/models.py b/haiku_rag_slim/haiku/rag/config/models.py index 544680c2..755073e1 100644 --- a/haiku_rag_slim/haiku/rag/config/models.py +++ b/haiku_rag_slim/haiku/rag/config/models.py @@ -104,7 +104,6 @@ class RLMConfig(BaseModel): ) code_timeout: float = 60.0 max_output_chars: int = 50_000 - max_tool_calls: int = 20 docker_image: str = "ghcr.io/ggozad/haiku.rag-slim:latest" docker_memory_limit: str = "512m" diff --git a/haiku_rag_slim/pyproject.toml b/haiku_rag_slim/pyproject.toml index b98f1b9c..fda1e988 100644 --- a/haiku_rag_slim/pyproject.toml +++ b/haiku_rag_slim/pyproject.toml @@ -22,7 +22,6 @@ classifiers = [ ] dependencies = [ - "docker>=7.1.0", "docling-core==2.60.1", "httpx>=0.28.1", "jsonpatch>=1.33", diff --git a/tests/agents/rlm/test_sandbox.py b/tests/agents/rlm/test_sandbox.py index bcdc669c..50223b5b 100644 --- a/tests/agents/rlm/test_sandbox.py +++ b/tests/agents/rlm/test_sandbox.py @@ -17,11 +17,10 @@ def vcr_cassette_dir(): def is_docker_available() -> bool: """Check if Docker daemon is available.""" try: - import docker + import subprocess - client = docker.from_env() - client.ping() - return True + result = subprocess.run(["docker", "info"], capture_output=True, timeout=5) + return result.returncode == 0 except Exception: return False diff --git a/uv.lock b/uv.lock index bf87e61c..d8f88265 100644 --- a/uv.lock +++ b/uv.lock @@ -739,20 +739,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ba/5a/18ad964b0086c6e62e2e7500f7edc89e3faa45033c71c1893d34eed2b2de/dnspython-2.8.0-py3-none-any.whl", hash = "sha256:01d9bbc4a2d76bf0db7c1f729812ded6d912bd318d3b1cf81d30c0f845dbf3af", size = 331094, upload-time = "2025-09-07T18:57:58.071Z" }, ] -[[package]] -name = "docker" -version = "7.1.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "pywin32", marker = "sys_platform == 'win32'" }, - { name = "requests" }, - { name = "urllib3" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/91/9b/4a2ea29aeba62471211598dac5d96825bb49348fa07e906ea930394a83ce/docker-7.1.0.tar.gz", hash = "sha256:ad8c70e6e3f8926cb8a92619b832b4ea5299e2831c14284663184e200546fa6c", size = 117834, upload-time = "2024-05-23T11:13:57.216Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e3/26/57c6fb270950d476074c087527a558ccb6f4436657314bfb6cdf484114c4/docker-7.1.0-py3-none-any.whl", hash = "sha256:c96b93b7f0a746f9e77d325bcfb87422a3d8bd4f03136ae8a85b37f1898d5fc0", size = 147774, upload-time = "2024-05-23T11:13:55.01Z" }, -] - [[package]] name = "docling" version = "2.69.1" @@ -1380,7 +1366,6 @@ name = "haiku-rag-slim" version = "0.28.0" source = { editable = "haiku_rag_slim" } dependencies = [ - { name = "docker" }, { name = "docling-core" }, { name = "httpx" }, { name = "jsonpatch" }, @@ -1442,7 +1427,6 @@ zeroentropy = [ [package.metadata] requires-dist = [ { name = "cohere", marker = "extra == 'cohere'", specifier = ">=5.20.1" }, - { name = "docker", specifier = ">=7.1.0" }, { name = "docling", marker = "extra == 'docling'", specifier = "==2.69.1" }, { name = "docling-core", specifier = "==2.60.1" }, { name = "httpx", specifier = ">=0.28.1" },