logger

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 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          primitive.ObjectID `bson:"_id" json:"id"`
	CreatedBy   string             `bson:"createdBy" json:"createdBy"`
	Name        string             `bson:"name" json:"name"`
	TotalTokens int                `bson:"totalTokens" json:"totalTokens"`
	InputCost   float64            `bson:"inputCost" json:"inputCost"`
	OutputCost  float64            `bson:"outputCost" json:"outputCost"`
	CreatedAt   time.Time          `bson:"createdAt" json:"createdAt"`
}

type BatchRequest added in v0.1.4

type BatchRequest struct {
	ID        string `json:"id"`
	CreatedBy string `json:"created_by"`
	Name      string `json:"name"`
}

type EntryRequest added in v0.1.4

type EntryRequest struct {
	BatchID      string `json:"batch_id"`
	CreatedBy    string `json:"created_by"`
	Name         string `json:"name"`
	Prompt       string `json:"prompt"`
	Response     string `json:"response"`
	Model        string `json:"model"`
	InputTokens  int    `json:"input_tokens"`
	OutputTokens int    `json:"output_tokens"`
}

type LogEntry

type LogEntry struct {
	ID           string    `bson:"_id,omitempty" json:"id,omitempty"`
	BatchID      string    `bson:"batchId" json:"batchId"`
	CreatedBy    string    `bson:"createdBy" json:"createdBy"`
	Timestamp    time.Time `bson:"timestamp" json:"timestamp"`
	Name         string    `bson:"name" json:"name"`
	Prompt       string    `bson:"prompt" json:"prompt"`
	Response     string    `bson:"response" json:"response"`
	ModelInfo    ModelInfo `bson:"modelInfo" json:"modelInfo"`
	InputTokens  int       `bson:"inputTokens" json:"inputTokens"`
	InputCost    float64   `bson:"inputCost" json:"inputCost"`
	OutputTokens int       `bson:"outputTokens" json:"outputTokens"`
	OutputCost   float64   `bson:"outputCost" json:"outputCost"`
}

type Logger

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

func NewLogger

func NewLogger() (*Logger, error)

func (*Logger) Close

func (l *Logger) Close(ctx context.Context)

func (*Logger) CreateBatch

func (l *Logger) CreateBatch(ctx context.Context, batchReq BatchRequest) (primitive.ObjectID, error)

func (*Logger) GetBatch added in v0.1.3

func (l *Logger) GetBatch(ctx context.Context, batchID string) (Batch, error)

func (*Logger) GetBatches

func (l *Logger) GetBatches(ctx context.Context) ([]Batch, error)

func (*Logger) GetLogs

func (l *Logger) GetLogs(ctx context.Context, batchID string) ([]LogEntry, error)

func (*Logger) Log

func (l *Logger) Log(ctx context.Context, req EntryRequest) error

type ModelInfo added in v0.1.4

type ModelInfo struct {
	Name   string  `bson:"name" json:"name"`
	Lab    string  `bson:"lab" json:"lab"`
	Input  float64 `bson:"input" json:"input"`
	Output float64 `bson:"output" json:"output"`
}

type ModelInfoMap added in v0.1.4

type ModelInfoMap map[string]ModelInfo

func (ModelInfoMap) GetModelInfo added in v0.1.4

func (m ModelInfoMap) GetModelInfo(model string) (ModelInfo, error)

Jump to

Keyboard shortcuts

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