openai

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package openai provides OpenInference semantic conventions hooks for OpenAI instrumentation used by the ExtProc router filter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChatCompletionRecorder

func NewChatCompletionRecorder(config *openinference.TraceConfig) tracing.ChatCompletionRecorder

NewChatCompletionRecorder creates a tracing.ChatCompletionRecorder with the given config using the OpenInference configuration specification.

Parameters:

  • config: configuration for redaction. Defaults to NewTraceConfigFromEnv().

See: https://github.com/Arize-ai/openinference/blob/main/spec/configuration.md

func NewChatCompletionRecorderFromEnv

func NewChatCompletionRecorderFromEnv() tracing.ChatCompletionRecorder

NewChatCompletionRecorderFromEnv creates an api.ChatCompletionRecorder from environment variables using the OpenInference configuration specification.

See: https://github.com/Arize-ai/openinference/blob/main/spec/configuration.md

Types

type ChatCompletionRecorder

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

ChatCompletionRecorder implements recorders for OpenInference chat completion spans.

func (*ChatCompletionRecorder) RecordRequest

func (r *ChatCompletionRecorder) RecordRequest(span trace.Span, chatReq *openai.ChatCompletionRequest, body []byte)

RecordRequest implements the same method as defined in tracing.ChatCompletionRecorder.

func (*ChatCompletionRecorder) RecordResponse

func (r *ChatCompletionRecorder) RecordResponse(span trace.Span, resp *openai.ChatCompletionResponse)

RecordResponse implements the same method as defined in tracing.ChatCompletionRecorder.

func (*ChatCompletionRecorder) RecordResponseChunks

func (r *ChatCompletionRecorder) RecordResponseChunks(span trace.Span, chunks []*openai.ChatCompletionResponseChunk)

RecordResponseChunks implements the same method as defined in tracing.ChatCompletionRecorder.

func (*ChatCompletionRecorder) RecordResponseOnError

func (r *ChatCompletionRecorder) RecordResponseOnError(span trace.Span, statusCode int, body []byte)

RecordResponseOnError implements the same method as defined in tracing.ChatCompletionRecorder.

func (*ChatCompletionRecorder) StartParams

func (r *ChatCompletionRecorder) StartParams(*openai.ChatCompletionRequest, []byte) (spanName string, opts []trace.SpanStartOption)

StartParams implements the same method as defined in tracing.ChatCompletionRecorder.

Jump to

Keyboard shortcuts

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