traceloop

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func Version added in v0.0.2

func Version() string

Types

type BackoffConfig added in v0.0.2

type BackoffConfig struct {
	MaxRetries uint64
}

type Completion added in v0.0.2

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

type Config added in v0.0.2

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

type LLMSpan added in v0.0.2

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

func (*LLMSpan) LogCompletion added in v0.0.2

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

type Message added in v0.0.2

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

type Prompt added in v0.0.2

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 PromptsResponse added in v0.0.2

type PromptsResponse struct {
	Prompts     []model.Prompt `json:"prompts"`
	Environment string         `json:"environment"`
}

type Task added in v0.0.3

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

func (*Task) End added in v0.0.3

func (task *Task) End()

func (*Task) LogPrompt added in v0.0.3

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

type Traceloop

type Traceloop struct {
	http.Client
	// contains filtered or unexported fields
}

func NewClient

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

func (*Traceloop) GetOpenAIChatCompletionRequest

func (instance *Traceloop) GetOpenAIChatCompletionRequest(key string, variables map[string]any) (*openai.ChatCompletionRequest, error)

func (*Traceloop) LogPrompt

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

func (*Traceloop) NewWorkflow added in v0.0.3

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

func (*Traceloop) Shutdown

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

type Usage added in v0.0.2

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

type Workflow added in v0.0.3

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

func (*Workflow) End added in v0.0.3

func (workflow *Workflow) End()

func (*Workflow) LogPrompt added in v0.0.3

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

func (*Workflow) NewTask added in v0.0.3

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

type WorkflowAttributes added in v0.0.3

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