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 ¶
- type Client
- func (c *Client) Create(ctx context.Context, createModel *ModelEntry) (*ModelEntry, error)
- func (c *Client) Delete(ctx context.Context, id string) error
- func (c *Client) Get(ctx context.Context, id string) (*ModelEntry, error)
- func (c *Client) List(ctx context.Context, params ListParams) (*ListModels, error)
- type ListModels
- type ListParams
- type ModelEntry
- type TokenizerConfig
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 (*Client) Create ¶
func (c *Client) Create(ctx context.Context, createModel *ModelEntry) (*ModelEntry, error)
Create creates a new model.
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 ¶
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.