traceloop

package module
v0.0.0-...-849adb0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const PromptsPath = "/v1/traceloop/prompts"

Variables

This section is empty.

Functions

func Version

func Version() string

Types

type BackoffConfig

type BackoffConfig struct {
	MaxRetries uint64
}

type Completion

type Completion struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
}

type Config

type Config struct {
	BaseURL         string
	APIKey          string
	TracerName      string
	ServiceName     string
	PollingInterval time.Duration
	BackoffConfig   BackoffConfig
	Exporter        trace.SpanExporter
}

type LLMSpan

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

func (*LLMSpan) LogCompletion

func (llmSpan *LLMSpan) LogCompletion(ctx context.Context, completion Completion, usage Usage) error

type Message

type Message struct {
	Index   int    `json:"index"`
	Role    string `json:"role"`
	Content string `json:"content"`
}

type Prompt

type Prompt struct {
	Vendor           string    `json:"vendor"`
	Model            string    `json:"model"`
	Mode             string    `json:"mode"`
	Temperature      float32   `json:"temperature"`
	TopP             float32   `json:"top_p"`
	Stop             []string  `json:"stop"`
	FrequencyPenalty float32   `json:"frequency_penalty"`
	PresencePenalty  float32   `json:"presence_penalty"`
	Messages         []Message `json:"messages"`
}

type Task

type Task struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

func (*Task) End

func (task *Task) End()

func (*Task) LogPrompt

func (task *Task) LogPrompt(prompt Prompt) (LLMSpan, error)

type Traceloop

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

func NewClient

func NewClient(ctx context.Context, config Config) (*Traceloop, error)

func (*Traceloop) LogPrompt

func (instance *Traceloop) LogPrompt(ctx context.Context, prompt Prompt, workflowAttrs WorkflowAttributes) (LLMSpan, error)

func (*Traceloop) NewWorkflow

func (instance *Traceloop) NewWorkflow(ctx context.Context, attrs WorkflowAttributes) *Workflow

func (*Traceloop) Shutdown

func (instance *Traceloop) Shutdown(ctx context.Context)

type Usage

type Usage struct {
	TotalTokens      int `json:"total_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	PromptTokens     int `json:"prompt_tokens"`
}

type Workflow

type Workflow struct {
	Attributes WorkflowAttributes `json:"workflow_attributes"`
	// contains filtered or unexported fields
}

func (*Workflow) End

func (workflow *Workflow) End()

func (*Workflow) LogPrompt

func (workflow *Workflow) LogPrompt(prompt Prompt) (LLMSpan, error)

func (*Workflow) NewTask

func (workflow *Workflow) NewTask(name string) *Task

type WorkflowAttributes

type WorkflowAttributes struct {
	Name                  string            `json:"workflow_name"`
	AssociationProperties map[string]string `json:"association_properties"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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