openai

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAIEmbedder

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

func NewOpenAIEmbedder added in v0.2.2

func NewOpenAIEmbedder(
	apiKey, model, baseURL string,
	dimensions int,
	tp trace.TracerProvider,
	prop propagation.TextMapPropagator,
) *OpenAIEmbedder

NewOpenAIEmbedder constructs an OpenAIEmbedder with a local *http.Client whose transport is instrumented with otelhttp. The caller must supply a ParticipatingPropagator (already wrapped with WithNoBaggage) so that Inject is a no-op on untraced requests and Baggage is never forwarded to the third-party OpenAI endpoint, regardless of which propagation format is configured.

tp must be the scoped TracerProvider from BuildServer. prop must be the result of tracing.NewParticipatingPropagator(tracing.WithNoBaggage(configured)).

func (*OpenAIEmbedder) Dimension

func (e *OpenAIEmbedder) Dimension() int

func (*OpenAIEmbedder) EmbedTexts

func (e *OpenAIEmbedder) EmbedTexts(ctx context.Context, texts []string) ([][]float32, error)

func (*OpenAIEmbedder) ModelName

func (e *OpenAIEmbedder) ModelName() string

Jump to

Keyboard shortcuts

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