1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > EAI Documentation -- EmbeddedOS</ title >
7+ < link rel ="stylesheet " href ="../style.css ">
8+ </ head >
9+ < body >
10+
11+ < nav class ="site-nav ">
12+ < span class ="brand "> EmbeddedOS</ span >
13+ < div class ="nav-links ">
14+ < a href ="../index.html "> Home</ a >
15+ < a href ="index.html " class ="active "> Docs</ a >
16+ < a href ="../getting-started.html "> Getting Started</ a >
17+ < a href ="https://github.com/embeddedos-org " target ="_blank "> GitHub</ a >
18+ </ div >
19+ </ nav >
20+
21+ < div class ="doc-layout ">
22+ < aside class ="doc-sidebar ">
23+ < h4 > Getting Started</ h4 >
24+ < a href ="../getting-started.html "> Quick Start Guide</ a >
25+ < h4 > Core</ h4 >
26+ < a href ="eos.html "> EoS</ a >
27+ < a href ="eboot.html "> eBoot</ a >
28+ < a href ="ebuild.html "> ebuild</ a >
29+ < h4 > Middleware</ h4 >
30+ < a href ="eipc.html "> EIPC</ a >
31+ < a href ="eai.html " class ="active "> EAI</ a >
32+ < a href ="eni.html "> ENI</ a >
33+ < h4 > Tools</ h4 >
34+ < a href ="eosuite.html "> EoSuite</ a >
35+ < a href ="eosim.html "> EoSim</ a >
36+ </ aside >
37+
38+ < main class ="doc-main ">
39+ < h1 > EAI -- Embedded AI Layer</ h1 >
40+ < p > On-device AI inference engine with agentic tool-use capabilities, persistent memory, and an HTTP server (Ebot). Supports 8 quantized LLM models from 80 MB to 6 GB RAM, with automatic model selection based on hardware constraints.</ p >
41+ < p > < a href ="https://github.com/embeddedos-org/eai " target ="_blank "> GitHub Repository</ a > </ p >
42+
43+ < h2 > Getting Started</ h2 >
44+ < pre > < code > git clone https://github.com/embeddedos-org/eai.git
45+ cd eai
46+ cmake -B build && cmake --build build</ code > </ pre >
47+
48+ < h2 > API Reference -- Configuration</ h2 >
49+ < ul class ="api-list ">
50+ < li > < code > eai_config_parse(path, cfg)</ code > -- Parse a YAML/JSON configuration file into an EAI config struct</ li >
51+ < li > < code > eai_config_free(cfg)</ code > -- Free memory allocated for a parsed configuration</ li >
52+ </ ul >
53+
54+ < h2 > API Reference -- Tools</ h2 >
55+ < ul class ="api-list ">
56+ < li > < code > eai_tool_register(name, fn, desc)</ code > -- Register a callable tool with the agent runtime</ li >
57+ < li > < code > eai_tool_exec(name, args, result)</ code > -- Execute a registered tool by name with arguments</ li >
58+ < li > < code > eai_tool_list(buf, len)</ code > -- List all registered tools into a buffer</ li >
59+ </ ul >
60+
61+ < h2 > API Reference -- Agent</ h2 >
62+ < ul class ="api-list ">
63+ < li > < code > eai_agent_init(cfg)</ code > -- Initialize the AI agent with model, tools, and memory configuration</ li >
64+ < li > < code > eai_agent_step(input, output)</ code > -- Run one agent step: process input, optionally call tools, produce output</ li >
65+ < li > < code > eai_agent_reset()</ code > -- Reset the agent state and clear conversation history</ li >
66+ </ ul >
67+
68+ < h2 > API Reference -- Memory</ h2 >
69+ < ul class ="api-list ">
70+ < li > < code > eai_memory_init(capacity)</ code > -- Initialize the persistent memory store with a maximum capacity</ li >
71+ < li > < code > eai_memory_store(key, value)</ code > -- Store a key-value pair in persistent memory</ li >
72+ < li > < code > eai_memory_recall(key, buf, len)</ code > -- Recall a value from persistent memory by key</ li >
73+ < li > < code > eai_memory_clear()</ code > -- Clear all entries from persistent memory</ li >
74+ </ ul >
75+
76+ < h2 > API Reference -- Models</ h2 >
77+ < ul class ="api-list ">
78+ < li > < code > eai_model_find_best_fit(ram_mb, storage_mb)</ code > -- Select the best model that fits within RAM and storage constraints</ li >
79+ < li > < code > eai_model_get_catalog(buf, count)</ code > -- Get the full catalog of available models</ li >
80+ </ ul >
81+
82+ < h2 > API Reference -- Runtime</ h2 >
83+ < ul class ="api-list ">
84+ < li > < code > eai_runtime_init(model_path)</ code > -- Initialize the inference runtime with a GGUF model file</ li >
85+ < li > < code > eai_runtime_infer(prompt, output, max_tokens)</ code > -- Run inference on a prompt and generate up to max_tokens</ li >
86+ </ ul >
87+
88+ < h2 > Supported LLM Models</ h2 >
89+ < table >
90+ < thead > < tr > < th > Model</ th > < th > RAM</ th > < th > Storage</ th > < th > Tier</ th > < th > Hardware</ th > </ tr > </ thead >
91+ < tbody >
92+ < tr > < td > TinyLlama 1.1B Q2_K</ td > < td > 80 MB</ td > < td > 400 MB</ td > < td > Micro</ td > < td > STM32H7, ESP32-S3</ td > </ tr >
93+ < tr > < td > SmolLM 360M Q5</ td > < td > 100 MB</ td > < td > 250 MB</ td > < td > Tiny</ td > < td > RPi3, nRF5340</ td > </ tr >
94+ < tr > < td > Qwen2 0.5B Q4</ td > < td > 120 MB</ td > < td > 350 MB</ td > < td > Tiny</ td > < td > RPi3, AM64x</ td > </ tr >
95+ < tr > < td > Phi-2 Q4</ td > < td > 600 MB</ td > < td > 1.6 GB</ td > < td > Small</ td > < td > RPi4, i.MX8M</ td > </ tr >
96+ < tr > < td > Phi-3-mini Q4 (default)</ td > < td > 2 GB</ td > < td > 2.3 GB</ td > < td > Small</ td > < td > RPi4 8 GB</ td > </ tr >
97+ < tr > < td > Llama 3.2 3B Q4</ td > < td > 2.5 GB</ td > < td > 2 GB</ td > < td > Medium</ td > < td > RPi5, Jetson</ td > </ tr >
98+ < tr > < td > Mistral 7B Q3_K</ td > < td > 3.5 GB</ td > < td > 3 GB</ td > < td > Medium</ td > < td > x86 edge</ td > </ tr >
99+ < tr > < td > Llama 3.2 8B Q4</ td > < td > 6 GB</ td > < td > 4.7 GB</ td > < td > Large</ td > < td > x86, Orin</ td > </ tr >
100+ </ tbody >
101+ </ table >
102+
103+ < h2 > Ebot Server Endpoints</ h2 >
104+ < p > The Ebot HTTP server exposes a REST API for interacting with the AI agent over the network:</ p >
105+ < table >
106+ < thead > < tr > < th > Method</ th > < th > Endpoint</ th > < th > Description</ th > </ tr > </ thead >
107+ < tbody >
108+ < tr > < td > POST</ td > < td > /v1/chat</ td > < td > Chat with conversation history</ td > </ tr >
109+ < tr > < td > POST</ td > < td > /v1/complete</ td > < td > Single-shot text completion</ td > </ tr >
110+ < tr > < td > GET</ td > < td > /v1/tools</ td > < td > List all registered tools</ td > </ tr >
111+ < tr > < td > GET</ td > < td > /v1/models</ td > < td > List available models</ td > </ tr >
112+ < tr > < td > GET</ td > < td > /v1/status</ td > < td > Server statistics and health check</ td > </ tr >
113+ </ tbody >
114+ </ table >
115+
116+ < h2 > Usage Example</ h2 >
117+ < pre > < code > // Initialize EAI with automatic model selection
118+ eai_config cfg;
119+ eai_config_parse("eai.yml", &cfg);
120+ eai_agent_init(&cfg);
121+
122+ // Register a custom tool
123+ eai_tool_register("read_sensor", sensor_read_fn, "Read a sensor value");
124+
125+ // Run an agent step
126+ char output[4096];
127+ eai_agent_step("What is the current temperature?", output);
128+
129+ // Query the Ebot server
130+ // curl -X POST http://localhost:8420/v1/chat \
131+ // -d '{"messages":[{"role":"user","content":"Hello"}]}'</ code > </ pre >
132+
133+ </ main >
134+ </ div >
135+
136+ </ body >
137+ </ html >
0 commit comments