rerank

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package rerank instruments Core reranking calls with OpenTelemetry.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConfig = errors.New("otel/rerank: invalid config")
	ErrInvalidModel  = errors.New("otel/rerank: invalid model")
)

Functions

This section is empty.

Types

type Middleware

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

Middleware is an immutable reranking instrumentation decorator.

func NewMiddleware

func NewMiddleware(config MiddlewareConfig) (Middleware, error)

NewMiddleware fixes instrument identity and provider binding once so every rerank contributes to the same telemetry series.

func (Middleware) Wrap

func (m Middleware) Wrap(next corererank.Model) (corererank.Model, error)

Wrap decorates one reranking Model without observing the query or documents.

type MiddlewareConfig

type MiddlewareConfig struct {
	Provider       string
	TracerProvider trace.TracerProvider
	MeterProvider  metric.MeterProvider
	// LoggerProvider receives GenAI exception events. Nil uses the global provider.
	LoggerProvider log.LoggerProvider
}

MiddlewareConfig takes providers rather than a tracer and meter so the choice of telemetry destination stays with the composition root. A nil provider falls back to the OpenTelemetry global, which is the convenient default for an application and the wrong one for a test that must observe only its own instruments.

func (MiddlewareConfig) Validate

func (m MiddlewareConfig) Validate() error

Jump to

Keyboard shortcuts

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