Cookbook recipes to get up and running with Spice.ai quickly 🚀
Works with v2.0+
Spice provides persistent memory capabilities for language models, enabling them to retain key information from conversations across sessions. This feature supports building more context-aware and intelligent applications by maintaining memory continuity.
Ensure the following before starting:
llm-memory:
.env:
SPICE_OPENAI_API_KEYStep 1. Run Spice runtime
Step 3. Start a chat session
Step 4. Interact with the model
Press Ctrl-C to exit the chat.
Step 5. Check stored memories
Then:
Output:
Step 6. Re-run spice chat and ask "Who am I?"
Then:
Note (Spice
v2.0+): Tool-invocation endpoints (/v1/tools/*) require an authentication provider to be configured on the runtime. Withoutruntime.auththese routes return401 Unauthorized. To call them, add an API-key provider tospicepod.yml:and restart Spice, then pass the key as an
x-api-keyheader (shown below). The:rwsuffix makes the key read-write, whichstore_memoryrequires. Restarting clears the memories stored earlier, sincellm_memoryis held in memory. Enablingruntime.authapplies to all endpoints, so the earlierspice chatstep then also needs credentials (spice chat --api-key <key>). See the api_key recipe (opens in a new tab) for the full flow.
Step 1. Store a memory directly
Step 2. Load stored memories
Output: