Text Generation
Transformers
edge-impulse
rag
retrieval-augmented-generation
faiss
qwen
documentation
tinyml
edge-ai
Instructions to use edgeimpulse/edgeimpulse-docs-rag with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use edgeimpulse/edgeimpulse-docs-rag with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="edgeimpulse/edgeimpulse-docs-rag")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("edgeimpulse/edgeimpulse-docs-rag", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use edgeimpulse/edgeimpulse-docs-rag with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "edgeimpulse/edgeimpulse-docs-rag" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "edgeimpulse/edgeimpulse-docs-rag", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/edgeimpulse/edgeimpulse-docs-rag
- SGLang
How to use edgeimpulse/edgeimpulse-docs-rag with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "edgeimpulse/edgeimpulse-docs-rag" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "edgeimpulse/edgeimpulse-docs-rag", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "edgeimpulse/edgeimpulse-docs-rag" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "edgeimpulse/edgeimpulse-docs-rag", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use edgeimpulse/edgeimpulse-docs-rag with Docker Model Runner:
docker model run hf.co/edgeimpulse/edgeimpulse-docs-rag
| """Minimal HTTP server for the Edge Impulse docs RAG assistant. | |
| python serve.py --host 0.0.0.0 --port 8000 | |
| POST /ask {"question": "...", "k": 4} -> {"answer": "..."} | |
| GET /health -> {"ok": true} | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| from flask import Flask, jsonify, request | |
| from rag import DEFAULT_API_BASE, DEFAULT_INDEX_DIR, DEFAULT_MODEL, ask | |
| def create_app(index_dir: Path, api_base: str, model: str, k: int) -> Flask: | |
| app = Flask(__name__) | |
| def health(): | |
| return jsonify({"ok": True}) | |
| def ask_route(): | |
| payload = request.get_json(silent=True) or {} | |
| question = str(payload.get("question", "")).strip() | |
| if not question: | |
| return jsonify({"error": "question is required"}), 400 | |
| try: | |
| answer = ask( | |
| question, | |
| index_dir=index_dir, | |
| k=int(payload.get("k", k)), | |
| max_new_tokens=int(payload.get("max_new_tokens", 320)), | |
| api_base=api_base, | |
| model=model, | |
| ) | |
| return jsonify({"answer": answer}) | |
| except Exception as exc: # noqa: BLE001 - surface the error to the client | |
| return jsonify({"error": str(exc)}), 500 | |
| return app | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description="Serve the Edge Impulse docs RAG assistant.") | |
| parser.add_argument("--host", default="127.0.0.1") | |
| parser.add_argument("--port", type=int, default=8000) | |
| parser.add_argument("--index-dir", type=Path, default=DEFAULT_INDEX_DIR) | |
| parser.add_argument("--api-base", default=DEFAULT_API_BASE) | |
| parser.add_argument("--model", default=DEFAULT_MODEL) | |
| parser.add_argument("--k", type=int, default=4) | |
| args = parser.parse_args() | |
| app = create_app(args.index_dir, args.api_base, args.model, args.k) | |
| app.run(host=args.host, port=args.port) | |
| if __name__ == "__main__": | |
| main() | |