service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeIngestionTask = "ingestion:process"
)

Task type constants

Variables

This section is empty.

Functions

This section is empty.

Types

type IngestionResult

type IngestionResult struct {
	TaskID               string        `json:"task_id"`
	EpisodeID            string        `json:"episode_id"`
	EntitiesCreated      int           `json:"entities_created"`
	RelationshipsCreated int           `json:"relationships_created"`
	ConflictsResolved    int           `json:"conflicts_resolved"`
	ProcessingTime       time.Duration `json:"processing_time"`
	Errors               []string      `json:"errors,omitempty"`
	Warnings             []string      `json:"warnings,omitempty"`
}

IngestionResult represents the result of processing an ingestion task

type IngestionService

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

IngestionService handles asynchronous text ingestion and processing

func NewIngestionService

func NewIngestionService(
	storageClient *storage.Client,
	llmAdapter llm.LLMAdapter,
	config *config.Config,
) *IngestionService

NewIngestionService creates a new ingestion service

func (*IngestionService) EnqueueTask

func (s *IngestionService) EnqueueTask(ctx context.Context, task *IngestionTask) error

EnqueueTask enqueues a new ingestion task

func (*IngestionService) GetQueueInfo

func (s *IngestionService) GetQueueInfo(ctx context.Context) (map[string]interface{}, error)

GetQueueInfo returns information about the task queues

func (*IngestionService) HealthCheck

func (s *IngestionService) HealthCheck(ctx context.Context) error

HealthCheck performs a health check on the ingestion service

func (*IngestionService) Start

func (s *IngestionService) Start(ctx context.Context) error

Start starts the ingestion service worker

func (*IngestionService) Stop

func (s *IngestionService) Stop()

Stop stops the ingestion service

type IngestionTask

type IngestionTask struct {
	ID        string                 `json:"id"`
	TenantID  string                 `json:"tenant_id"`
	SessionID string                 `json:"session_id"`
	Text      string                 `json:"text"`
	EventTime *time.Time             `json:"event_time,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	Source    string                 `json:"source,omitempty"`
	Priority  int                    `json:"priority,omitempty"`
}

IngestionTask represents a task for processing text input

type RetrievalRequest

type RetrievalRequest struct {
	Query             string                      `json:"query" validate:"required,min=1"`
	TenantID          types.TenantID              `json:"tenant_id" validate:"required"`
	SessionID         types.SessionID             `json:"session_id,omitempty"`
	MaxResults        int                         `json:"max_results,omitempty"`
	Format            retriever.ContextFormat     `json:"format,omitempty"`
	IncludeMetadata   bool                        `json:"include_metadata,omitempty"`
	TimeRange         *types.TimeRange            `json:"time_range,omitempty"`
	EntityTypes       []string                    `json:"entity_types,omitempty"`
	RerankingStrategy retriever.RerankingStrategy `json:"reranking_strategy,omitempty"`
	UserPreferences   *retriever.UserPreferences  `json:"user_preferences,omitempty"`
}

RetrievalRequest represents a request for context retrieval

type RetrievalResponse

type RetrievalResponse struct {
	Context         string                     `json:"context"`
	Format          retriever.ContextFormat    `json:"format"`
	TokenCount      int                        `json:"token_count"`
	EpisodeCount    int                        `json:"episode_count"`
	EntityCount     int                        `json:"entity_count"`
	SearchResults   []*retriever.SearchResult  `json:"search_results,omitempty"`
	RerankingScores []retriever.RerankingScore `json:"reranking_scores,omitempty"`
	TimeRange       *retriever.TimeRange       `json:"time_range,omitempty"`
	Metadata        map[string]interface{}     `json:"metadata,omitempty"`
	ProcessingTime  time.Duration              `json:"processing_time"`
	StepTimings     *StepTimings               `json:"step_timings,omitempty"`
}

RetrievalResponse represents the response from context retrieval

type RetrievalService

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

RetrievalService orchestrates the three-step retrieval process

func NewRetrievalService

func NewRetrievalService(
	storageClient *storage.Client,
	llmAdapter llm.LLMAdapter,
	fullConfig *config.Config,
) *RetrievalService

NewRetrievalService creates a new retrieval service

func (*RetrievalService) Close

func (rs *RetrievalService) Close() error

Close gracefully shuts down the retrieval service

func (*RetrievalService) GetSearchStats

func (rs *RetrievalService) GetSearchStats(ctx context.Context, tenantID types.TenantID) (*retriever.SearchStats, error)

GetSearchStats returns search statistics for a tenant

func (*RetrievalService) HealthCheck

func (rs *RetrievalService) HealthCheck(ctx context.Context) error

HealthCheck performs a health check on the retrieval service

func (*RetrievalService) Retrieve

Retrieve performs the complete three-step retrieval process

func (*RetrievalService) SearchOnly

SearchOnly performs only the search step without reranking or context building

type StepTimings

type StepTimings struct {
	SearchTime    time.Duration `json:"search_time"`
	RerankingTime time.Duration `json:"reranking_time"`
	BuildingTime  time.Duration `json:"building_time"`
	TotalTime     time.Duration `json:"total_time"`
}

StepTimings tracks the timing of each retrieval step

Jump to

Keyboard shortcuts

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