openai

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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