Complete API Reference
Full class and method documentation — Python stdlib & Node.js ESM
PromptTemplate
| Method | Signature | Returns | Description |
PromptTemplate.from_template | (template: str) → PromptTemplate | PromptTemplate | Constructs a template from a string with {variable} placeholders. |
.format | (**kwargs) → str | str | Renders the template with the provided keyword arguments. |
.invoke | (input: dict) → str | str | Runnable Protocol entry point. Equivalent to .format(**input). |
OpenAICompatibleChat
| Method | Signature | Returns | Description |
OpenAICompatibleChat.__init__ | (base_url: str, model: str, temperature: float = 0.7, max_tokens: int = 512, timeout: float = 60.0) | — | Connects to any OpenAI-compatible endpoint (llama-server, LM Studio, vLLM). |
.invoke | (messages: list[dict] | str) → str | str | Blocking call. Accepts a string prompt or a list of {"role", "content"} dicts. |
.stream | (messages: list[dict] | str) → Iterator[str] | Iterator[str] | Yields token chunks as they arrive over SSE. Use with for chunk in llm.stream(...). |
StringOutputParser
| Method | Signature | Returns | Description |
StringOutputParser.invoke | (text: str) → str | str | Strips leading/trailing whitespace from the LLM output string. |
.stream | (chunks: Iterator[str]) → Iterator[str] | Iterator[str] | Pass-through streaming parser; yields each chunk unchanged. |
StateGraph
| Method | Signature | Returns | Description |
StateGraph.__init__ | (state_schema: type | dict) | — | Initializes a directed state machine. state_schema is a dataclass type or plain dict schema. |
.add_node | (name: str, fn: Callable[[dict], dict]) | — | Registers a node. fn receives the current state dict and returns an updated dict. |
.add_edge | (source: str, target: str) | — | Adds an unconditional directed edge between two nodes. |
.add_conditional_edges | (source: str, condition: Callable[[dict], str], mapping: dict[str, str]) | — | Routes from source based on the string returned by condition(state). |
.set_entry_point | (node: str) | — | Designates the node that receives the initial invoke call. |
.compile | () → CompiledGraph | CompiledGraph | Returns a runnable compiled graph that exposes .invoke(state) and .stream(state). |
create_react_agent
| Parameter | Type | Default | Description |
llm | OpenAICompatibleChat | required | The language model used to decide tool calls and generate the final answer. |
tools | list[Callable] | required | List of Python callables. Each must have a docstring; the docstring is the tool description sent to the LLM. |
tool_policy | ToolPolicy | ToolPolicy(default='deny') | Governs which tools the agent may execute. 'deny' requires explicit allowlisting; 'allow' permits all. |
SQLiteVectorStore
| Method | Signature | Returns | Description |
SQLiteVectorStore.__init__ | (db_path: str = ':memory:', dim: int = 384) | — | Opens or creates a SQLite vector store. Use ':memory:' for ephemeral in-process storage. |
.add_texts | (texts: list[str], embeddings: list[list[float]]) | — | Inserts text + embedding pairs. embeddings must be length-dim float lists. |
.similarity_search | (query_embedding: list[float], k: int = 5) → list[dict] | list[{"text": str, "score": float}] | Returns the top-k nearest texts by cosine similarity, computed in pure Python. |
Hardware Actuation Tools
| Function | Returns | Description |
get_battery_status() | dict | Returns {"level": int, "plugged": bool, "temperature": float} from the Android Termux battery API. |
get_temperature() | float | Reads current CPU/SoC temperature in °C via /sys/class/thermal/. |
get_gps() | dict | Returns {"latitude": float, "longitude": float, "altitude": float} from the Termux GPS API. |
vibrate(duration_ms: int = 500) | None | Triggers the device vibrator for the specified duration via the Termux API. |
send_notification(title: str, content: str) | None | Posts an Android system notification via termux-notification. |