loadtest

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LatencyProfile

type LatencyProfile struct {
	TTFTMs                    [2]int `json:"ttft_ms"`
	ChunkCount                [2]int `json:"chunk_count"`
	ChunkIntervalMs           [2]int `json:"chunk_interval_ms"`
	TotalWallTimeMsPerRequest [2]int `json:"total_wall_time_ms_per_request"`
}

LatencyProfile describes one named latency mix for mock streaming.

type MockLLM

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

MockLLM is an in-process llm.LanguageModel for load tests.

func NewMockLLM

func NewMockLLM(profile MockProfile) *MockLLM

NewMockLLM constructs a mock LLM using the given profile (must be validated).

func (*MockLLM) ChatCompletion

func (m *MockLLM) ChatCompletion(ctx context.Context, req llm.CompletionRequest, opts ...llm.LanguageModelOption) (*llm.TextStreamResult, error)

ChatCompletion streams a synthetic response.

func (*MockLLM) ChatCompletionNoStream

func (m *MockLLM) ChatCompletionNoStream(ctx context.Context, req llm.CompletionRequest, opts ...llm.LanguageModelOption) (string, error)

ChatCompletionNoStream returns the final mock text after honoring wall-clock pacing.

func (*MockLLM) CountTokens

func (m *MockLLM) CountTokens(_ context.Context, request llm.CompletionRequest, _ ...llm.LanguageModelOption) (int, error)

CountTokens approximates input tokens across the request's posts. The mock always returns a count, so callers never fall back to EstimateTokens.

func (*MockLLM) InputTokenLimit

func (m *MockLLM) InputTokenLimit() int

InputTokenLimit returns a generous limit for load testing.

func (*MockLLM) OutputTokenLimit

func (m *MockLLM) OutputTokenLimit() int

OutputTokenLimit returns a generous limit for load testing.

type MockProfile

type MockProfile struct {
	Name                     string                         `json:"name"`
	Seed                     int64                          `json:"seed"`
	LatencyProfiles          map[string]LatencyProfile      `json:"latency_profiles"`
	ProfileWeights           map[string]float64             `json:"profile_weights"`
	ReasoningSkipProbability float64                        `json:"reasoning_skip_probability"`
	StreamingEnabled         bool                           `json:"streaming_enabled"`
	ToolUseProbability       float64                        `json:"tool_use_probability"`
	ToolWeights              map[string]float64             `json:"tool_weights"`
	MaxToolRounds            int                            `json:"max_tool_rounds"`
	ToolArgumentProfiles     map[string]ToolArgumentProfile `json:"tool_argument_profiles,omitempty"`
	FinalResponseTemplates   []string                       `json:"final_response_templates"`
}

MockProfile configures load-test LLM behavior.

func DefaultReadSearchHeavyProfile

func DefaultReadSearchHeavyProfile() MockProfile

DefaultReadSearchHeavyProfile returns the documented empirical defaults for read/search-heavy load tests.

func ParseProfile

func ParseProfile(raw json.RawMessage) (MockProfile, error)

ParseProfile merges operator JSON on top of the default profile. Nil, empty, or whitespace-only raw returns the default.

func (MockProfile) Summary

func (p MockProfile) Summary() string

Summary returns a compact operator-facing description for logging.

func (MockProfile) Validate

func (p MockProfile) Validate() error

Validate checks profile invariants.

type ToolArgumentProfile

type ToolArgumentProfile struct {
	PostLimits     []int    `json:"post_limits,omitempty"`
	SearchQueries  []string `json:"search_queries,omitempty"`
	SearchLimits   []int    `json:"search_limits,omitempty"`
	MessageLengths []int    `json:"message_lengths,omitempty"`
	Usernames      []string `json:"usernames,omitempty"`
	ChannelIDs     []string `json:"channel_ids,omitempty"`
	ChannelNames   []string `json:"channel_names,omitempty"`
	TeamIDs        []string `json:"team_ids,omitempty"`
	TeamNames      []string `json:"team_names,omitempty"`
	PostIDs        []string `json:"post_ids,omitempty"`
}

ToolArgumentProfile holds optional discrete values for argument generation per tool.

Jump to

Keyboard shortcuts

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