--- license: apache-2.0 base_model: edgeimpulse/edgeimpulse-docs-qwen-0.5b pipeline_tag: text-generation library_name: transformers tags: - edge-impulse - rag - retrieval-augmented-generation - faiss - qwen - api - documentation - tinyml - edge-ai --- # Edge Impulse API Docs — RAG Assistant A focused retrieval-augmented assistant for the **Edge Impulse API reference** (Studio API, ingestion API, remote-management API). Same runtime as the full [`edgeimpulse/edgeimpulse-docs-rag`](https://huggingface.co/edgeimpulse/edgeimpulse-docs-rag) assistant, but the knowledge base is restricted to the API documentation so retrieval stays tightly on-topic for integration and automation questions. - **Scope:** Edge Impulse API reference only (`apis`, `apis_studio`, `apis_ingestion`, `apis_remote-management`). - **Retrieval:** FAISS (inner-product) over `data/index`, embedded with `sentence-transformers/all-MiniLM-L6-v2` (384-dim). - **Generation:** [`edgeimpulse/edgeimpulse-docs-qwen-0.5b`](https://huggingface.co/edgeimpulse/edgeimpulse-docs-qwen-0.5b) via any OpenAI-compatible endpoint (llama.cpp or Ollama). This repo ships only the prebuilt (API-scoped) index and the inference code — no raw corpus and no index-building pipeline. ## Contents | File | Purpose | | --- | --- | | `data/index/edge_impulse_docs.faiss` | FAISS index of the API-reference chunks | | `data/index/chunks.pkl` | Chunk text + source metadata (aligned to the index) | | `data/index/metadata.json` | Embedding model + index parameters (`scope: edge-impulse-api-reference`) | | `rag.py` | Retrieval + grounded generation (CLI + importable) | | `serve.py` | Minimal Flask HTTP API (`POST /ask`) | | `requirements.txt` | Runtime dependencies | ## Quickstart ```bash pip install -r requirements.txt hf download edgeimpulse/edgeimpulse-api-docs-rag --local-dir edgeimpulse-api-docs-rag cd edgeimpulse-api-docs-rag # start the generator (llama.cpp) hf download edgeimpulse/edgeimpulse-docs-qwen-0.5b qwen-edgeai-q4_k_m.gguf --local-dir . llama-server -m qwen-edgeai-q4_k_m.gguf -c 4096 --port 8080 --jinja # ask an API question python rag.py "How do I create an Edge Impulse API key?" python rag.py "How do I upload data with the ingestion API?" --no-generate ``` Serve over HTTP: ```bash python serve.py --host 0.0.0.0 --port 8000 curl -s localhost:8000/ask -H 'content-type: application/json' \ -d '{"question": "How do I classify an image via the API?"}' ``` ## Configuration `rag.py` honours `RAG_INDEX_DIR`, `RAG_API_BASE`, and `RAG_MODEL` (see the full assistant's card for details). For Ollama: ```bash export RAG_API_BASE=http://127.0.0.1:11434/v1 export RAG_MODEL=hf.co/edgeimpulse/edgeimpulse-docs-qwen-0.5b ``` ## Notes Because the corpus is intentionally narrow, questions outside the API reference may return "not in context" — that is by design. For general docs questions (devices, deployment targets, ML concepts) use the full [`edgeimpulse/edgeimpulse-docs-rag`](https://huggingface.co/edgeimpulse/edgeimpulse-docs-rag) assistant instead. ## License Apache-2.0. Documentation content belongs to Edge Impulse.