logger

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	ID          string    `bson:"_id" json:"id"`
	Description string    `bson:"description" json:"description"`
	CreatedAt   time.Time `bson:"createdAt" json:"createdAt"`
	TotalTokens int       `bson:"totalTokens" json:"totalTokens"`
	TotalCost   float64   `bson:"totalCost" json:"totalCost"`
}

type LogEntry

type LogEntry struct {
	ID           string    `bson:"_id,omitempty" json:"id,omitempty"`
	BatchID      string    `bson:"batchId" json:"batchId"`
	Timestamp    time.Time `bson:"timestamp" json:"timestamp"`
	Prompt       string    `bson:"prompt" json:"prompt"`
	Response     string    `bson:"response" json:"response"`
	InputTokens  int       `bson:"inputTokens" json:"inputTokens"`
	OutputTokens int       `bson:"outputTokens" json:"outputTokens"`
}

type Logger

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

func NewLogger

func NewLogger() (*Logger, error)

func (*Logger) Close

func (l *Logger) Close()

func (*Logger) CreateBatch

func (l *Logger) CreateBatch(id, description string) (primitive.ObjectID, error)

func (*Logger) GetBatches

func (l *Logger) GetBatches() ([]Batch, error)

func (*Logger) GetLogs

func (l *Logger) GetLogs(batchID string) (map[string]interface{}, error)

func (*Logger) Log

func (l *Logger) Log(batchID, prompt, response, model string, inputTokens, outputTokens int) error

type ModelPrice added in v0.1.1

type ModelPrice struct {
	Input, Output float64
}

Jump to

Keyboard shortcuts

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