model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Code generated by protoc-gen-api. DO NOT EDIT. source: malonaz/ai/v1/chat.proto

Code generated by protoc-gen-api. DO NOT EDIT. source: malonaz/ai/v1/errors.proto

Code generated by protoc-gen-api. DO NOT EDIT. source: malonaz/ai/v1/message.proto

Code generated by protoc-gen-api. DO NOT EDIT. source: malonaz/ai/v1/metrics.proto

Code generated by protoc-gen-api. DO NOT EDIT. source: malonaz/ai/v1/model.proto

Code generated by protoc-gen-api. DO NOT EDIT. source: malonaz/ai/v1/tool.proto

Code generated by protoc-gen-api. DO NOT EDIT. source: malonaz/ai/v1/voice.proto

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChatAlreadyExists  = errors.New("chat already exists")
	ErrChatNotExist       = errors.New("chat does not exist")
	ErrChatAlreadyDeleted = errors.New("chat already deleted")
	ErrChatETagChanged    = errors.New("chat etag changed")
)

Functions

func ParseChatName

func ParseChatName(name string) (string, string, string, error)

Types

type Chat

type Chat struct {
	OrganizationID string `db:"organization_id"`

	UserID string `db:"user_id"`

	ChatID string `db:"chat_id"`

	CreateTime time.Time  `db:"create_time"`
	UpdateTime time.Time  `db:"update_time"`
	DeleteTime *time.Time `db:"delete_time"`
	Etag       string     `db:"etag"`
	Labels     []byte     `db:"labels"`
	Metadata   []byte     `db:"metadata"`
}

func ChatFromPb

func ChatFromPb(m *v1.Chat) (*Chat, error)

func (*Chat) ToPb

func (m *Chat) ToPb() (*v1.Chat, error)

type ChatStatsRow

type ChatStatsRow struct {
	Bucket *time.Time `db:"bucket"`
	Count  int32      `db:"count"`
	Price  float64    `db:"price"`
}

ChatStatsRow is one aggregated row of the chat stats query, grouped by bucket. Bucket is nil when no granularity is requested.

type MessageStatsRow

type MessageStatsRow struct {
	Bucket *time.Time `db:"bucket"`
	Model  string     `db:"model"`
	Count  int32      `db:"count"`
	Price  float64    `db:"price"`

	InputTokenQuantity  int64   `db:"input_token_quantity"`
	InputTokenPrice     float64 `db:"input_token_price"`
	OutputTokenQuantity int64   `db:"output_token_quantity"`
	OutputTokenPrice    float64 `db:"output_token_price"`

	OutputReasoningTokenQuantity int64   `db:"output_reasoning_token_quantity"`
	OutputReasoningTokenPrice    float64 `db:"output_reasoning_token_price"`

	InputTokenCacheReadQuantity  int64   `db:"input_token_cache_read_quantity"`
	InputTokenCacheReadPrice     float64 `db:"input_token_cache_read_price"`
	InputTokenCacheWriteQuantity int64   `db:"input_token_cache_write_quantity"`
	InputTokenCacheWritePrice    float64 `db:"input_token_cache_write_price"`

	InputSecondQuantity    int64   `db:"input_second_quantity"`
	InputSecondPrice       float64 `db:"input_second_price"`
	OutputSecondQuantity   int64   `db:"output_second_quantity"`
	OutputSecondPrice      float64 `db:"output_second_price"`
	InputCharacterQuantity int64   `db:"input_character_quantity"`
	InputCharacterPrice    float64 `db:"input_character_price"`

	InputImageTokenQuantity           int64   `db:"input_image_token_quantity"`
	InputImageTokenPrice              float64 `db:"input_image_token_price"`
	OutputImageTokenQuantity          int64   `db:"output_image_token_quantity"`
	OutputImageTokenPrice             float64 `db:"output_image_token_price"`
	InputImageTokenCacheReadQuantity  int64   `db:"input_image_token_cache_read_quantity"`
	InputImageTokenCacheReadPrice     float64 `db:"input_image_token_cache_read_price"`
	InputImageTokenCacheWriteQuantity int64   `db:"input_image_token_cache_write_quantity"`
	InputImageTokenCacheWritePrice    float64 `db:"input_image_token_cache_write_price"`
}

MessageStatsRow is one aggregated row of the message stats query, grouped by (bucket, model). Model is empty for messages that were not generated by a model (user, system and tool messages). Bucket is nil when no granularity is requested.

Every priced category of malonaz.ai.v1.ModelUsage is aggregated separately; the categories are disjoint, so callers can sum whichever ones they need.

Jump to

Keyboard shortcuts

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