Documentation Index Fetch the complete documentation index at: https://simplellmfunc.cn/llms.txt
Use this file to discover all available pages before exploring further.
Examples
All examples are in the examples/ directory. Each is self-contained and runnable.
Quick Start
Example What It Shows basic_usage.pyMinimal @llm_function call with typed output template_params_example.pyDynamic docstring templates with _template_params
Example What It Shows tool_usage_example.py@tool decorator, multi-tool agentmultimodal_tool_example.pyTools returning ImgPath/ImgUrl agent_as_tool_example.pyNesting one agent as a tool for another
Chat & Streaming
Example What It Shows streaming_example.pyConsuming LLMChunkArriveEvent for real-time output event_stream_example.pyFull event stream consumption pattern abort_example.pyAbortSignal for cancellation
PyRepl & Runtime
Example What It Shows pyrepl_example.pyPersistent REPL: variables, streaming, reset selfref_example.pyruntime.selfref.context.* primitives
Full Agent
Example What It Shows tui_general_agent_example.pyComplete coding agent with TUI, PyRepl, FileToolset, SelfRef, fork, compaction
This is the reference implementation for building a production agent. See Harness Patterns for an architectural walkthrough.
Running Examples
# Clone the repo
git clone https://github.com/NiJingzhe/SimpleLLMFunc.git
cd SimpleLLMFunc
# Install dependencies
poetry install
# Copy and configure provider.json
cp examples/provider_template.json examples/provider.json
# Edit examples/provider.json with your API keys
# Run any example
poetry run python examples/basic_usage.py
poetry run python examples/tui_general_agent_example.py
Building Your Own
Start from one of these patterns:
One-shot Function @llm_function — typed input/output, no state
Chat Agent @llm_chat + tools — multi-turn with ReAct loop
Full Agent PyRepl + SelfRef + FileToolset + TUI — production-grade