models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package models provides functionality for managing model configurations and pricing in Langfuse.

This package allows you to define model pricing, match patterns, and manage model metadata for cost tracking and analytics. Models can be configured with different pricing structures and tokenization settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents the models API client.

func NewClient

func NewClient(cli *resty.Client) *Client

NewClient creates a new models API client.

func (*Client) Create

func (c *Client) Create(ctx context.Context, createModel *ModelEntry) (*ModelEntry, error)

Create creates a new model.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, id string) error

Delete deletes a model by ID.

func (*Client) Get

func (c *Client) Get(ctx context.Context, id string) (*ModelEntry, error)

Get retrieves a specific model by ID.

func (*Client) List

func (c *Client) List(ctx context.Context, params ListParams) (*ListModels, error)

List retrieves a list of models based on the provided parameters.

type ListModels

type ListModels struct {
	Metadata common.ListMetadata `json:"meta"`
	Data     []ModelEntry        `json:"data"`
}

ListModels represents the response from listing models.

type ListParams

type ListParams struct {
	Page  int
	Limit int
}

ListParams defines the query parameters for listing models.

func (*ListParams) ToQueryString

func (query *ListParams) ToQueryString() string

ToQueryString converts the ListParams to a URL query string.

type ModelEntry

type ModelEntry struct {
	ID              string          `json:"id,omitempty"`
	ModelName       string          `json:"modelName"`
	MatchPattern    string          `json:"matchPattern,omitempty"`
	StartDate       time.Time       `json:"startDate,omitempty"`
	InputPrice      float64         `json:"inputPrice,omitempty"`
	OutputPrice     float64         `json:"outputPrice,omitempty"`
	TotalPrice      float64         `json:"totalPrice,omitempty"`
	Unit            string          `json:"unit"`
	TokenizerId     string          `json:"tokenizerId,omitempty"`
	TokenizerConfig TokenizerConfig `json:"tokenizerConfig,omitempty"`
}

ModelEntry represents a model configuration with pricing and metadata.

A model entry defines how a model is identified (via name and match pattern), its pricing structure for input/output tokens, and tokenization configuration. Models are used for cost tracking and analytics in Langfuse.

type TokenizerConfig

type TokenizerConfig struct {
	TokensPerName    int `json:"tokensPerName,omitempty"`
	TokensPerMessage int `json:"tokensPerMessage,omitempty"`
}

TokenizerConfig represents configuration for tokenization behavior.

This configuration defines how tokens are counted for specific operations like name processing and message handling, affecting cost calculations.

Jump to

Keyboard shortcuts

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