Documentation
¶
Index ¶
- func GetOpenAITokenCount(messages []goopenai.ChatCompletionMessage) (numTokens int)
- type AggregatedResponse
- type ChatCompletionStream
- type Client
- type LangfuseTraceOption
- func WithMetadata(metadata map[string]any) LangfuseTraceOption
- func WithParentObservationID(parentObservationID string) LangfuseTraceOption
- func WithRelease(release string) LangfuseTraceOption
- func WithSessionID(sessionID string) LangfuseTraceOption
- func WithTags(tags []string) LangfuseTraceOption
- func WithTraceID(traceID string) LangfuseTraceOption
- func WithUserID(userID string) LangfuseTraceOption
- type LangfuseTraceOptions
- type StreamReader
- type Streamable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOpenAITokenCount ¶ added in v0.3.0
func GetOpenAITokenCount(messages []goopenai.ChatCompletionMessage) (numTokens int)
Types ¶
type AggregatedResponse ¶
type ChatCompletionStream ¶
type ChatCompletionStream StreamReader[goopenai.ChatCompletionStreamResponse]
func NewChatCompletionStreamWrapper ¶
func NewChatCompletionStreamWrapper(traceID string, observationID string, request *goopenai.ChatCompletionRequest, upstream *goopenai.ChatCompletionStream, langfuseClient *hlangfuse.Langfuse) ChatCompletionStream
type Client ¶
func (*Client) CreateChatCompletion ¶
func (c *Client) CreateChatCompletion( ctx context.Context, request goopenai.ChatCompletionRequest, langfuseTraceOptions ...LangfuseTraceOption, ) (response goopenai.ChatCompletionResponse, err error)
func (*Client) CreateChatCompletionStream ¶
func (c *Client) CreateChatCompletionStream( ctx context.Context, request goopenai.ChatCompletionRequest, langfuseTraceOptions ...LangfuseTraceOption, ) (ChatCompletionStream, error)
type LangfuseTraceOption ¶
type LangfuseTraceOption func(*LangfuseTraceOptions)
func WithMetadata ¶
func WithMetadata(metadata map[string]any) LangfuseTraceOption
func WithParentObservationID ¶
func WithParentObservationID(parentObservationID string) LangfuseTraceOption
func WithRelease ¶
func WithRelease(release string) LangfuseTraceOption
func WithSessionID ¶
func WithSessionID(sessionID string) LangfuseTraceOption
func WithTags ¶
func WithTags(tags []string) LangfuseTraceOption
func WithTraceID ¶
func WithTraceID(traceID string) LangfuseTraceOption
func WithUserID ¶
func WithUserID(userID string) LangfuseTraceOption
type LangfuseTraceOptions ¶
type LangfuseTraceOptions struct { TraceID string ParentObservationID string SessionID string UserID string Metadata map[string]any Tags []string Release string }
func ApplyTraceOptions ¶
func ApplyTraceOptions(options []LangfuseTraceOption) *LangfuseTraceOptions
type StreamReader ¶
type StreamReader[T Streamable] interface { Recv() (T, error) Close() error GetRateLimitHeaders() goopenai.RateLimitHeaders Header() http.Header }
type Streamable ¶
type Streamable interface { goopenai.ChatCompletionStreamResponse | goopenai.CompletionResponse }
Click to show internal directories.
Click to hide internal directories.