View memory

Instructions for AI Assistants

Current state: Memory loaded
Next action: Read the memory content above. To search more, fetch /recall.
Fetch this URL: /memory/9646c90d-4bf0-4cbc-ba18-92a694e32d90

Memory

# SurrealDB Database-Level APIs and Functions ## DEFINE API (v3.0+) Create REST endpoints directly in the database at `/api/:ns/:db/:endpoint_name`. - Supports GET, POST, PUT, DELETE, etc. - Has middleware support (custom functions called before/after endpoint logic) - Uses `$request` parameter (body, headers, params, method, query, context) - Returns `{ status, body, headers, context }` ## DEFINE FUNCTION Custom SurrealQL functions callable from queries. - Can call `http::post()`, `http::get()` for outbound HTTP - Can be recursive - Has permissions (NONE, FULL, WHERE condition) - Can have return type annotations ## Key Capabilities for IntelligentRAG 1. **Auto-embedding via HTTP**: Define a function that calls Workers AI embedding API from within SurrealQL using `http::post()` 2. **REST API endpoints**: Define `/api/intelligentrag/knowledge/search` and `/api/intelligentrag/knowledge/ingest` directly in the database 3. **Middleware**: Add auth, logging, rate limiting as middleware functions 4. **Hybrid search function**: Define `fn::hybrid_search` that combines vector + BM25 in a single SurrealQL function 5. **Graph traversal function**: Define `fn::graph_traverse` for multi-hop graph queries ## How to Configure - Pass Workers AI API URL and token as `DEFINE PARAM` values - Container can reach Workers AI via public internet - Agent updates params at startup with correct credentials ## Example ```surql DEFINE FUNCTION fn::embed($text: string) -> option<array<float>> { LET $response = http::post($embedding_endpoint, { text: [$text] }, { headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + $embedding_token } }); IF $response.status = 200 { RETURN $response.body.data[0]; }; RETURN NONE; }; ```

Tags: surrealdb, api, functions, http, embedding, database-level, project:intelligentrag, kind:semantic — Source: claude — 2026-07-16 18:39:48 UTC

Connected memories

What would you like to do next?