Documentation
¶
Overview ¶
Package api provides Forge-style HTTP handlers for the Weave RAG engine.
Index ¶
- type API
- type CollectionStatsRequest
- type CreateCollectionRequest
- type DeleteCollectionRequest
- type DeleteDocumentRequest
- type DeleteDocumentsBySourceRequest
- type GetCollectionRequest
- type GetDocumentRequest
- type HybridSearchRequest
- type IngestBatchRequest
- type IngestDocumentRequest
- type ListCollectionsRequest
- type ListDocumentsRequest
- type ReindexCollectionRequest
- type RetrieveRequest
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 wires all Forge-style HTTP handlers together for the Weave system.
func (*API) Handler ¶
Handler returns the fully assembled http.Handler with all routes. It panics when a route fails to register, the way http.ServeMux does on a conflicting pattern, because a handler missing routes would answer 404 where it should answer. Call RegisterRoutes to get the error instead.
func (*API) RegisterRoutes ¶
RegisterRoutes registers all Weave API routes into the given Forge router with full OpenAPI metadata. It tries every route and returns an error naming each one that failed to register, so a router that refuses a route never leaves the API silently missing it.
type CollectionStatsRequest ¶
type CollectionStatsRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
}
CollectionStatsRequest is the request for getting collection statistics.
type CreateCollectionRequest ¶
type CreateCollectionRequest struct {
Name string `json:"name" description:"Collection name"`
Description string `json:"description,omitempty" description:"Human-readable description"`
EmbeddingModel string `json:"embedding_model,omitempty" description:"Embedding model name"`
EmbeddingDims int `json:"embedding_dims,omitempty" description:"Embedding vector dimensions"`
ChunkStrategy string `json:"chunk_strategy,omitempty" description:"Chunking strategy (recursive, fixed, etc.)"`
ChunkSize int `json:"chunk_size,omitempty" description:"Target chunk size in tokens"`
ChunkOverlap int `json:"chunk_overlap,omitempty" description:"Overlap between chunks in tokens"`
Metadata map[string]string `json:"metadata,omitempty" description:"Custom metadata"`
}
CreateCollectionRequest is the request body for creating a collection.
type DeleteCollectionRequest ¶
type DeleteCollectionRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
}
DeleteCollectionRequest is the request for deleting a collection.
type DeleteDocumentRequest ¶
type DeleteDocumentRequest struct {
DocumentID string `path:"documentId" description:"Document ID"`
}
DeleteDocumentRequest is the request for deleting a document.
type DeleteDocumentsBySourceRequest ¶
type DeleteDocumentsBySourceRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
SourceKey string `query:"source_key" optional:"true" description:"Source key whose documents to delete (required)"`
}
DeleteDocumentsBySourceRequest is the request for deleting every document of a source in a collection.
type GetCollectionRequest ¶
type GetCollectionRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
}
GetCollectionRequest is the request for getting a collection by ID.
type GetDocumentRequest ¶
type GetDocumentRequest struct {
DocumentID string `path:"documentId" description:"Document ID"`
}
GetDocumentRequest is the request for getting a document by ID.
type HybridSearchRequest ¶
type HybridSearchRequest struct {
Query string `json:"query" description:"The search query"`
Collections []id.CollectionID `json:"collections,omitempty" description:"Collection IDs to search"`
TopK int `json:"top_k,omitempty" description:"Maximum number of results"`
Strategy string `json:"strategy,omitempty" description:"Search strategy"`
MinScore float64 `json:"min_score,omitempty" description:"Minimum relevance score threshold"`
}
HybridSearchRequest is the request body for hybrid search.
type IngestBatchRequest ¶
type IngestBatchRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
Documents []struct {
Title string `json:"title,omitempty" description:"Document title"`
Source string `json:"source,omitempty" description:"Source identifier"`
SourceType string `json:"source_type,omitempty" description:"MIME type or format"`
Content string `json:"content" description:"Document text content"`
Metadata map[string]string `json:"metadata,omitempty" description:"Custom metadata"`
SourceKey string `json:"source_key,omitempty" description:"Source this document is the current version of (up to 1024 bytes)"`
} `json:"documents" description:"Documents to ingest"`
}
IngestBatchRequest is the request body for batch document ingestion.
type IngestDocumentRequest ¶
type IngestDocumentRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
Title string `json:"title,omitempty" description:"Document title"`
Source string `json:"source,omitempty" description:"Source identifier (URL, path, etc.)"`
SourceType string `json:"source_type,omitempty" description:"MIME type or format hint"`
Content string `json:"content" description:"Document text content"`
Metadata map[string]string `json:"metadata,omitempty" description:"Custom metadata"`
SourceKey string `` /* 144-byte string literal not displayed */
}
IngestDocumentRequest is the request body for ingesting a document.
type ListCollectionsRequest ¶
type ListCollectionsRequest struct {
Limit int `query:"limit" optional:"true" description:"Maximum number of results (default: 50)"`
Offset int `query:"offset" optional:"true" description:"Number of results to skip"`
}
ListCollectionsRequest is the request for listing collections.
type ListDocumentsRequest ¶
type ListDocumentsRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
State string `query:"state" optional:"true" description:"Filter by document state (pending, processing, ready, failed)"`
Limit int `query:"limit" optional:"true" description:"Maximum number of results (default: 50)"`
Offset int `query:"offset" optional:"true" description:"Number of results to skip"`
}
ListDocumentsRequest is the request for listing documents.
type ReindexCollectionRequest ¶
type ReindexCollectionRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
}
ReindexCollectionRequest is the request for reindexing a collection.
type RetrieveRequest ¶
type RetrieveRequest struct {
CollectionID string `path:"collectionId" description:"Collection ID"`
Query string `json:"query" description:"The search query"`
TopK int `json:"top_k,omitempty" description:"Maximum number of results"`
MinScore float64 `json:"min_score,omitempty" description:"Minimum relevance score threshold"`
Strategy string `json:"strategy,omitempty" description:"Retrieval strategy (similarity, mmr, hybrid)"`
}
RetrieveRequest is the request body for retrieval.