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

rag

package
v1.152.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToolSet added in v1.60.0

func CreateToolSet(ctx context.Context, toolset latest.Toolset, parentDir string, runConfig *config.RuntimeConfig) (tools.ToolSet, error)

CreateToolSet is used by the tools registry.

func Creator added in v1.132.0

func Creator(ctx context.Context, toolset latest.Toolset, parentDir string, runConfig *config.RuntimeConfig, _ string) (tools.ToolSet, error)

Creator builds this toolset from its YAML declaration. It matches teamloader.ToolsetCreator so it can be registered directly:

teamloader.NewToolsetRegistry(map[string]teamloader.ToolsetCreator{"rag": rag.Creator})

Types

type EventCallback

type EventCallback = ragtypes.EventCallback

EventCallback is called to forward RAG manager events during initialization.

type Option added in v1.134.0

type Option func(*ToolSet)

Option configures optional ToolSet behavior.

func WithIndexingTimeout added in v1.134.0

func WithIndexingTimeout(d time.Duration) Option

WithIndexingTimeout bounds a single Initialize call started by Start, independent of the caller's own (much shorter) start-wait budget. Zero (the default) means unbounded.

type ToolSet added in v1.60.0

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

ToolSet provides document querying capabilities for a single RAG source.

func New added in v1.60.0

func New(manager backend, toolName string, opts ...Option) *ToolSet

New creates a new RAG toolset for a single RAG manager.

func (*ToolSet) Instructions added in v1.60.0

func (t *ToolSet) Instructions() string

func (*ToolSet) Name added in v1.60.0

func (t *ToolSet) Name() string

Name returns the tool name for this RAG source.

func (*ToolSet) SetEventCallback added in v1.60.0

func (t *ToolSet) SetEventCallback(cb EventCallback)

SetEventCallback replaces the single legacy callback receiving RAG manager events; nil clears it. Hosts sharing the toolset should use SubscribeEvents.

func (*ToolSet) Start added in v1.60.0

func (t *ToolSet) Start(ctx context.Context) error

Start initializes the RAG manager (indexes documents) and starts a file watcher for incremental updates.

Indexing is detached from the caller's cancellation, just like the file watcher: Start may run under a short-lived startup-probe context (the wait budget documented on tools.DefaultStartTimeout / TryStartWithTimeout), and a caller giving up on that budget must not abort in-flight work — TryStartWithTimeout already promises that an abandoned Start keeps running and is picked up by a later call once it completes. Indexing is instead bounded only by indexingTimeout (see WithIndexingTimeout; zero means unbounded) and by Stop.

func (*ToolSet) Stop added in v1.60.0

func (t *ToolSet) Stop(_ context.Context) error

Stop closes the RAG manager and releases resources.

func (*ToolSet) SubscribeEvents added in v1.140.0

func (t *ToolSet) SubscribeEvents(cb EventCallback) func()

SubscribeEvents registers cb to receive RAG manager events until the returned function is called. Safe before or after Start.

func (*ToolSet) Tools added in v1.60.0

func (t *ToolSet) Tools(context.Context) ([]tools.Tool, error)

Jump to

Keyboard shortcuts

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