This commit is contained in:
Yiorgis Gozadinos 2026-02-06 11:33:35 +01:00
parent f8ec511250
commit 720f697a48
No known key found for this signature in database
10 changed files with 5 additions and 33 deletions

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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,

View file

@ -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"

View file

@ -22,7 +22,6 @@ classifiers = [
]
dependencies = [
"docker>=7.1.0",
"docling-core==2.60.1",
"httpx>=0.28.1",
"jsonpatch>=1.33",

View file

@ -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

16
uv.lock
View file

@ -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" },