Documentation
¶
Overview ¶
Package openai provides OpenInference semantic conventions hooks for OpenAI instrumentation used by the ExtProc router filter.
Index ¶
- func NewChatCompletionRecorder(config *openinference.TraceConfig) tracing.ChatCompletionRecorder
- func NewChatCompletionRecorderFromEnv() tracing.ChatCompletionRecorder
- type ChatCompletionRecorder
- func (r *ChatCompletionRecorder) RecordRequest(span trace.Span, chatReq *openai.ChatCompletionRequest, body []byte)
- func (r *ChatCompletionRecorder) RecordResponse(span trace.Span, resp *openai.ChatCompletionResponse)
- func (r *ChatCompletionRecorder) RecordResponseChunks(span trace.Span, chunks []*openai.ChatCompletionResponseChunk)
- func (r *ChatCompletionRecorder) RecordResponseOnError(span trace.Span, statusCode int, body []byte)
- func (r *ChatCompletionRecorder) StartParams(*openai.ChatCompletionRequest, []byte) (spanName string, opts []trace.SpanStartOption)
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.