internal/api/semantic.go
internal/api · 143 lines · 6 declarations · source
Declarations
type semanticSurfaces
type semanticSurfaces struct {
entities *entitycandidate.Retriever
reports *reportcandidate.Retriever
passages *passage.Retriever
communities *pg.CommunityStore
}
semanticSurfaces composes the three retrievers the API already serves separately into what recall consults after exact anchoring. It lives here rather than in the recall package because it is transport-side glue over concrete stores; the correctness argument for each surface stays in the retriever that owns it, and recall sees only the bounded, scoped interface.
func NewSemanticSurfaces
func NewSemanticSurfaces(entities *entitycandidate.Retriever, reports *reportcandidate.Retriever,
passages *passage.Retriever, communities *pg.CommunityStore) recall.Semantic
NewSemanticSurfaces returns nil when no retriever is configured, so a deployment without an embedding revision keeps the exact path alone and says so in `degraded`.
var errSurfaceUnavailable
var errSurfaceUnavailable = fmt.Errorf("surface is not configured")
method semanticSurfaces.EntityAnchors
func (s *semanticSurfaces) EntityAnchors(ctx context.Context, scope, question string, limit int) ([]domain.Anchor, error)
method semanticSurfaces.Reports
func (s *semanticSurfaces) Reports(ctx context.Context, scope, question string, limit, children int) ([]domain.ReportHit, error)
method semanticSurfaces.Passages
func (s *semanticSurfaces) Passages(ctx context.Context, scope, question string, limit int, roles []string, subject string) ([]domain.Passage, error)