aleph-rlm 0.6.0__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.
aleph/__init__.py ADDED
@@ -0,0 +1,49 @@
1
+ """Aleph Framework - Recursive Language Models (RLMs) for unbounded context.
2
+
3
+ Aleph lets an LLM *programmatically interact* with context stored as a variable
4
+ inside a sandboxed Python REPL, enabling scalable reasoning over large inputs.
5
+
6
+ Exports:
7
+ - Aleph: main class
8
+ - create_aleph: factory
9
+ - AlephConfig: configuration dataclass
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ from .core import Aleph
15
+ from .config import AlephConfig, create_aleph
16
+ from .types import (
17
+ ContentFormat,
18
+ ContextType,
19
+ ContextMetadata,
20
+ ContextCollection,
21
+ ExecutionResult,
22
+ SubQueryResult,
23
+ ActionType,
24
+ ParsedAction,
25
+ TrajectoryStep,
26
+ AlephResponse,
27
+ Budget,
28
+ BudgetStatus,
29
+ )
30
+
31
+ __all__ = [
32
+ "Aleph",
33
+ "AlephConfig",
34
+ "create_aleph",
35
+ "ContentFormat",
36
+ "ContextType",
37
+ "ContextMetadata",
38
+ "ContextCollection",
39
+ "ExecutionResult",
40
+ "SubQueryResult",
41
+ "ActionType",
42
+ "ParsedAction",
43
+ "TrajectoryStep",
44
+ "AlephResponse",
45
+ "Budget",
46
+ "BudgetStatus",
47
+ ]
48
+
49
+ __version__ = "0.6.0"
@@ -0,0 +1,6 @@
1
+ """Caching utilities."""
2
+
3
+ from .base import Cache
4
+ from .memory import MemoryCache
5
+
6
+ __all__ = ["Cache", "MemoryCache"]
aleph/cache/base.py ADDED
@@ -0,0 +1,20 @@
1
+ """Cache protocol."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Protocol, TypeVar
6
+
7
+ T = TypeVar("T")
8
+
9
+
10
+ class Cache(Protocol[T]):
11
+ """Simple cache interface."""
12
+
13
+ def get(self, key: str) -> T | None:
14
+ ...
15
+
16
+ def set(self, key: str, value: T) -> None:
17
+ ...
18
+
19
+ def clear(self) -> None:
20
+ ...
aleph/cache/memory.py ADDED
@@ -0,0 +1,27 @@
1
+ """In-memory cache."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass, field
6
+ from typing import Generic, TypeVar
7
+
8
+ T = TypeVar("T")
9
+
10
+
11
+ @dataclass(slots=True)
12
+ class MemoryCache(Generic[T]):
13
+ """Very small, process-local cache.
14
+
15
+ This is primarily used to memoize repeated sub_query calls.
16
+ """
17
+
18
+ _store: dict[str, T] = field(default_factory=dict)
19
+
20
+ def get(self, key: str) -> T | None:
21
+ return self._store.get(key)
22
+
23
+ def set(self, key: str, value: T) -> None:
24
+ self._store[key] = value
25
+
26
+ def clear(self) -> None:
27
+ self._store.clear()