Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API provides methods to interact with the document storage.

func NewAPI

func NewAPI(storage *storage.Storage, llm *llm.Embeddings) *API

NewAPI creates a new API instance.

func (*API) DeleteDocument

func (a *API) DeleteDocument(url, context string) error

DeleteDocument deletes a document by URL.

func (*API) GetContexts added in v1.0.18

func (a *API) GetContexts() ([]string, error)

GetContexts retrieves a list of unique contexts.

func (*API) GetDocument

func (a *API) GetDocument(url string, context string) (*storage.Document, error)

GetDocument retrieves a document by URL.

func (*API) ListDocuments

func (a *API) ListDocuments(context string, limit int) ([]*storage.Document, error)

ListDocuments lists all documents, optionally filtered by context.

func (*API) Llm

func (a *API) Llm() *llm.Embeddings

Llm returns the llm instance.

func (*API) Search

func (a *API) Search(query string, numResults int, context string) ([]SearchResult, error)

Search finds the most similar documents to a query, up to numResults, optionally filtered by context.

func (*API) UpsertDirect

func (a *API) UpsertDirect(doc *storage.Document) error

UpsertDirect upserts a document directly.

func (*API) UpsertDocument

func (a *API) UpsertDocument(baseURL, url, title, description, content, checksum, context, sourceType string, embeddings []float32) error

UpsertDocument stores a new document or updates an existing one.

type SearchResult

type SearchResult struct {
	Doc   *storage.Document
	Score float64
}

Jump to

Keyboard shortcuts

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