dakera

package module
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 15 Imported by: 0

README

Dakera Go SDK

CI Go Reference Go

Official Go client for Dakera — a high-performance vector database for AI agent memory.

Installation

go get github.com/dakera-ai/dakera-go

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    dakera "github.com/dakera-ai/dakera-go"
)

func main() {
    // Connect to Dakera
    client := dakera.NewClient("http://localhost:3000")
    ctx := context.Background()

    // Upsert vectors
    _, err := client.Upsert(ctx, "my-namespace", []dakera.VectorInput{
        {ID: "vec1", Values: []float32{0.1, 0.2, 0.3}, Metadata: map[string]interface{}{"label": "a"}},
        {ID: "vec2", Values: []float32{0.4, 0.5, 0.6}, Metadata: map[string]interface{}{"label": "b"}},
    })
    if err != nil {
        log.Fatal(err)
    }

    // Query similar vectors
    results, err := client.Query(ctx, "my-namespace", []float32{0.1, 0.2, 0.3}, &dakera.QueryOptions{
        TopK: 10,
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, result := range results.Results {
        fmt.Printf("%s: %f\n", result.ID, result.Score)
    }
}

Features

  • Idiomatic Go: Proper error handling, context support, and Go conventions
  • Vector Operations: Upsert, query, delete, fetch vectors
  • Full-Text Search: Index documents and perform BM25 search
  • Hybrid Search: Combine vector and text search with configurable weights
  • Namespace Management: Create, list, delete namespaces
  • Agent Memory: Store, recall, and manage memories for AI agents
  • Metadata Filtering: Filter queries by metadata fields with helper functions
  • Automatic Retries: Built-in retry logic with exponential backoff
  • Error Handling: Typed errors for different error scenarios

Usage Examples

Vector Operations
package main

import (
    "context"
    "log"

    dakera "github.com/dakera-ai/dakera-go"
)

func main() {
    client := dakera.NewClientWithOptions(dakera.ClientOptions{
        BaseURL:    "http://localhost:3000",
        APIKey:     "your-api-key", // optional
        MaxRetries: 5,
    })
    ctx := context.Background()

    // Upsert vectors
    _, err := client.Upsert(ctx, "my-namespace", []dakera.VectorInput{
        {ID: "vec1", Values: []float32{0.1, 0.2, 0.3}, Metadata: map[string]interface{}{"category": "A"}},
        {ID: "vec2", Values: []float32{0.4, 0.5, 0.6}, Metadata: map[string]interface{}{"category": "B"}},
    })
    if err != nil {
        log.Fatal(err)
    }

    // Query with metadata filter
    results, err := client.Query(ctx, "my-namespace", []float32{0.1, 0.2, 0.3}, &dakera.QueryOptions{
        TopK: 5,
        Filter: map[string]interface{}{
            "category": dakera.Eq("A"),
        },
        IncludeMetadata: true,
    })
    if err != nil {
        log.Fatal(err)
    }

    // Batch query
    batchResults, err := client.BatchQuery(ctx, "my-namespace", []dakera.BatchQuerySpec{
        {Vector: []float32{0.1, 0.2, 0.3}, TopK: 5},
        {Vector: []float32{0.4, 0.5, 0.6}, TopK: 3},
    })
    if err != nil {
        log.Fatal(err)
    }

    // Fetch vectors by ID
    vectors, err := client.Fetch(ctx, "my-namespace", []string{"vec1", "vec2"}, nil)
    if err != nil {
        log.Fatal(err)
    }

    // Delete vectors
    _, err = client.Delete(ctx, "my-namespace", dakera.DeleteOptions{
        IDs: []string{"vec1", "vec2"},
    })
    if err != nil {
        log.Fatal(err)
    }

    // Delete by filter
    _, err = client.Delete(ctx, "my-namespace", dakera.DeleteOptions{
        Filter: map[string]interface{}{
            "category": dakera.Eq("obsolete"),
        },
    })
    if err != nil {
        log.Fatal(err)
    }
}
// Index documents
_, err := client.IndexDocuments(ctx, "my-namespace", []dakera.DocumentInput{
    {ID: "doc1", Content: "Machine learning is transforming industries"},
    {ID: "doc2", Content: "Vector databases enable semantic search"},
})
if err != nil {
    log.Fatal(err)
}

// Search
results, err := client.FulltextSearch(ctx, "my-namespace", "machine learning", nil)
if err != nil {
    log.Fatal(err)
}

for _, result := range results {
    fmt.Printf("%s: %f\n", result.ID, result.Score)
}
// Combine vector and text search
results, err := client.HybridSearch(
    ctx,
    "my-namespace",
    []float32{0.1, 0.2, 0.3}, // Query vector
    "machine learning",       // Text query
    &dakera.HybridSearchOptions{
        TopK:  10,
        Alpha: 0.7, // 0 = pure vector, 1 = pure text
    },
)
if err != nil {
    log.Fatal(err)
}

for _, result := range results {
    fmt.Printf("%s: score=%f, vector=%f, text=%f\n",
        result.ID, result.Score, result.VectorScore, result.TextScore)
}
Namespace Management
// Create namespace
info, err := client.CreateNamespace(ctx, "embeddings", &dakera.CreateNamespaceOptions{
    Dimensions: 384,
    IndexType:  "hnsw",
})
if err != nil {
    log.Fatal(err)
}

// List namespaces
namespaces, err := client.ListNamespaces(ctx)
if err != nil {
    log.Fatal(err)
}
for _, ns := range namespaces {
    fmt.Printf("%s: %d vectors\n", ns.Name, ns.VectorCount)
}

// Get namespace info
info, err = client.GetNamespace(ctx, "embeddings")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Dimensions: %d, Index: %s\n", info.Dimensions, info.IndexType)

// Delete namespace
err = client.DeleteNamespace(ctx, "old-namespace")
if err != nil {
    log.Fatal(err)
}
Metadata Filtering

Dakera supports rich metadata filtering with helper functions:

// Equality
filter1 := map[string]interface{}{
    "status": dakera.Eq("active"),
}

// Comparison
filter2 := map[string]interface{}{
    "price": dakera.Gt(100),
}

// In list
filter3 := map[string]interface{}{
    "category": dakera.In("electronics", "books"),
}

// Logical operators
filter4 := dakera.And(
    map[string]interface{}{"status": dakera.Eq("active")},
    map[string]interface{}{"price": dakera.Lt(1000)},
)

results, err := client.Query(ctx, "products", queryVector, &dakera.QueryOptions{
    Filter: filter4,
    TopK:   20,
})
Error Handling
import (
    dakera "github.com/dakera-ai/dakera-go"
)

results, err := client.Query(ctx, "nonexistent", []float32{0.1, 0.2}, nil)
if err != nil {
    if dakera.IsNotFoundError(err) {
        fmt.Printf("Namespace not found: %v\n", err)
    } else if dakera.IsValidationError(err) {
        fmt.Printf("Invalid request: %v\n", err)
    } else if dakera.IsRateLimitError(err) {
        rateLimitErr := err.(*dakera.RateLimitError)
        fmt.Printf("Rate limited, retry after %d seconds\n", rateLimitErr.RetryAfter)
    } else if dakera.IsServerError(err) {
        fmt.Printf("Server error: %v\n", err)
    } else {
        fmt.Printf("Error: %v\n", err)
    }
}

Configuration

Option Type Default Description
BaseURL string required Dakera server URL
APIKey string "" API key for authentication
Timeout time.Duration 30s Request timeout
MaxRetries int 3 Max retries for failed requests
Headers map[string]string nil Additional HTTP headers

API Reference

Client
Vector Operations
  • Upsert(ctx, namespace, vectors) - Insert or update vectors
  • Query(ctx, namespace, vector, options) - Query similar vectors
  • Delete(ctx, namespace, options) - Delete vectors
  • Fetch(ctx, namespace, ids, options) - Fetch vectors by ID
  • BatchQuery(ctx, namespace, queries) - Execute multiple queries
Full-Text Operations
  • IndexDocuments(ctx, namespace, documents) - Index documents
  • FulltextSearch(ctx, namespace, query, options) - Text search
  • HybridSearch(ctx, namespace, vector, query, options) - Hybrid search
Namespace Operations
  • ListNamespaces(ctx) - List all namespaces
  • GetNamespace(ctx, namespace) - Get namespace info
  • CreateNamespace(ctx, namespace, options) - Create namespace
  • DeleteNamespace(ctx, namespace) - Delete namespace
Admin Operations
  • Health(ctx) - Check server health
  • GetIndexStats(ctx, namespace) - Get index statistics
  • Compact(ctx, namespace) - Trigger compaction
  • Flush(ctx, namespace) - Flush pending writes
Filter Helpers
  • Eq(value) - Equality filter
  • Ne(value) - Not equal filter
  • Gt(value) - Greater than filter
  • Gte(value) - Greater than or equal filter
  • Lt(value) - Less than filter
  • Lte(value) - Less than or equal filter
  • In(values...) - In list filter
  • Nin(values...) - Not in list filter
  • And(conditions...) - Logical AND
  • Or(conditions...) - Logical OR
Error Types
  • DakeraError - Base error type
  • ConnectionError - Connection failures
  • NotFoundError - Resource not found (404)
  • ValidationError - Invalid request (400)
  • RateLimitError - Rate limit exceeded (429)
  • ServerError - Server errors (5xx)
  • AuthenticationError - Auth failures (401)
  • TimeoutError - Request timeout
Error Checkers
  • IsNotFoundError(err) - Check if NotFoundError
  • IsValidationError(err) - Check if ValidationError
  • IsRateLimitError(err) - Check if RateLimitError
  • IsServerError(err) - Check if ServerError
  • IsAuthenticationError(err) - Check if AuthenticationError
  • IsTimeoutError(err) - Check if TimeoutError
  • IsConnectionError(err) - Check if ConnectionError

Requirements

  • Go 1.21 or later

Development

# Run tests
go test -v ./...

# Run tests with coverage
go test -cover ./...

# Format code
go fmt ./...

# Lint
golangci-lint run
Repository Description
dakera Core vector database engine (Rust)
dakera-py Python SDK
dakera-js TypeScript/JavaScript SDK
dakera-rs Rust SDK
dakera-cli Command-line interface
dakera-mcp MCP Server for AI agent memory
dakera-dashboard Admin dashboard (Leptos/WASM)
dakera-docs Documentation
dakera-deploy Deployment configs and Docker Compose

License

MIT License - see LICENSE for details.

Documentation

Overview

Package dakera provides a Go client for Dakera AI memory platform.

Example usage:

client := dakera.NewClient("http://localhost:3000")

// Upsert vectors
resp, err := client.Upsert(ctx, "my-namespace", []dakera.VectorInput{
    {ID: "vec1", Values: []float32{0.1, 0.2, 0.3}},
})

// Query similar vectors
results, err := client.Query(ctx, "my-namespace", []float32{0.1, 0.2, 0.3}, nil)

Package dakera provides a Go client for Dakera AI memory platform.

Index

Constants

View Source
const (
	OpEq  = "$eq"
	OpNe  = "$ne"
	OpGt  = "$gt"
	OpGte = "$gte"
	OpLt  = "$lt"
	OpLte = "$lte"
	OpIn  = "$in"
	OpNin = "$nin"
	OpAnd = "$and"
	OpOr  = "$or"
)

Filter operators for metadata filtering.

Variables

This section is empty.

Functions

func And

func And(conditions ...map[string]interface{}) map[string]interface{}

And creates a logical AND filter.

func Eq

func Eq(value interface{}) map[string]interface{}

Eq creates an equality filter.

func Gt

func Gt(value interface{}) map[string]interface{}

Gt creates a greater-than filter.

func Gte

func Gte(value interface{}) map[string]interface{}

Gte creates a greater-than-or-equal filter.

func In

func In(values ...interface{}) map[string]interface{}

In creates an "in list" filter.

func IsAuthenticationError

func IsAuthenticationError(err error) bool

IsAuthenticationError checks if an error is an AuthenticationError.

func IsAuthorizationError added in v0.6.1

func IsAuthorizationError(err error) bool

IsAuthorizationError checks if an error is an AuthorizationError.

func IsConnectionError

func IsConnectionError(err error) bool

IsConnectionError checks if an error is a ConnectionError.

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if an error is a NotFoundError.

func IsRateLimitError

func IsRateLimitError(err error) bool

IsRateLimitError checks if an error is a RateLimitError.

func IsServerError

func IsServerError(err error) bool

IsServerError checks if an error is a ServerError.

func IsTimeoutError

func IsTimeoutError(err error) bool

IsTimeoutError checks if an error is a TimeoutError.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError checks if an error is a ValidationError.

func Lt

func Lt(value interface{}) map[string]interface{}

Lt creates a less-than filter.

func Lte

func Lte(value interface{}) map[string]interface{}

Lte creates a less-than-or-equal filter.

func Ne

func Ne(value interface{}) map[string]interface{}

Ne creates a not-equal filter.

func Nin

func Nin(values ...interface{}) map[string]interface{}

Nin creates a "not in list" filter.

func Or

func Or(conditions ...map[string]interface{}) map[string]interface{}

Or creates a logical OR filter.

Types

type AgentMemoriesOptions

type AgentMemoriesOptions struct {
	MemoryType string `json:"memory_type,omitempty"`
	Limit      *int   `json:"limit,omitempty"`
}

AgentMemoriesOptions represents options for listing agent memories.

type AgentNetworkEdge added in v0.5.0

type AgentNetworkEdge struct {
	Source      string  `json:"source"`
	Target      string  `json:"target"`
	SourceAgent string  `json:"source_agent"`
	TargetAgent string  `json:"target_agent"`
	Similarity  float32 `json:"similarity"`
}

AgentNetworkEdge is a similarity edge between memories from two different agents.

type AgentNetworkInfo added in v0.5.0

type AgentNetworkInfo struct {
	AgentID       string  `json:"agent_id"`
	MemoryCount   int     `json:"memory_count"`
	AvgImportance float32 `json:"avg_importance"`
}

AgentNetworkInfo is summary information for one agent.

type AgentNetworkNode added in v0.5.0

type AgentNetworkNode struct {
	ID         string   `json:"id"`
	AgentID    string   `json:"agent_id"`
	Content    string   `json:"content"`
	Importance float32  `json:"importance"`
	Tags       []string `json:"tags"`
	MemoryType string   `json:"memory_type"`
	CreatedAt  int64    `json:"created_at"`
}

AgentNetworkNode is a memory node in the cross-agent network graph.

type AgentNetworkStats added in v0.5.0

type AgentNetworkStats struct {
	TotalAgents     int     `json:"total_agents"`
	TotalNodes      int     `json:"total_nodes"`
	TotalCrossEdges int     `json:"total_cross_edges"`
	Density         float32 `json:"density"`
}

AgentNetworkStats contains network-level statistics.

type AgentSessionsOptions

type AgentSessionsOptions struct {
	ActiveOnly *bool `json:"active_only,omitempty"`
	Limit      *int  `json:"limit,omitempty"`
}

AgentSessionsOptions represents options for listing agent sessions.

type AgentStats

type AgentStats struct {
	AgentID        string           `json:"agent_id"`
	TotalMemories  int64            `json:"total_memories"`
	MemoriesByType map[string]int64 `json:"memories_by_type"`
	TotalSessions  int64            `json:"total_sessions"`
	ActiveSessions int64            `json:"active_sessions"`
	AvgImportance  *float32         `json:"avg_importance,omitempty"`
	OldestMemoryAt string           `json:"oldest_memory_at,omitempty"`
	NewestMemoryAt string           `json:"newest_memory_at,omitempty"`
}

AgentStats represents detailed stats for an agent.

type AgentSummary

type AgentSummary struct {
	AgentID        string `json:"agent_id"`
	MemoryCount    int64  `json:"memory_count"`
	SessionCount   int64  `json:"session_count"`
	ActiveSessions int64  `json:"active_sessions"`
}

AgentSummary represents summary info for an agent.

type AggregationGroup

type AggregationGroup struct {
	Key     string                 `json:"key"`
	Count   int                    `json:"count"`
	Metrics map[string]interface{} `json:"metrics,omitempty"`
	TopHits []QueryResult          `json:"top_hits,omitempty"`
}

AggregationGroup represents a single aggregation group.

type AggregationRequest

type AggregationRequest struct {
	Vector    []float32              `json:"vector,omitempty"`
	GroupBy   string                 `json:"group_by,omitempty"`
	Metrics   []string               `json:"metrics,omitempty"`
	TopK      *int                   `json:"top_k,omitempty"`
	Filter    map[string]interface{} `json:"filter,omitempty"`
	TopGroups *int                   `json:"top_groups,omitempty"`
}

AggregationRequest represents an aggregation request with grouping.

type AggregationResponse

type AggregationResponse struct {
	Groups       []AggregationGroup `json:"groups"`
	TotalGroups  int                `json:"total_groups"`
	SearchTimeMs *int64             `json:"search_time_ms,omitempty"`
}

AggregationResponse represents the response from aggregation.

type AnalyticsOptions

type AnalyticsOptions struct {
	Period    string `json:"period,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

AnalyticsOptions represents options for analytics queries.

type AnalyticsOverview

type AnalyticsOverview struct {
	TotalQueries     uint64  `json:"total_queries"`
	AvgLatencyMs     float64 `json:"avg_latency_ms"`
	P95LatencyMs     float64 `json:"p95_latency_ms"`
	P99LatencyMs     float64 `json:"p99_latency_ms"`
	QueriesPerSecond float64 `json:"queries_per_second"`
	ErrorRate        float64 `json:"error_rate"`
	CacheHitRate     float64 `json:"cache_hit_rate"`
	StorageUsedBytes uint64  `json:"storage_used_bytes"`
	TotalVectors     uint64  `json:"total_vectors"`
	TotalNamespaces  uint64  `json:"total_namespaces"`
	UptimeSeconds    uint64  `json:"uptime_seconds"`
}

AnalyticsOverview represents analytics overview response.

type ApiKey

type ApiKey struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Key         string   `json:"key,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
	CreatedAt   string   `json:"created_at"`
	ExpiresAt   string   `json:"expires_at,omitempty"`
	Active      bool     `json:"active"`
}

ApiKey represents an API key.

type AuthenticationError

type AuthenticationError struct {
	DakeraError
}

AuthenticationError is raised when authentication fails.

func NewAuthenticationError

func NewAuthenticationError(message string, statusCode int, body interface{}, code ErrorCode) *AuthenticationError

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

type AuthorizationError added in v0.6.1

type AuthorizationError struct {
	DakeraError
}

AuthorizationError is raised when the server returns a 403 Forbidden response.

func NewAuthorizationError added in v0.6.1

func NewAuthorizationError(message string, statusCode int, code ErrorCode, body interface{}) *AuthorizationError

func (*AuthorizationError) Error added in v0.6.1

func (e *AuthorizationError) Error() string

type AutoPilotConfig added in v0.7.2

type AutoPilotConfig struct {
	Enabled                    bool    `json:"enabled"`
	DedupThreshold             float32 `json:"dedup_threshold"`
	DedupIntervalHours         uint64  `json:"dedup_interval_hours"`
	ConsolidationIntervalHours uint64  `json:"consolidation_interval_hours"`
}

AutoPilotConfig represents the AutoPilot configuration.

type AutoPilotConfigRequest added in v0.7.2

type AutoPilotConfigRequest struct {
	Enabled                    *bool    `json:"enabled,omitempty"`
	DedupThreshold             *float32 `json:"dedup_threshold,omitempty"`
	DedupIntervalHours         *uint64  `json:"dedup_interval_hours,omitempty"`
	ConsolidationIntervalHours *uint64  `json:"consolidation_interval_hours,omitempty"`
}

AutoPilotConfigRequest is the request for PUT /v1/admin/autopilot/config (PILOT-2). All fields are optional — nil means "keep current value".

type AutoPilotConfigResponse added in v0.7.2

type AutoPilotConfigResponse struct {
	Success bool            `json:"success"`
	Config  AutoPilotConfig `json:"config"`
	Message string          `json:"message"`
}

AutoPilotConfigResponse is returned by PUT /v1/admin/autopilot/config (PILOT-2).

type AutoPilotConsolidationResult added in v0.7.2

type AutoPilotConsolidationResult struct {
	NamespacesProcessed  int `json:"namespaces_processed"`
	MemoriesScanned      int `json:"memories_scanned"`
	ClustersMerged       int `json:"clusters_merged"`
	MemoriesConsolidated int `json:"memories_consolidated"`
}

AutoPilotConsolidationResult is the consolidation result from a manual trigger.

type AutoPilotDedupResult added in v0.7.2

type AutoPilotDedupResult struct {
	NamespacesProcessed int `json:"namespaces_processed"`
	MemoriesScanned     int `json:"memories_scanned"`
	DuplicatesRemoved   int `json:"duplicates_removed"`
}

AutoPilotDedupResult is the dedup result from a manual trigger.

type AutoPilotStatusResponse added in v0.7.2

type AutoPilotStatusResponse struct {
	Config              AutoPilotConfig              `json:"config"`
	LastDedupAt         *uint64                      `json:"last_dedup_at,omitempty"`
	LastConsolidationAt *uint64                      `json:"last_consolidation_at,omitempty"`
	LastDedup           *DedupResultSnapshot         `json:"last_dedup,omitempty"`
	LastConsolidation   *ConsolidationResultSnapshot `json:"last_consolidation,omitempty"`
	TotalDedupRemoved   uint64                       `json:"total_dedup_removed"`
	TotalConsolidated   uint64                       `json:"total_consolidated"`
}

AutoPilotStatusResponse is returned by GET /v1/admin/autopilot/status (PILOT-1).

type AutoPilotTriggerResponse added in v0.7.2

type AutoPilotTriggerResponse struct {
	Success       bool                          `json:"success"`
	Action        string                        `json:"action"`
	Dedup         *AutoPilotDedupResult         `json:"dedup,omitempty"`
	Consolidation *AutoPilotConsolidationResult `json:"consolidation,omitempty"`
	Message       string                        `json:"message"`
}

AutoPilotTriggerResponse is returned by POST /v1/admin/autopilot/trigger (PILOT-3).

type BackupInfo

type BackupInfo struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	SizeBytes   int64  `json:"size_bytes"`
	Status      string `json:"status"`
	IncludeData bool   `json:"include_data"`
}

BackupInfo represents backup information.

type BatchForgetRequest added in v0.7.0

type BatchForgetRequest struct {
	// AgentID is the agent whose memory namespace to purge from.
	AgentID string `json:"agent_id"`
	// Filter contains the filter predicates — at least one must be set (server safety guard).
	Filter BatchMemoryFilter `json:"filter"`
}

BatchForgetRequest is the request body for DELETE /v1/memories/forget/batch.

type BatchForgetResponse added in v0.7.0

type BatchForgetResponse struct {
	DeletedCount int `json:"deleted_count"`
}

BatchForgetResponse is the response from DELETE /v1/memories/forget/batch.

type BatchMemoryFilter added in v0.7.0

type BatchMemoryFilter struct {
	// Tags restricts to memories that carry all listed tags.
	Tags []string `json:"tags,omitempty"`
	// MinImportance is the minimum importance (inclusive).
	MinImportance *float32 `json:"min_importance,omitempty"`
	// MaxImportance is the maximum importance (inclusive).
	MaxImportance *float32 `json:"max_importance,omitempty"`
	// CreatedAfter restricts to memories created at or after this Unix timestamp (seconds).
	CreatedAfter *int64 `json:"created_after,omitempty"`
	// CreatedBefore restricts to memories created before or at this Unix timestamp (seconds).
	CreatedBefore *int64 `json:"created_before,omitempty"`
	// MemoryType restricts to a specific memory type (e.g. "episodic").
	MemoryType string `json:"memory_type,omitempty"`
	// SessionID restricts to memories from a specific session.
	SessionID string `json:"session_id,omitempty"`
}

BatchMemoryFilter holds filter predicates for batch memory operations (CE-2).

All fields are optional. For BatchForget at least one must be set (server-side safety guard).

type BatchQuerySpec

type BatchQuerySpec struct {
	Vector          []float32              `json:"vector"`
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeValues   bool                   `json:"include_values,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
}

BatchQuerySpec represents a single query in a batch query request.

type BatchRecallRequest added in v0.7.0

type BatchRecallRequest struct {
	// AgentID is the agent whose memory namespace to search.
	AgentID string `json:"agent_id"`
	// Filter contains the filter predicates to apply.
	Filter BatchMemoryFilter `json:"filter"`
	// Limit is the maximum number of results to return (default: 100).
	Limit int `json:"limit,omitempty"`
}

BatchRecallRequest is the request body for POST /v1/memories/recall/batch.

type BatchRecallResponse added in v0.7.0

type BatchRecallResponse struct {
	Memories []RecalledMemory `json:"memories"`
	// Total is the total memories in the agent namespace.
	Total int `json:"total"`
	// Filtered is the number of memories that passed the filter.
	Filtered int `json:"filtered"`
}

BatchRecallResponse is the response from POST /v1/memories/recall/batch.

type BatchTextQueryOptions

type BatchTextQueryOptions struct {
	TopK           int                    `json:"top_k,omitempty"`
	Filter         map[string]interface{} `json:"filter,omitempty"`
	IncludeVectors bool                   `json:"include_vectors,omitempty"`
	Model          EmbeddingModel         `json:"model,omitempty"`
}

BatchTextQueryOptions represents options for batch text query operations.

type BatchTextQueryResponse

type BatchTextQueryResponse struct {
	Results         [][]TextSearchResult `json:"results"`
	Model           EmbeddingModel       `json:"model"`
	EmbeddingTimeMs int64                `json:"embedding_time_ms"`
	SearchTimeMs    int64                `json:"search_time_ms"`
}

BatchTextQueryResponse represents the response from a batch text query operation.

type CacheStats

type CacheStats struct {
	TotalEntries int     `json:"total_entries"`
	HitRate      float64 `json:"hit_rate"`
	MemoryBytes  int64   `json:"memory_bytes"`
}

CacheStats represents cache statistics.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the Dakera client for interacting with the vector database.

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new Dakera client with the given base URL.

func NewClientWithOptions

func NewClientWithOptions(opts ClientOptions) *Client

NewClientWithOptions creates a new Dakera client with custom options.

func (*Client) AdminIndexStats

func (c *Client) AdminIndexStats(ctx context.Context, namespace string) (map[string]interface{}, error)

AdminIndexStats gets index stats for a namespace via admin endpoint.

func (*Client) AgentMemories

func (c *Client) AgentMemories(ctx context.Context, agentID string, opts *AgentMemoriesOptions) ([]RecalledMemory, error)

AgentMemories gets memories for an agent.

func (*Client) AgentSessions

func (c *Client) AgentSessions(ctx context.Context, agentID string, opts *AgentSessionsOptions) ([]Session, error)

AgentSessions gets sessions for an agent.

func (*Client) AgentStats

func (c *Client) AgentStats(ctx context.Context, agentID string) (*AgentStats, error)

AgentStats gets stats for an agent.

func (*Client) Aggregate

func (c *Client) Aggregate(ctx context.Context, namespace string, req AggregationRequest) (*AggregationResponse, error)

Aggregate performs aggregation with grouping.

func (*Client) AnalyticsLatency

func (c *Client) AnalyticsLatency(ctx context.Context, opts *AnalyticsOptions) (*LatencyAnalytics, error)

AnalyticsLatency gets latency analytics.

func (*Client) AnalyticsOverview

func (c *Client) AnalyticsOverview(ctx context.Context, opts *AnalyticsOptions) (*AnalyticsOverview, error)

AnalyticsOverview gets the analytics overview.

func (*Client) AnalyticsStorage

func (c *Client) AnalyticsStorage(ctx context.Context, namespace string) (*StorageAnalytics, error)

AnalyticsStorage gets storage analytics.

func (*Client) AnalyticsThroughput

func (c *Client) AnalyticsThroughput(ctx context.Context, opts *AnalyticsOptions) (*ThroughputAnalytics, error)

AnalyticsThroughput gets throughput analytics.

func (*Client) AutopilotStatus added in v0.7.2

func (c *Client) AutopilotStatus(ctx context.Context) (*AutoPilotStatusResponse, error)

AutopilotStatus returns the current AutoPilot config and last-run statistics (PILOT-1).

func (*Client) AutopilotTrigger added in v0.7.2

func (c *Client) AutopilotTrigger(ctx context.Context, action string) (*AutoPilotTriggerResponse, error)

AutopilotTrigger manually triggers an AutoPilot dedup or consolidation cycle (PILOT-3). action must be one of "dedup", "consolidate", or "all".

func (*Client) AutopilotUpdateConfig added in v0.7.2

func (c *Client) AutopilotUpdateConfig(ctx context.Context, req AutoPilotConfigRequest) (*AutoPilotConfigResponse, error)

AutopilotUpdateConfig updates the AutoPilot configuration at runtime (PILOT-2). All fields in req are optional — nil means "keep current value".

func (*Client) BatchForget added in v0.7.0

func (c *Client) BatchForget(ctx context.Context, req BatchForgetRequest) (*BatchForgetResponse, error)

BatchForget bulk-deletes memories using filter predicates (CE-2).

Uses DELETE /v1/memories/forget/batch. At least one filter predicate must be set (server safety guard).

Example:

ts := time.Now().Add(-24 * time.Hour).Unix()
resp, err := client.BatchForget(ctx, BatchForgetRequest{
    AgentID: "agent-1",
    Filter:  BatchMemoryFilter{CreatedBefore: &ts},
})

func (*Client) BatchQuery

func (c *Client) BatchQuery(ctx context.Context, namespace string, queries []BatchQuerySpec) ([]SearchResult, error)

BatchQuery executes multiple queries in a single request.

func (*Client) BatchQueryText

func (c *Client) BatchQueryText(ctx context.Context, namespace string, queries []string, opts *BatchTextQueryOptions) (*BatchTextQueryResponse, error)

BatchQueryText executes multiple text queries with automatic embedding in a single request.

func (*Client) BatchRecall added in v0.7.0

func (c *Client) BatchRecall(ctx context.Context, req BatchRecallRequest) (*BatchRecallResponse, error)

BatchRecall bulk-recalls memories using filter predicates (CE-2).

Uses POST /v1/memories/recall/batch — no embedding required.

Example:

minImp := float32(0.7)
resp, err := client.BatchRecall(ctx, BatchRecallRequest{
    AgentID: "agent-1",
    Filter:  BatchMemoryFilter{MinImportance: &minImp},
    Limit:   50,
})

func (*Client) CacheClear

func (c *Client) CacheClear(ctx context.Context, namespace string) (*StatusResponse, error)

CacheClear clears cache, optionally for a specific namespace.

func (*Client) CacheStats

func (c *Client) CacheStats(ctx context.Context) (*CacheStats, error)

CacheStats gets cache statistics.

func (*Client) ClusterNodes

func (c *Client) ClusterNodes(ctx context.Context) ([]ClusterNode, error)

ClusterNodes gets the cluster nodes.

func (*Client) ClusterStatus

func (c *Client) ClusterStatus(ctx context.Context) (*ClusterStatus, error)

ClusterStatus gets the cluster status.

func (*Client) Compact

func (c *Client) Compact(ctx context.Context, namespace string) (*StatusResponse, error)

Compact triggers compaction for a namespace.

func (*Client) ConfigureNamespace added in v0.6.0

func (c *Client) ConfigureNamespace(ctx context.Context, namespace string, req ConfigureNamespaceRequest) (*ConfigureNamespaceResponse, error)

ConfigureNamespace creates or updates a namespace configuration (upsert semantics — v0.6.0).

Creates the namespace if it does not exist, or updates its distance-metric configuration if it already exists. Dimension changes are rejected by the server to prevent silent data corruption. Requires Write scope.

func (*Client) ConfigureTTL

func (c *Client) ConfigureTTL(ctx context.Context, namespace string, ttlSeconds int, strategy string) (*TtlConfig, error)

ConfigureTTL configures TTL for a namespace.

func (*Client) Consolidate

func (c *Client) Consolidate(ctx context.Context, agentID string, req ConsolidateRequest) (*ConsolidateResponse, error)

Consolidate consolidates memories for an agent.

func (*Client) CreateBackup

func (c *Client) CreateBackup(ctx context.Context, includeData bool) (*BackupInfo, error)

CreateBackup creates a backup.

func (*Client) CreateKey

func (c *Client) CreateKey(ctx context.Context, req CreateKeyRequest) (*ApiKey, error)

CreateKey creates a new API key.

func (*Client) CreateNamespace

func (c *Client) CreateNamespace(ctx context.Context, namespace string, opts *CreateNamespaceOptions) (*NamespaceInfo, error)

CreateNamespace creates a new namespace.

func (*Client) CrossAgentNetwork added in v0.5.0

CrossAgentNetwork builds the cross-agent memory similarity network. POST /v1/knowledge/network/cross-agent — requires Admin scope.

func (*Client) DeactivateKey

func (c *Client) DeactivateKey(ctx context.Context, keyID string) (*ApiKey, error)

DeactivateKey deactivates an API key.

func (*Client) DecayConfig added in v0.7.3

func (c *Client) DecayConfig(ctx context.Context) (*DecayConfigResponse, error)

DecayConfig returns the current decay engine configuration (DECAY-1). Requires Admin scope.

func (*Client) DecayStats added in v0.7.3

func (c *Client) DecayStats(ctx context.Context) (*DecayStatsResponse, error)

DecayStats returns cumulative decay counters and a last-cycle snapshot (DECAY-2). Requires Admin scope.

func (*Client) DecayUpdateConfig added in v0.7.3

DecayUpdateConfig updates the decay engine configuration at runtime (DECAY-1). Changes take effect on the next decay cycle — no restart required. All fields in req are optional; omit any to keep its current value. Requires Admin scope.

func (*Client) Deduplicate

func (c *Client) Deduplicate(ctx context.Context, req DeduplicateRequest) (*DeduplicateResponse, error)

Deduplicate deduplicates memories.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, namespace string, opts DeleteOptions) (*DeleteResponse, error)

Delete removes vectors from a namespace.

func (*Client) DeleteBackup

func (c *Client) DeleteBackup(ctx context.Context, backupID string) error

DeleteBackup deletes a backup.

func (*Client) DeleteKey

func (c *Client) DeleteKey(ctx context.Context, keyID string) error

DeleteKey deletes an API key.

func (*Client) DeleteNamespace

func (c *Client) DeleteNamespace(ctx context.Context, namespace string) error

DeleteNamespace deletes a namespace.

func (*Client) EndSession

func (c *Client) EndSession(ctx context.Context, sessionID string) error

EndSession ends a session.

func (*Client) ExplainQuery

func (c *Client) ExplainQuery(ctx context.Context, namespace string, req QueryExplainRequest) (*QueryExplainResponse, error)

ExplainQuery explains a query execution plan and returns timing information.

func (*Client) ExportVectors

func (c *Client) ExportVectors(ctx context.Context, namespace string, req ExportRequest) (*ExportResponse, error)

ExportVectors exports vectors with pagination.

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, namespace string, ids []string, opts *FetchOptions) ([]Vector, error)

Fetch retrieves vectors by ID from a namespace.

func (*Client) Flush

func (c *Client) Flush(ctx context.Context, namespace string) (*StatusResponse, error)

Flush flushes pending writes for a namespace.

func (*Client) Forget

func (c *Client) Forget(ctx context.Context, agentID, memoryID string) error

Forget deletes a memory.

func (*Client) FullKnowledgeGraph

func (c *Client) FullKnowledgeGraph(ctx context.Context, req FullKnowledgeGraphRequest) (*KnowledgeGraphResponse, error)

FullKnowledgeGraph builds a full knowledge graph for an agent.

func (*Client) FulltextSearch

func (c *Client) FulltextSearch(ctx context.Context, namespace string, query string, opts *FullTextSearchOptions) ([]FullTextSearchResult, error)

FulltextSearch performs a full-text search.

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context) (map[string]interface{}, error)

GetConfig gets the server configuration.

func (*Client) GetIndexStats

func (c *Client) GetIndexStats(ctx context.Context, namespace string) (*IndexStats, error)

GetIndexStats returns index statistics for a namespace.

func (*Client) GetKey

func (c *Client) GetKey(ctx context.Context, keyID string) (*ApiKey, error)

GetKey gets an API key by ID.

func (*Client) GetMemory

func (c *Client) GetMemory(ctx context.Context, agentID, memoryID string) (*Memory, error)

GetMemory gets a specific memory.

func (*Client) GetNamespace

func (c *Client) GetNamespace(ctx context.Context, namespace string) (*NamespaceInfo, error)

GetNamespace returns information about a specific namespace.

func (*Client) GetQuotas

func (c *Client) GetQuotas(ctx context.Context) (map[string]interface{}, error)

GetQuotas gets quota settings.

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, sessionID string) (*Session, error)

GetSession gets session details.

func (*Client) Health

func (c *Client) Health(ctx context.Context) (*HealthResponse, error)

Health checks the server health.

func (*Client) HybridSearch

func (c *Client) HybridSearch(ctx context.Context, namespace string, vector []float32, query string, opts *HybridSearchOptions) ([]HybridSearchResult, error)

HybridSearch performs a hybrid search combining vector and full-text.

When vector is nil the server falls back to BM25-only full-text search. When provided, results are blended with vector similarity according to opts.Alpha.

func (*Client) IndexDocuments

func (c *Client) IndexDocuments(ctx context.Context, namespace string, documents []DocumentInput) (*IndexDocumentsResponse, error)

IndexDocuments indexes documents for full-text search.

func (*Client) KeyUsage

func (c *Client) KeyUsage(ctx context.Context, keyID string) (*KeyUsage, error)

KeyUsage gets usage statistics for an API key.

func (*Client) KnowledgeGraph

func (c *Client) KnowledgeGraph(ctx context.Context, req KnowledgeGraphRequest) (*KnowledgeGraphResponse, error)

KnowledgeGraph builds a knowledge graph from a seed memory.

func (*Client) LastRateLimitHeaders added in v0.7.0

func (c *Client) LastRateLimitHeaders() *RateLimitHeaders

LastRateLimitHeaders returns the rate-limit headers from the most recent API response (OPS-1). Returns nil until the first request has been made.

func (*Client) ListAgents

func (c *Client) ListAgents(ctx context.Context) ([]AgentSummary, error)

ListAgents lists all agents.

func (*Client) ListBackups

func (c *Client) ListBackups(ctx context.Context) ([]BackupInfo, error)

ListBackups lists all backups.

func (*Client) ListKeys

func (c *Client) ListKeys(ctx context.Context) ([]ApiKey, error)

ListKeys lists all API keys.

func (*Client) ListNamespaces

func (c *Client) ListNamespaces(ctx context.Context) ([]NamespaceInfo, error)

ListNamespaces returns all namespaces.

func (*Client) ListSessions

func (c *Client) ListSessions(ctx context.Context, opts *ListSessionsOptions) ([]Session, error)

ListSessions lists sessions with optional filters.

func (*Client) MemoryFeedback

func (c *Client) MemoryFeedback(ctx context.Context, agentID string, req MemoryFeedbackRequest) (*MemoryFeedbackResponse, error)

MemoryFeedback submits feedback on a memory recall.

func (*Client) MultiVectorSearch

func (c *Client) MultiVectorSearch(ctx context.Context, namespace string, req MultiVectorSearchRequest) (*MultiVectorSearchResponse, error)

MultiVectorSearch performs a multi-vector search with positive/negative vectors and optional MMR.

func (*Client) OptimizeNamespace

func (c *Client) OptimizeNamespace(ctx context.Context, namespace string) (*StatusResponse, error)

OptimizeNamespace optimizes a namespace.

func (*Client) Query

func (c *Client) Query(ctx context.Context, namespace string, vector []float32, opts *QueryOptions) (*SearchResult, error)

Query searches for similar vectors in a namespace.

func (*Client) QueryText

func (c *Client) QueryText(ctx context.Context, namespace string, text string, opts *TextQueryOptions) (*TextQueryResponse, error)

QueryText queries using natural language text with automatic embedding. The query text is embedded and used for similarity search.

func (*Client) RebuildIndexes

func (c *Client) RebuildIndexes(ctx context.Context, namespace string) (*StatusResponse, error)

RebuildIndexes rebuilds indexes for a namespace.

func (*Client) Recall

func (c *Client) Recall(ctx context.Context, agentID string, req RecallRequest) ([]RecalledMemory, error)

Recall recalls memories for an agent.

func (*Client) RestoreBackup

func (c *Client) RestoreBackup(ctx context.Context, backupID string) (*StatusResponse, error)

RestoreBackup restores a backup.

func (*Client) RotateKey

func (c *Client) RotateKey(ctx context.Context, keyID string) (*ApiKey, error)

RotateKey rotates an API key.

func (*Client) SearchMemories

func (c *Client) SearchMemories(ctx context.Context, agentID string, req SearchMemoriesRequest) ([]RecalledMemory, error)

SearchMemories searches memories for an agent.

func (*Client) SessionMemories

func (c *Client) SessionMemories(ctx context.Context, sessionID string) ([]RecalledMemory, error)

SessionMemories gets memories for a session.

func (*Client) SlowQueries

func (c *Client) SlowQueries(ctx context.Context, opts *SlowQueryOptions) ([]SlowQuery, error)

SlowQueries gets slow queries.

func (*Client) StartSession

func (c *Client) StartSession(ctx context.Context, req StartSessionRequest) (*Session, error)

StartSession starts a new session.

func (*Client) StoreMemory

func (c *Client) StoreMemory(ctx context.Context, agentID string, req StoreMemoryRequest) (*StoreMemoryResponse, error)

StoreMemory stores a memory for an agent.

func (*Client) StreamGlobalEvents added in v0.4.0

func (c *Client) StreamGlobalEvents(ctx context.Context) (<-chan EventResult, error)

StreamGlobalEvents subscribes to the global SSE event stream (all namespaces).

It opens a long-lived connection to GET /ops/events and sends EventResult values to the returned channel.

Requires an Admin-scoped API key.

func (*Client) StreamMemoryEvents added in v0.5.0

func (c *Client) StreamMemoryEvents(ctx context.Context) (<-chan MemoryEventResult, error)

StreamMemoryEvents subscribes to memory lifecycle SSE events.

It opens a long-lived connection to GET /v1/events/stream and sends MemoryEventResult values to the returned channel. The channel is closed when the server closes the stream or ctx is cancelled.

Requires a Read-scoped API key.

func (*Client) StreamNamespaceEvents added in v0.4.0

func (c *Client) StreamNamespaceEvents(ctx context.Context, namespace string) (<-chan EventResult, error)

StreamNamespaceEvents subscribes to namespace-scoped SSE events.

It opens a long-lived connection to GET /v1/namespaces/{namespace}/events and sends EventResult values to the returned channel. The channel is closed when the server closes the stream or ctx is cancelled.

Requires a Read-scoped API key.

Example:

ch, err := client.StreamNamespaceEvents(ctx, "my-ns")
if err != nil {
    log.Fatal(err)
}
for result := range ch {
    if result.Err != nil {
        log.Println("stream error:", result.Err)
        break
    }
    fmt.Printf("event: %s\n", result.Event.Type)
}

func (*Client) Summarize

func (c *Client) Summarize(ctx context.Context, req SummarizeRequest) (*SummarizeResponse, error)

Summarize summarizes memories.

func (*Client) UnifiedQuery

func (c *Client) UnifiedQuery(ctx context.Context, namespace string, req UnifiedQueryRequest) (*UnifiedQueryResponse, error)

UnifiedQuery performs a unified query combining vector and text search.

func (*Client) UpdateConfig

func (c *Client) UpdateConfig(ctx context.Context, config map[string]interface{}) (map[string]interface{}, error)

UpdateConfig updates the server configuration.

func (*Client) UpdateImportance

func (c *Client) UpdateImportance(ctx context.Context, agentID string, req UpdateImportanceRequest) error

UpdateImportance updates the importance of memories.

func (*Client) UpdateMemory

func (c *Client) UpdateMemory(ctx context.Context, agentID, memoryID string, req UpdateMemoryRequest) (*StoreMemoryResponse, error)

UpdateMemory updates an existing memory.

func (*Client) UpdateQuotas

func (c *Client) UpdateQuotas(ctx context.Context, quotas map[string]interface{}) (map[string]interface{}, error)

UpdateQuotas updates quota settings.

func (*Client) Upsert

func (c *Client) Upsert(ctx context.Context, namespace string, vectors []VectorInput) (*UpsertResponse, error)

Upsert inserts or updates vectors in a namespace.

func (*Client) UpsertColumns

func (c *Client) UpsertColumns(ctx context.Context, namespace string, req ColumnUpsertRequest) (*UpsertResponse, error)

UpsertColumns performs a column-format upsert for efficient bulk operations.

func (*Client) UpsertText

func (c *Client) UpsertText(ctx context.Context, namespace string, documents []TextDocument, opts *TextUpsertOptions) (*TextUpsertResponse, error)

UpsertText upserts text documents with automatic embedding generation. The text is embedded using the specified model (default: MiniLM) and stored as vectors.

func (*Client) WarmCache

func (c *Client) WarmCache(ctx context.Context, namespace string, req WarmCacheRequest) (*WarmCacheResponse, error)

WarmCache warms the cache for vectors in a namespace.

type ClientOptions

type ClientOptions struct {
	// BaseURL is the Dakera server URL.
	BaseURL string

	// APIKey is the optional API key for authentication.
	APIKey string

	// Timeout is the request timeout duration. Defaults to 30s.
	Timeout time.Duration

	// ConnectTimeout is the TCP connection establishment timeout.
	// Defaults to Timeout when not set.
	ConnectTimeout time.Duration

	// MaxRetries is the maximum number of retries. Deprecated: use RetryBackoff.
	// When both are set, RetryBackoff takes precedence.
	MaxRetries int

	// RetryBackoff allows fine-grained retry configuration.
	// When set, MaxRetries is ignored.
	RetryBackoff *RetryConfig

	// Headers are additional HTTP headers to include in requests.
	Headers map[string]string
}

ClientOptions represents options for the Dakera client.

type ClusterNode

type ClusterNode struct {
	ID      string `json:"id"`
	Address string `json:"address"`
	Status  string `json:"status"`
	Role    string `json:"role,omitempty"`
}

ClusterNode represents a cluster node.

type ClusterStatus

type ClusterStatus struct {
	Status  string `json:"status"`
	Nodes   int    `json:"nodes"`
	Healthy bool   `json:"healthy"`
	Version string `json:"version,omitempty"`
}

ClusterStatus represents the cluster status response.

type ColumnUpsertRequest

type ColumnUpsertRequest struct {
	IDs        []string                 `json:"ids"`
	Vectors    [][]float32              `json:"vectors"`
	Attributes map[string][]interface{} `json:"attributes,omitempty"`
	TTLSeconds *int                     `json:"ttl_seconds,omitempty"`
	Dimension  *int                     `json:"dimension,omitempty"`
}

ColumnUpsertRequest represents a column-format upsert request for efficient bulk operations.

type ConfigureNamespaceRequest added in v0.6.0

type ConfigureNamespaceRequest struct {
	// Dimension is the vector dimension. Required on first creation;
	// must match the existing dimension on subsequent calls.
	Dimension int `json:"dimension"`
	// Distance is the distance metric. Defaults to cosine when omitted.
	Distance DistanceMetric `json:"distance,omitempty"`
}

ConfigureNamespaceRequest is the request body for PUT /v1/namespaces/:namespace.

Uses upsert semantics: creates the namespace if it does not exist, or updates its configuration if it already exists (v0.6.0).

type ConfigureNamespaceResponse added in v0.6.0

type ConfigureNamespaceResponse struct {
	// Namespace is the namespace name.
	Namespace string `json:"namespace"`
	// Dimension is the vector dimension.
	Dimension int `json:"dimension"`
	// Distance is the distance metric in use.
	Distance DistanceMetric `json:"distance"`
	// Created is true if the namespace was newly created; false if it already existed.
	Created bool `json:"created"`
}

ConfigureNamespaceResponse is the response from PUT /v1/namespaces/:namespace.

type ConnectionError

type ConnectionError struct {
	DakeraError
}

ConnectionError is raised when unable to connect to Dakera server.

func NewConnectionError

func NewConnectionError(message string) *ConnectionError

func (*ConnectionError) Error

func (e *ConnectionError) Error() string

type ConsolidateRequest

type ConsolidateRequest struct {
	MemoryType string   `json:"memory_type,omitempty"`
	Threshold  *float32 `json:"threshold,omitempty"`
	DryRun     bool     `json:"dry_run,omitempty"`
}

ConsolidateRequest represents a request to consolidate memories.

type ConsolidateResponse

type ConsolidateResponse struct {
	ConsolidatedCount int      `json:"consolidated_count"`
	RemovedCount      int      `json:"removed_count"`
	NewMemories       []string `json:"new_memories"`
}

ConsolidateResponse represents the response from consolidation.

type ConsolidationResultSnapshot added in v0.7.2

type ConsolidationResultSnapshot struct {
	NamespacesProcessed  int `json:"namespaces_processed"`
	MemoriesScanned      int `json:"memories_scanned"`
	ClustersMerged       int `json:"clusters_merged"`
	MemoriesConsolidated int `json:"memories_consolidated"`
}

ConsolidationResultSnapshot is the result from a consolidation cycle.

type CreateKeyRequest

type CreateKeyRequest struct {
	Name        string   `json:"name"`
	Permissions []string `json:"permissions,omitempty"`
	ExpiresAt   string   `json:"expires_at,omitempty"`
}

CreateKeyRequest represents a request to create an API key.

type CreateNamespaceOptions

type CreateNamespaceOptions struct {
	Dimensions int                    `json:"dimensions,omitempty"`
	IndexType  string                 `json:"index_type,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

CreateNamespaceOptions represents options for creating a namespace.

type CrossAgentNetworkRequest added in v0.5.0

type CrossAgentNetworkRequest struct {
	// Specific agent IDs to include. nil or empty means all agents.
	AgentIDs []string `json:"agent_ids,omitempty"`
	// Minimum cosine similarity for a cross-agent edge (default 0.3).
	MinSimilarity float32 `json:"min_similarity,omitempty"`
	// Maximum memories per agent, by descending importance (default 50).
	MaxNodesPerAgent int `json:"max_nodes_per_agent,omitempty"`
	// Minimum importance score for a memory to be included (default 0.0).
	MinImportance float32 `json:"min_importance,omitempty"`
	// Maximum cross-agent edges to return (default 200).
	MaxCrossEdges int `json:"max_cross_edges,omitempty"`
}

CrossAgentNetworkRequest configures the cross-agent similarity graph query. All fields are optional; zero values use server defaults.

type CrossAgentNetworkResponse added in v0.5.0

type CrossAgentNetworkResponse struct {
	Agents    []AgentNetworkInfo `json:"agents"`
	Nodes     []AgentNetworkNode `json:"nodes"`
	Edges     []AgentNetworkEdge `json:"edges"`
	Stats     AgentNetworkStats  `json:"stats"`
	NodeCount int                `json:"node_count"` // Total memory nodes in the network (server v0.6.2+).
}

CrossAgentNetworkResponse is returned by CrossAgentNetwork.

type DakeraError

type DakeraError struct {
	Message      string
	StatusCode   int
	Code         ErrorCode
	ResponseBody interface{}
}

DakeraError is the base error type for all Dakera errors.

func (*DakeraError) Error

func (e *DakeraError) Error() string

type DakeraEvent added in v0.4.0

type DakeraEvent struct {
	Type string `json:"type"`

	// namespace_created / namespace_deleted / vectors_mutated / operation_progress / job_progress
	Namespace string `json:"namespace,omitempty"`
	// namespace_created
	Dimension int `json:"dimension,omitempty"`
	// operation_progress
	OperationID string `json:"operation_id,omitempty"`
	OpType      string `json:"op_type,omitempty"`
	Progress    int    `json:"progress,omitempty"`
	Status      string `json:"status,omitempty"`
	Message     string `json:"message,omitempty"`
	UpdatedAt   int64  `json:"updated_at,omitempty"`
	// job_progress
	JobID   string `json:"job_id,omitempty"`
	JobType string `json:"job_type,omitempty"`
	// vectors_mutated
	Op    VectorMutationOp `json:"op,omitempty"`
	Count int              `json:"count,omitempty"`
	// stream_lagged
	Dropped int64  `json:"dropped,omitempty"`
	Hint    string `json:"hint,omitempty"`
}

DakeraEvent is an event received from a Dakera SSE stream.

The Type field identifies the event variant; only the fields relevant to that variant will be populated.

  • "namespace_created" → Namespace, Dimension
  • "namespace_deleted" → Namespace
  • "operation_progress" → OperationID, Namespace, OpType, Progress, Status, Message, UpdatedAt
  • "job_progress" → JobID, JobType, Namespace, Progress, Status
  • "vectors_mutated" → Namespace, Op, Count
  • "stream_lagged" → Dropped, Hint

type DecayConfigResponse added in v0.7.3

type DecayConfigResponse struct {
	// Strategy is the decay strategy: "exponential", "linear", or "step".
	Strategy string `json:"strategy"`
	// HalfLifeHours is the half-life in hours.
	HalfLifeHours float64 `json:"half_life_hours"`
	// MinImportance is the minimum importance threshold; memories below are
	// hard-deleted on the next decay cycle.
	MinImportance float32 `json:"min_importance"`
}

DecayConfigResponse is returned by GET /v1/admin/decay/config (DECAY-1).

type DecayConfigUpdateRequest added in v0.7.3

type DecayConfigUpdateRequest struct {
	// Strategy is the decay strategy: "exponential", "linear", or "step".
	Strategy *string `json:"strategy,omitempty"`
	// HalfLifeHours must be > 0.
	HalfLifeHours *float64 `json:"half_life_hours,omitempty"`
	// MinImportance must be 0.0–1.0.
	MinImportance *float32 `json:"min_importance,omitempty"`
}

DecayConfigUpdateRequest is the request for PUT /v1/admin/decay/config (DECAY-1). All fields are optional — omit any to keep its current value.

type DecayConfigUpdateResponse added in v0.7.3

type DecayConfigUpdateResponse struct {
	Success bool                `json:"success"`
	Config  DecayConfigResponse `json:"config"`
	Message string              `json:"message"`
}

DecayConfigUpdateResponse is returned by PUT /v1/admin/decay/config (DECAY-1).

type DecayStatsResponse added in v0.7.3

type DecayStatsResponse struct {
	// TotalDecayed is the all-time count of memories whose importance was lowered.
	TotalDecayed uint64 `json:"total_decayed"`
	// TotalDeleted is the all-time count of memories hard-deleted by decay or TTL.
	TotalDeleted uint64 `json:"total_deleted"`
	// LastRunAt is the Unix timestamp of the last decay cycle (nil if never run).
	LastRunAt *uint64 `json:"last_run_at,omitempty"`
	// CyclesRun is the number of decay cycles completed since startup.
	CyclesRun uint64 `json:"cycles_run"`
	// LastCycle holds stats from the most recent decay cycle (nil if never run).
	LastCycle *LastDecayCycleStats `json:"last_cycle,omitempty"`
}

DecayStatsResponse is returned by GET /v1/admin/decay/stats (DECAY-2).

type DedupResultSnapshot added in v0.7.2

type DedupResultSnapshot struct {
	NamespacesProcessed int `json:"namespaces_processed"`
	MemoriesScanned     int `json:"memories_scanned"`
	DuplicatesRemoved   int `json:"duplicates_removed"`
}

DedupResultSnapshot is the result from a deduplication cycle.

type DeduplicateRequest

type DeduplicateRequest struct {
	AgentID    string   `json:"agent_id"`
	Threshold  *float32 `json:"threshold,omitempty"`
	MemoryType string   `json:"memory_type,omitempty"`
	DryRun     bool     `json:"dry_run,omitempty"`
}

DeduplicateRequest represents a request to deduplicate memories.

type DeduplicateResponse

type DeduplicateResponse struct {
	DuplicatesFound int        `json:"duplicates_found"`
	RemovedCount    int        `json:"removed_count"`
	Groups          [][]string `json:"groups"`
}

DeduplicateResponse represents the response from deduplication.

type DeleteOptions

type DeleteOptions struct {
	IDs       []string               `json:"ids,omitempty"`
	Filter    map[string]interface{} `json:"filter,omitempty"`
	DeleteAll bool                   `json:"delete_all,omitempty"`
}

DeleteOptions represents options for delete operations.

type DeleteResponse

type DeleteResponse struct {
	DeletedCount int `json:"deletedCount"`
}

DeleteResponse represents the response from a delete operation.

type DistanceMetric added in v0.6.0

type DistanceMetric string

DistanceMetric represents the distance metric for similarity search. Valid values: "cosine", "euclidean", "dot_product".

const (
	DistanceMetricCosine     DistanceMetric = "cosine"
	DistanceMetricEuclidean  DistanceMetric = "euclidean"
	DistanceMetricDotProduct DistanceMetric = "dot_product"
)

type Document

type Document struct {
	ID       string                 `json:"id"`
	Content  string                 `json:"content"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

Document represents a document for full-text indexing.

type DocumentInput

type DocumentInput struct {
	ID       string                 `json:"id"`
	Content  string                 `json:"content"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

DocumentInput represents input for indexing a document.

type EmbeddingModel

type EmbeddingModel string

EmbeddingModel represents supported embedding models for text-based operations.

const (
	// EmbeddingModelMiniLM is the MiniLM-L6 model - Fast, good quality (384 dimensions).
	EmbeddingModelMiniLM EmbeddingModel = "minilm"
	// EmbeddingModelBGESmall is the BGE-small model - Balanced performance (384 dimensions).
	EmbeddingModelBGESmall EmbeddingModel = "bge-small"
	// EmbeddingModelE5Small is the E5-small model - High quality (384 dimensions).
	EmbeddingModelE5Small EmbeddingModel = "e5-small"
)

type ErrorCode added in v0.6.1

type ErrorCode string

ErrorCode represents a typed server error code from the Dakera API.

const (
	ErrorCodeNamespaceNotFound      ErrorCode = "NAMESPACE_NOT_FOUND"
	ErrorCodeVectorNotFound         ErrorCode = "VECTOR_NOT_FOUND"
	ErrorCodeDimensionMismatch      ErrorCode = "DIMENSION_MISMATCH"
	ErrorCodeEmptyVector            ErrorCode = "EMPTY_VECTOR"
	ErrorCodeInvalidRequest         ErrorCode = "INVALID_REQUEST"
	ErrorCodeStorageError           ErrorCode = "STORAGE_ERROR"
	ErrorCodeInternalError          ErrorCode = "INTERNAL_ERROR"
	ErrorCodeQuotaExceeded          ErrorCode = "QUOTA_EXCEEDED"
	ErrorCodeServiceUnavailable     ErrorCode = "SERVICE_UNAVAILABLE"
	ErrorCodeAuthenticationRequired ErrorCode = "AUTHENTICATION_REQUIRED"
	ErrorCodeInvalidApiKey          ErrorCode = "INVALID_API_KEY"
	ErrorCodeApiKeyExpired          ErrorCode = "API_KEY_EXPIRED"
	ErrorCodeInsufficientScope      ErrorCode = "INSUFFICIENT_SCOPE"
	ErrorCodeNamespaceAccessDenied  ErrorCode = "NAMESPACE_ACCESS_DENIED"
	ErrorCodeUnknown                ErrorCode = "UNKNOWN"
)

type EventResult added in v0.4.0

type EventResult struct {
	Event *DakeraEvent
	Err   error
}

EventResult wraps a DakeraEvent or an error from the SSE stream.

type ExportRequest

type ExportRequest struct {
	Cursor         string                 `json:"cursor,omitempty"`
	Limit          *int                   `json:"limit,omitempty"`
	Filter         map[string]interface{} `json:"filter,omitempty"`
	IncludeVectors bool                   `json:"include_vectors,omitempty"`
}

ExportRequest represents a request to export vectors.

type ExportResponse

type ExportResponse struct {
	Vectors    []ExportedVector `json:"vectors"`
	NextCursor string           `json:"next_cursor,omitempty"`
	HasMore    bool             `json:"has_more"`
}

ExportResponse represents the response from vector export.

type ExportedVector

type ExportedVector struct {
	ID       string                 `json:"id"`
	Values   []float32              `json:"values,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

ExportedVector represents a single exported vector.

type FetchOptions

type FetchOptions struct {
	IncludeValues   bool `json:"include_values,omitempty"`
	IncludeMetadata bool `json:"include_metadata,omitempty"`
}

FetchOptions represents options for fetch operations.

type FullKnowledgeGraphRequest

type FullKnowledgeGraphRequest struct {
	AgentID          string   `json:"agent_id"`
	MaxNodes         *int     `json:"max_nodes,omitempty"`
	MinSimilarity    *float32 `json:"min_similarity,omitempty"`
	ClusterThreshold *float32 `json:"cluster_threshold,omitempty"`
	MaxEdgesPerNode  *int     `json:"max_edges_per_node,omitempty"`
}

FullKnowledgeGraphRequest represents a request to build a full knowledge graph.

type FullTextSearchOptions

type FullTextSearchOptions struct {
	TopK   int                    `json:"top_k,omitempty"`
	Filter map[string]interface{} `json:"filter,omitempty"`
}

FullTextSearchOptions represents options for full-text search.

type FullTextSearchResult

type FullTextSearchResult struct {
	ID       string                 `json:"id"`
	Score    float32                `json:"score"`
	Content  string                 `json:"content,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

FullTextSearchResult represents a full-text search result.

type HealthResponse

type HealthResponse struct {
	Status  string `json:"status"`
	Version string `json:"version,omitempty"`
}

HealthResponse represents the server health check response.

type HybridSearchOptions

type HybridSearchOptions struct {
	TopK   int                    `json:"top_k,omitempty"`
	Alpha  float32                `json:"alpha,omitempty"`
	Filter map[string]interface{} `json:"filter,omitempty"`
}

HybridSearchOptions represents options for hybrid search.

type HybridSearchResult

type HybridSearchResult struct {
	ID          string                 `json:"id"`
	Score       float32                `json:"score"`
	VectorScore float32                `json:"vectorScore,omitempty"`
	TextScore   float32                `json:"textScore,omitempty"`
	Values      []float32              `json:"values,omitempty"`
	Content     string                 `json:"content,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

HybridSearchResult represents a hybrid search result.

type IndexDocumentsResponse

type IndexDocumentsResponse struct {
	IndexedCount int `json:"indexedCount"`
}

IndexDocumentsResponse represents the response from indexing documents.

type IndexStats

type IndexStats struct {
	Namespace    string  `json:"namespace"`
	VectorCount  int64   `json:"vectorCount"`
	IndexedCount int64   `json:"indexedCount"`
	Dimensions   int     `json:"dimensions"`
	IndexType    string  `json:"indexType"`
	SizeBytes    int64   `json:"sizeBytes,omitempty"`
	Utilization  float64 `json:"utilization,omitempty"`
}

IndexStats represents statistics about an index.

type KeyUsage

type KeyUsage struct {
	KeyID              string           `json:"key_id"`
	TotalRequests      int64            `json:"total_requests"`
	LastUsed           string           `json:"last_used,omitempty"`
	RequestsByEndpoint map[string]int64 `json:"requests_by_endpoint,omitempty"`
}

KeyUsage represents usage statistics for an API key.

type KnowledgeEdge

type KnowledgeEdge struct {
	Source       string  `json:"source"`
	Target       string  `json:"target"`
	Similarity   float32 `json:"similarity"`
	Relationship string  `json:"relationship,omitempty"`
}

KnowledgeEdge represents an edge in the knowledge graph.

type KnowledgeGraphRequest

type KnowledgeGraphRequest struct {
	AgentID       string   `json:"agent_id"`
	MemoryID      string   `json:"memory_id,omitempty"`
	Depth         *int     `json:"depth,omitempty"`
	MinSimilarity *float32 `json:"min_similarity,omitempty"`
}

KnowledgeGraphRequest represents a request to build a knowledge graph.

type KnowledgeGraphResponse

type KnowledgeGraphResponse struct {
	Nodes    []KnowledgeNode `json:"nodes"`
	Edges    []KnowledgeEdge `json:"edges"`
	Clusters [][]string      `json:"clusters,omitempty"`
}

KnowledgeGraphResponse represents the response from knowledge graph operations.

type KnowledgeNode

type KnowledgeNode struct {
	ID         string                 `json:"id"`
	Content    string                 `json:"content"`
	MemoryType string                 `json:"memory_type,omitempty"`
	Importance *float32               `json:"importance,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

KnowledgeNode represents a node in the knowledge graph.

type LastDecayCycleStats added in v0.7.3

type LastDecayCycleStats struct {
	NamespacesProcessed int `json:"namespaces_processed"`
	MemoriesProcessed   int `json:"memories_processed"`
	MemoriesDecayed     int `json:"memories_decayed"`
	MemoriesDeleted     int `json:"memories_deleted"`
}

LastDecayCycleStats holds per-cycle statistics from a single decay run.

type LatencyAnalytics

type LatencyAnalytics struct {
	Period      string                      `json:"period"`
	AvgMs       float64                     `json:"avg_ms"`
	P50Ms       float64                     `json:"p50_ms"`
	P95Ms       float64                     `json:"p95_ms"`
	P99Ms       float64                     `json:"p99_ms"`
	MaxMs       float64                     `json:"max_ms"`
	ByOperation map[string]OperationLatency `json:"by_operation,omitempty"`
}

LatencyAnalytics represents latency analytics response.

type ListSessionsOptions

type ListSessionsOptions struct {
	AgentID    string `json:"agent_id,omitempty"`
	ActiveOnly *bool  `json:"active_only,omitempty"`
	Limit      *int   `json:"limit,omitempty"`
	Offset     *int   `json:"offset,omitempty"`
}

ListSessionsOptions represents options for listing sessions.

type Memory

type Memory struct {
	ID          string                 `json:"id"`
	Content     string                 `json:"content"`
	MemoryType  string                 `json:"memory_type"`
	Importance  float32                `json:"importance"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt   string                 `json:"created_at,omitempty"`
	UpdatedAt   string                 `json:"updated_at,omitempty"`
	AccessCount *int                   `json:"access_count,omitempty"`
}

Memory represents a stored memory.

type MemoryEvent added in v0.5.0

type MemoryEvent struct {
	EventType  string   `json:"event_type"`
	AgentID    string   `json:"agent_id"`
	Timestamp  int64    `json:"timestamp"`
	MemoryID   *string  `json:"memory_id,omitempty"`
	Content    *string  `json:"content,omitempty"`
	Importance *float32 `json:"importance,omitempty"`
	Tags       []string `json:"tags,omitempty"`
	SessionID  *string  `json:"session_id,omitempty"`
}

MemoryEvent is a memory lifecycle event from GET /v1/events/stream.

type MemoryEventResult added in v0.5.0

type MemoryEventResult struct {
	Event *MemoryEvent
	Err   error
}

MemoryEventResult wraps a MemoryEvent or an error from the memory event SSE stream.

type MemoryFeedbackRequest

type MemoryFeedbackRequest struct {
	MemoryID       string   `json:"memory_id"`
	Feedback       string   `json:"feedback"`
	RelevanceScore *float32 `json:"relevance_score,omitempty"`
}

MemoryFeedbackRequest represents a request for memory feedback.

type MemoryFeedbackResponse

type MemoryFeedbackResponse struct {
	Status            string   `json:"status"`
	UpdatedImportance *float32 `json:"updated_importance,omitempty"`
}

MemoryFeedbackResponse represents the response from feedback.

type MultiVectorSearchRequest

type MultiVectorSearchRequest struct {
	Positive        [][]float32            `json:"positive"`
	Negative        [][]float32            `json:"negative,omitempty"`
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
	IncludeVectors  bool                   `json:"include_vectors,omitempty"`
	MmrLambda       *float32               `json:"mmr_lambda,omitempty"`
	MmrPrefetchK    *int                   `json:"mmr_prefetch_k,omitempty"`
}

MultiVectorSearchRequest represents a multi-vector search request with positive/negative vectors.

type MultiVectorSearchResponse

type MultiVectorSearchResponse struct {
	Results      []MultiVectorSearchResult `json:"results"`
	SearchTimeMs *int64                    `json:"search_time_ms,omitempty"`
	Strategy     string                    `json:"strategy,omitempty"`
}

MultiVectorSearchResponse represents the response from multi-vector search.

type MultiVectorSearchResult

type MultiVectorSearchResult struct {
	ID       string                 `json:"id"`
	Score    float32                `json:"score"`
	Values   []float32              `json:"values,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

MultiVectorSearchResult represents a single result from multi-vector search.

type NamespaceInfo

type NamespaceInfo struct {
	Name        string                 `json:"name"`
	VectorCount int64                  `json:"vectorCount"`
	Dimensions  int                    `json:"dimensions,omitempty"`
	IndexType   string                 `json:"indexType,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt   *time.Time             `json:"createdAt,omitempty"`
	UpdatedAt   *time.Time             `json:"updatedAt,omitempty"`
}

NamespaceInfo represents information about a namespace.

type NamespaceStorage

type NamespaceStorage struct {
	Bytes       uint64 `json:"bytes"`
	VectorCount uint64 `json:"vector_count"`
}

NamespaceStorage represents storage info for a specific namespace.

type NotFoundError

type NotFoundError struct {
	DakeraError
}

NotFoundError is raised when a requested resource is not found.

func NewNotFoundError

func NewNotFoundError(message string, statusCode int, body interface{}, code ErrorCode) *NotFoundError

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type OpStatus added in v0.4.0

type OpStatus string

OpStatus is the operation status for OperationProgress events.

const (
	OpStatusPending   OpStatus = "pending"
	OpStatusRunning   OpStatus = "running"
	OpStatusCompleted OpStatus = "completed"
	OpStatusFailed    OpStatus = "failed"
)

type OperationLatency

type OperationLatency struct {
	AvgMs float64 `json:"avg_ms"`
	P95Ms float64 `json:"p95_ms"`
	Count uint64  `json:"count"`
}

OperationLatency represents latency stats for a specific operation.

type QueryExplainRequest

type QueryExplainRequest struct {
	Vector          []float32              `json:"vector"`
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
}

QueryExplainRequest represents a request to explain a query execution plan.

type QueryExplainResponse

type QueryExplainResponse struct {
	Plan           map[string]interface{}   `json:"plan"`
	Steps          []map[string]interface{} `json:"steps,omitempty"`
	TotalTimeMs    *float64                 `json:"total_time_ms,omitempty"`
	Results        []QueryResult            `json:"results,omitempty"`
	IndexType      string                   `json:"index_type,omitempty"`
	VectorsScanned *int64                   `json:"vectors_scanned,omitempty"`
}

QueryExplainResponse represents the response from query explain.

type QueryOptions

type QueryOptions struct {
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeValues   bool                   `json:"include_values,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
}

QueryOptions represents options for vector queries.

type QueryResult

type QueryResult struct {
	ID       string                 `json:"id"`
	Score    float32                `json:"score"`
	Values   []float32              `json:"values,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

QueryResult represents a single query match.

type RateLimitError

type RateLimitError struct {
	DakeraError
	RetryAfter int
}

RateLimitError is raised when rate limit is exceeded.

func NewRateLimitError

func NewRateLimitError(message string, statusCode int, body interface{}, code ErrorCode, retryAfter int) *RateLimitError

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

type RateLimitHeaders added in v0.7.0

type RateLimitHeaders struct {
	// Limit is X-RateLimit-Limit — max requests allowed in the current window (0 = not present).
	Limit int64
	// Remaining is X-RateLimit-Remaining — requests left in the current window (0 = not present).
	Remaining int64
	// Reset is X-RateLimit-Reset — Unix timestamp (seconds) when the window resets (0 = not present).
	Reset int64
	// QuotaUsed is X-Quota-Used — namespace vectors / storage consumed (0 = not present).
	QuotaUsed int64
	// QuotaLimit is X-Quota-Limit — namespace quota ceiling (0 = not present).
	QuotaLimit int64
}

RateLimitHeaders holds rate-limit and quota headers from an API response.

Fields are zero when the server does not include the header (e.g. non-namespaced endpoints where quota does not apply).

type RecallRequest

type RecallRequest struct {
	Query         string   `json:"query"`
	TopK          int      `json:"top_k,omitempty"`
	MemoryType    string   `json:"memory_type,omitempty"`
	MinImportance *float32 `json:"min_importance,omitempty"`
}

RecallRequest represents a request to recall memories.

type RecalledMemory

type RecalledMemory struct {
	ID         string                 `json:"id"`
	Content    string                 `json:"content"`
	MemoryType string                 `json:"memory_type"`
	Importance float32                `json:"importance"`
	Score      float32                `json:"score"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt  string                 `json:"created_at,omitempty"`
}

RecalledMemory represents a recalled memory with similarity score.

type RetryConfig added in v0.7.0

type RetryConfig struct {
	// MaxRetries is the maximum number of attempts (including the initial one).
	// Defaults to 3.
	MaxRetries int

	// BaseDelay is the initial backoff duration. Defaults to 100ms.
	BaseDelay time.Duration

	// MaxDelay is the upper bound on backoff duration. Defaults to 60s.
	MaxDelay time.Duration

	// Jitter, when true, randomises the delay ±50%. Defaults to true.
	Jitter bool
}

RetryConfig holds exponential-backoff retry parameters.

func DefaultRetryConfig added in v0.7.0

func DefaultRetryConfig() RetryConfig

DefaultRetryConfig returns a RetryConfig with sensible defaults.

type SearchMemoriesRequest

type SearchMemoriesRequest struct {
	Query         string   `json:"query"`
	TopK          int      `json:"top_k,omitempty"`
	MemoryType    string   `json:"memory_type,omitempty"`
	MinImportance *float32 `json:"min_importance,omitempty"`
}

SearchMemoriesRequest represents a request to search memories.

type SearchResult

type SearchResult struct {
	Results       []QueryResult `json:"results"`
	TotalSearched int           `json:"totalSearched,omitempty"`
}

SearchResult represents the result of a vector query.

type ServerError

type ServerError struct {
	DakeraError
}

ServerError is raised when the server returns a 5xx error.

func NewServerError

func NewServerError(message string, statusCode int, body interface{}, code ErrorCode) *ServerError

func (*ServerError) Error

func (e *ServerError) Error() string

type Session

type Session struct {
	SessionID string                 `json:"session_id"`
	AgentID   string                 `json:"agent_id"`
	StartedAt string                 `json:"started_at,omitempty"`
	EndedAt   string                 `json:"ended_at,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

Session represents a session.

type SlowQuery

type SlowQuery struct {
	Query      string  `json:"query"`
	DurationMs float64 `json:"duration_ms"`
	Timestamp  string  `json:"timestamp"`
	Namespace  string  `json:"namespace,omitempty"`
}

SlowQuery represents a slow query entry.

type SlowQueryOptions

type SlowQueryOptions struct {
	Limit         int `json:"limit,omitempty"`
	MinDurationMs int `json:"min_duration_ms,omitempty"`
}

SlowQueryOptions represents options for querying slow queries.

type StartSessionRequest

type StartSessionRequest struct {
	AgentID  string                 `json:"agent_id"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

StartSessionRequest represents a request to start a session.

type StatusResponse

type StatusResponse struct {
	Status string `json:"status"`
}

StatusResponse represents a generic status response.

type StorageAnalytics

type StorageAnalytics struct {
	TotalBytes  uint64                      `json:"total_bytes"`
	IndexBytes  uint64                      `json:"index_bytes"`
	DataBytes   uint64                      `json:"data_bytes"`
	ByNamespace map[string]NamespaceStorage `json:"by_namespace,omitempty"`
}

StorageAnalytics represents storage analytics response.

type StoreMemoryRequest

type StoreMemoryRequest struct {
	Content    string                 `json:"content"`
	MemoryType string                 `json:"memory_type,omitempty"`
	Importance *float32               `json:"importance,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	// TTLSeconds is an optional TTL in seconds. The memory is hard-deleted after
	// this many seconds from creation.
	TTLSeconds *int `json:"ttl_seconds,omitempty"`
	// ExpiresAt is an optional explicit expiry Unix timestamp (seconds). Takes
	// precedence over TTLSeconds when both are set. The memory is hard-deleted
	// by the decay engine on expiry (DECAY-3).
	ExpiresAt *int64    `json:"expires_at,omitempty"`
	SessionID string    `json:"session_id,omitempty"`
	Embedding []float32 `json:"embedding,omitempty"`
}

StoreMemoryRequest represents a request to store a memory.

type StoreMemoryResponse

type StoreMemoryResponse struct {
	MemoryID string `json:"memory_id"`
	Status   string `json:"status"`
}

StoreMemoryResponse represents the response from storing a memory.

type SummarizeRequest

type SummarizeRequest struct {
	AgentID    string   `json:"agent_id"`
	MemoryIDs  []string `json:"memory_ids,omitempty"`
	TargetType string   `json:"target_type,omitempty"`
	DryRun     bool     `json:"dry_run,omitempty"`
}

SummarizeRequest represents a request to summarize memories.

type SummarizeResponse

type SummarizeResponse struct {
	Summary     string `json:"summary"`
	SourceCount int    `json:"source_count"`
	NewMemoryID string `json:"new_memory_id,omitempty"`
}

SummarizeResponse represents the response from summarization.

type TextDocument

type TextDocument struct {
	ID         string                 `json:"id"`
	Text       string                 `json:"text"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	TTLSeconds *int                   `json:"ttl_seconds,omitempty"`
}

TextDocument represents input for upserting a text document with automatic embedding.

type TextQueryOptions

type TextQueryOptions struct {
	TopK           int                    `json:"top_k,omitempty"`
	Filter         map[string]interface{} `json:"filter,omitempty"`
	IncludeText    bool                   `json:"include_text,omitempty"`
	IncludeVectors bool                   `json:"include_vectors,omitempty"`
	Model          EmbeddingModel         `json:"model,omitempty"`
}

TextQueryOptions represents options for text query operations.

type TextQueryResponse

type TextQueryResponse struct {
	Results         []TextSearchResult `json:"results"`
	Model           EmbeddingModel     `json:"model"`
	EmbeddingTimeMs int64              `json:"embedding_time_ms"`
	SearchTimeMs    int64              `json:"search_time_ms"`
}

TextQueryResponse represents the response from a text query operation.

type TextSearchResult

type TextSearchResult struct {
	ID       string                 `json:"id"`
	Score    float32                `json:"score"`
	Text     string                 `json:"text,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Vector   []float32              `json:"vector,omitempty"`
}

TextSearchResult represents a single text search result.

type TextUpsertOptions

type TextUpsertOptions struct {
	Model EmbeddingModel `json:"model,omitempty"`
}

TextUpsertOptions represents options for text upsert operations.

type TextUpsertResponse

type TextUpsertResponse struct {
	UpsertedCount   int            `json:"upserted_count"`
	TokensProcessed int            `json:"tokens_processed"`
	Model           EmbeddingModel `json:"model"`
	EmbeddingTimeMs int64          `json:"embedding_time_ms"`
}

TextUpsertResponse represents the response from a text upsert operation.

type ThroughputAnalytics

type ThroughputAnalytics struct {
	Period              string            `json:"period"`
	TotalOperations     uint64            `json:"total_operations"`
	OperationsPerSecond float64           `json:"operations_per_second"`
	ByOperation         map[string]uint64 `json:"by_operation,omitempty"`
}

ThroughputAnalytics represents throughput analytics response.

type TimeoutError

type TimeoutError struct {
	DakeraError
}

TimeoutError is raised when a request times out.

func NewTimeoutError

func NewTimeoutError(message string) *TimeoutError

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

type TtlConfig

type TtlConfig struct {
	Namespace  string `json:"namespace"`
	TtlSeconds int    `json:"ttl_seconds"`
	Strategy   string `json:"strategy,omitempty"`
}

TtlConfig represents TTL configuration for a namespace.

type UnifiedQueryRequest

type UnifiedQueryRequest struct {
	Vector          []float32              `json:"vector,omitempty"`
	Text            string                 `json:"text,omitempty"`
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
	IncludeVectors  bool                   `json:"include_vectors,omitempty"`
	VectorWeight    *float32               `json:"vector_weight,omitempty"`
	TextWeight      *float32               `json:"text_weight,omitempty"`
	FusionMethod    string                 `json:"fusion_method,omitempty"`
	Rerank          bool                   `json:"rerank,omitempty"`
}

UnifiedQueryRequest represents a unified query combining vector and text search.

type UnifiedQueryResponse

type UnifiedQueryResponse struct {
	Results      []UnifiedSearchResult `json:"results"`
	SearchTimeMs *int64                `json:"search_time_ms,omitempty"`
	FusionMethod string                `json:"fusion_method,omitempty"`
}

UnifiedQueryResponse represents the response from unified query.

type UnifiedSearchResult

type UnifiedSearchResult struct {
	ID          string                 `json:"id"`
	Score       float32                `json:"score"`
	VectorScore *float32               `json:"vector_score,omitempty"`
	TextScore   *float32               `json:"text_score,omitempty"`
	Values      []float32              `json:"values,omitempty"`
	Content     string                 `json:"content,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

UnifiedSearchResult represents a single result from unified query.

type UpdateImportanceRequest

type UpdateImportanceRequest struct {
	MemoryIDs  []string `json:"memory_ids"`
	Importance float32  `json:"importance"`
}

UpdateImportanceRequest represents a request to update memory importance.

type UpdateMemoryRequest

type UpdateMemoryRequest struct {
	Content    *string                `json:"content,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	MemoryType *string                `json:"memory_type,omitempty"`
}

UpdateMemoryRequest represents a request to update a memory.

type UpsertResponse

type UpsertResponse struct {
	UpsertedCount int `json:"upsertedCount"`
}

UpsertResponse represents the response from an upsert operation.

type ValidationError

type ValidationError struct {
	DakeraError
}

ValidationError is raised when request validation fails.

func NewValidationError

func NewValidationError(message string, statusCode int, body interface{}, code ErrorCode) *ValidationError

func (*ValidationError) Error

func (e *ValidationError) Error() string

type Vector

type Vector struct {
	ID       string                 `json:"id"`
	Values   []float32              `json:"values,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

Vector represents a stored vector with its metadata.

type VectorInput

type VectorInput struct {
	ID       string                 `json:"id"`
	Values   []float32              `json:"values"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

VectorInput represents input for upserting a vector.

type VectorMutationOp added in v0.4.0

type VectorMutationOp string

VectorMutationOp is the mutation type for VectorsMutated events.

const (
	VectorMutationUpserted VectorMutationOp = "upserted"
	VectorMutationDeleted  VectorMutationOp = "deleted"
)

type WarmCacheRequest

type WarmCacheRequest struct {
	VectorIDs      []string `json:"vector_ids,omitempty"`
	Priority       string   `json:"priority,omitempty"`
	TargetTier     string   `json:"target_tier,omitempty"`
	Background     bool     `json:"background,omitempty"`
	TTLHintSeconds *int     `json:"ttl_hint_seconds,omitempty"`
	AccessPattern  string   `json:"access_pattern,omitempty"`
	MaxVectors     *int     `json:"max_vectors,omitempty"`
}

WarmCacheRequest represents a request to warm the cache.

type WarmCacheResponse

type WarmCacheResponse struct {
	Status        string `json:"status"`
	EntriesWarmed int    `json:"entries_warmed"`
	TimeTakenMs   *int64 `json:"time_taken_ms,omitempty"`
}

WarmCacheResponse represents the response from cache warming.

Directories

Path Synopsis
examples
advanced command
Example: Dakera Go SDK — Text Search, Hybrid Search & Admin Operations
Example: Dakera Go SDK — Text Search, Hybrid Search & Admin Operations
basic command
Example: Basic Dakera Go SDK usage
Example: Basic Dakera Go SDK usage
memory command
Example: Dakera Go SDK — Memory & Session Operations
Example: Dakera Go SDK — Memory & Session Operations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL