router

package
v0.7.21 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package router provides retrieval routing helpers that merge results from multiple retrievers and apply ranking strategies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRetriever

func NewRetriever(ctx context.Context, config *Config) (retriever.Retriever, error)

NewRetriever creates a router retriever. router retriever is useful when you want to retrieve documents from multiple retrievers with different queries. eg.

routerRetriever := router.NewRetriever(ctx, &router.Config{})
docs, err := routerRetriever.Retrieve(ctx, "how to build agent with eino")
if err != nil {
	...
}
println(docs)

Types

type Config

type Config struct {
	// Retrievers is the retrievers to be used.
	Retrievers map[string]retriever.Retriever
	// Router is the function to route the query to the retrievers.
	Router func(ctx context.Context, query string) ([]string, error)
	// FusionFunc is the function to fuse the documents from the retrievers.
	FusionFunc func(ctx context.Context, result map[string][]*schema.Document) ([]*schema.Document, error)
}

Config is the config for router retriever.

Jump to

Keyboard shortcuts

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