Complete API Reference

Full class and method documentation — Python stdlib & Node.js ESM

PromptTemplate

MethodSignatureReturnsDescription
PromptTemplate.from_template(template: str) → PromptTemplatePromptTemplateConstructs a template from a string with {variable} placeholders.
.format(**kwargs) → strstrRenders the template with the provided keyword arguments.
.invoke(input: dict) → strstrRunnable Protocol entry point. Equivalent to .format(**input).

OpenAICompatibleChat

MethodSignatureReturnsDescription
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) → strstrBlocking 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

MethodSignatureReturnsDescription
StringOutputParser.invoke(text: str) → strstrStrips 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

MethodSignatureReturnsDescription
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() → CompiledGraphCompiledGraphReturns a runnable compiled graph that exposes .invoke(state) and .stream(state).

create_react_agent

ParameterTypeDefaultDescription
llmOpenAICompatibleChatrequiredThe language model used to decide tool calls and generate the final answer.
toolslist[Callable]requiredList of Python callables. Each must have a docstring; the docstring is the tool description sent to the LLM.
tool_policyToolPolicyToolPolicy(default='deny')Governs which tools the agent may execute. 'deny' requires explicit allowlisting; 'allow' permits all.

SQLiteVectorStore

MethodSignatureReturnsDescription
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

FunctionReturnsDescription
get_battery_status()dictReturns {"level": int, "plugged": bool, "temperature": float} from the Android Termux battery API.
get_temperature()floatReads current CPU/SoC temperature in °C via /sys/class/thermal/.
get_gps()dictReturns {"latitude": float, "longitude": float, "altitude": float} from the Termux GPS API.
vibrate(duration_ms: int = 500)NoneTriggers the device vibrator for the specified duration via the Termux API.
send_notification(title: str, content: str)NonePosts an Android system notification via termux-notification.