Rag Client
Interfaces
Interfaces
RAGClientConfig
Configuration for RAG client
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
surrealdbUrl | string | Yes | SurrealDB WebSocket URL (e.g., 'ws://localhost:8000/rpc') |
surrealdbUser | string | Yes | SurrealDB username |
surrealdbPass | string | Yes | SurrealDB password |
surrealdbNamespace | string | Yes | SurrealDB namespace |
surrealdbDatabase | string | Yes | SurrealDB database |
ollamaUrl | string | Yes | Ollama server URL (e.g., 'http://localhost:11434') |
embeddingModel | string | Yes | Embedding model to use (e.g., 'nomic-embed-text') |
SearchResult
Search result from vector similarity search
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Record ID in SurrealDB |
collection | string | Yes | Source collection name |
docId | string | Yes | Original document ID |
content | string | Yes | Text content |
metadata | Record<string, unknown> | Yes | Document metadata |
score | number | Yes | Similarity score (0-1, higher is better) |
ContextResult
Context building result with sources and token estimate
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
context | string | Yes | Formatted context string ready for LLM consumption |
sources | SearchResult[] | Yes | Source documents used to build context |
tokenEstimate | number | Yes | Estimated token count (rough approximation) |
RecallResult
Memory recall result
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
memories | SearchResult[] | Yes | Array of recalled memories |
SearchOptions
Options for semantic search
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query text |
workspaceId | string | undefined | No | Filter by workspace ID |
collections | string[] | undefined | No | Filter by specific collections |
includeMemories | boolean | undefined | No | Include memories collection in search |
limit | number | undefined | No | Maximum number of results |
minScore | number | undefined | No | Minimum similarity score (0-1) |
ContextOptions
Options for context building
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
topic | string | Yes | Topic or question to build context for |
workspaceId | string | undefined | No | Filter by workspace ID |
includeMemories | boolean | undefined | No | Include memories in context |
maxTokens | number | undefined | No | Maximum token count for context |
minScore | number | undefined | No | Minimum similarity score |
RecallOptions
Options for memory recall
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
topic | string | Yes | Topic to recall memories about |
namespace | string | Yes | Namespace filter |
sessionId | string | undefined | No | Session ID filter |
limit | number | undefined | No | Maximum number of memories |
minScore | number | undefined | No | Minimum similarity score |
FindSimilarOptions
Options for finding similar documents
Properties:
| Property | Type | Required | Description |
|---|---|---|---|
collection | string | Yes | Source collection |
docId | string | Yes | Source document ID |
limit | number | undefined | No | Maximum number of results |
minScore | number | undefined | No | Minimum similarity score |