POST /v1/capture puts an item into memory and POST /v1/chat recalls it. Add end_user_id (any opaque string) to keep a separate memory under that id; leave it off for one shared memory. Either way the memory is created on first use.
Store#
Request
curl -X POST https://api.fryri.com/v1/capture \
-H "Authorization: Bearer $FRYRI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Prefers window seats. Allergic to peanuts.", "title": "Preferences", "end_user_id": "user-42"}'Response
{
"ok": true,
"status": "created",
"dedup": false,
"detail": "Captured.",
"id": "file_JiXarRkc1lGPkOHv",
"file_id": "file_JiXarRkc1lGPkOHv",
"reject_code": null,
"retryable": null,
"source_ref": null
}Recall#
Request
curl -X POST https://api.fryri.com/v1/chat \
-H "Authorization: Bearer $FRYRI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"question": "What should I know before booking this trip?", "end_user_id": "user-42"}'Response
{
"reply": "I couldn't find any trip details in your library, no itinerary, dates, or destination came up when I searched. Which trip are you looking at? ... request a window seat when you pick flights, and flag your peanut allergy with the airline ...",
"artifacts": [],
"sources": [
{
"kind": "file",
"title": "Preferences.txt",
"snippet": "1\tPrefers window seats. Allergic to peanuts.",
"file_id": "file_JiXarRkc1lGPkOHv"
}
],
"tokens_used": 75126,
"run_id": "e612f85aa62f4630b8df49fdfc483d88"
}The answer is grounded in that user's library only, with sources. GET /v1/search and the other data calls take the same field.
In Python:
import os
import requests
API = "https://api.fryri.com/v1"
H = {"Authorization": f"Bearer {os.environ['FRYRI_API_KEY']}"}
# Store
requests.post(f"{API}/capture", headers=H, json={
"text": "Prefers window seats. Allergic to peanuts.",
"end_user_id": "user-42",
})
# Recall
answer = requests.post(f"{API}/chat", headers=H, json={
"question": "What should I know before booking this trip?",
"end_user_id": "user-42",
}).json()
print(answer["reply"])Manage your users#
GET /v1/end-users lists every end user under your key. DELETE /v1/end-users/{id} permanently erases one user's library, which is your deletion story when a user leaves.
Spend always lands on your account, not theirs.