Download docs/INFERENCE.md from LoveLogicAI/freestream: direct link, hf CLI and curl.
- Browser
- Download file 2.67 kB
-
https://huggingface.co/datasets/LoveLogicAI/freestream/resolve/main/docs/INFERENCE.md
- Command line
-
hf download hf://datasets/LoveLogicAI/freestream/docs/INFERENCE.md
-
curl -L -o INFERENCE.md https://huggingface.co/datasets/LoveLogicAI/freestream/resolve/main/docs/INFERENCE.md
INFERENCE β sovereign LLM execution
Hugging Chat / the HF router is fine for prototyping, but the critical path is an endpoint you control that the harness hits programmatically. Two paths, both OpenAI-compatible β no code changes, only env:
export FREESTREAM_AGENT=llm
export FREESTREAM_LLM_BASE_URL=<endpoint>/v1
export FREESTREAM_LLM_API_KEY=<key or "local">
export FREESTREAM_LLM_MODEL=local # llama.cpp/MLX serve any model name
export FREESTREAM_CHARACTER_CARD=identity/characters/vera-steel.json
A. Dedicated HF Space (shipped β freestream-llm)
Docker Space running llama.cpp server (Qwen2.5-7B-Instruct Q4_K_M, auto-downloaded on boot). Endpoint:
https://lovelogicai-freestream-llm.hf.space/v1/chat/completions
Setup once: Space settings β upgrade hardware to CPU Upgrade (8 vCPU) β
add the LLM_API_KEY secret β optionally enable persistent storage (/data)
so the 4.7GB model survives restarts. Pause the Space when idle β a 24/7
CPU-upgrade Space bills continuously, and sovereignty shouldn't mean a
standing bill.
Measured throughput will be reported in docs/LATENCY.md after the probe job.
B. Mac mini (recommended primary β your hardware, no standing bill)
cd freestream
./scripts/serve_local_llm.sh mlx # MLX, fastest on Apple Silicon
# or: ./scripts/serve_local_llm.sh cpp
export FREESTREAM_LLM_BASE_URL=http://localhost:8080/v1
export FREESTREAM_LLM_MODEL=local
export FREESTREAM_LLM_API_KEY=local
python tests/e2e_roleplay.py # the harness hits localhost programmatically
- MLX:
pip install mlx-lm, servesmlx-community/Qwen2.5-7B-Instruct-4bitviapython -m mlx_lm.server(OpenAI-compatible). - llama.cpp:
brew install llama.cpp,llama-server -hf <gguf>β same API.
The 4s assistant-profile win condition stays a cloud-burst feature (router/GPU); sovereign local inference is the roleplay/agentic profile (gates 20s/30s) β measure your mini's tok/s and record it in LATENCY.md.
Harness wiring (both paths)
Every e2e harness reads the same env; nothing is hardcoded to the router.
load_agent accepts keyless local endpoints (localhost / *.local) without
falling back to the rule stub β set FREESTREAM_LLM_API_KEY=local for hosts
that ignore auth headers.
Endpoint contract
CharacterAgent needs exactly one route: POST {base}/chat/completions with
{"model", "messages", "max_tokens", "temperature"} β
choices[0].message.content. Any OpenAI-compatible server satisfies it
(llama-server, mlx_lm.server, vLLM, Ollama with base=/v1).