Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Mode determines how requests are made.
// "bridge": Create users in Coder and use their session tokens to make requests through AI Bridge.
// "direct": Make requests directly to UpstreamURL without user creation.
Mode RequestMode `json:"mode"`
// User is the configuration for the user to create.
// Required in bridge mode.
User createusers.Config `json:"user"`
// UpstreamURL is the URL to make requests to directly.
// Only used in direct mode.
UpstreamURL string `json:"upstream_url"`
// Provider is the API provider to use: "completions", "messages", or "responses".
Provider string `json:"provider"`
// RequestCount is the number of requests to make per runner.
RequestCount int `json:"request_count"`
// Stream indicates whether to use streaming requests.
Stream bool `json:"stream"`
// RequestPayloadSize is the size in bytes of the request payload (user message content).
// If 0, uses default message content.
RequestPayloadSize int `json:"request_payload_size"`
// NumMessages is the number of messages to include in the conversation.
// Messages alternate between user and assistant roles, always ending with user.
// Must be greater than 0.
NumMessages int `json:"num_messages"`
// HTTPTimeout is the timeout for individual HTTP requests to the upstream
// provider. This is separate from the job timeout which controls the overall
// test execution.
HTTPTimeout time.Duration `json:"http_timeout"`
Metrics *Metrics `json:"-"`
// RequestBody is the pre-serialized JSON request body. This is generated
// once by PrepareRequestBody and shared across all runners and requests.
RequestBody []byte `json:"-"`
}
func (Config) NewStrategy ¶
func (*Config) PrepareRequestBody ¶
PrepareRequestBody generates the conversation and serializes the full request body once. This should be called before creating Runners so that all runners share the same pre-generated payload.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(reg prometheus.Registerer) *Metrics
func (*Metrics) AddRequest ¶
func (*Metrics) ObserveDuration ¶
type ProviderStrategy ¶
type ProviderStrategy interface {
DefaultModel() string
// contains filtered or unexported methods
}
ProviderStrategy handles provider-specific message formatting for LLM APIs.
func NewProviderStrategy ¶
func NewProviderStrategy(provider string) ProviderStrategy
type RequestMode ¶
type RequestMode string
const ( RequestModeBridge RequestMode = "bridge" RequestModeDirect RequestMode = "direct" )
Click to show internal directories.
Click to hide internal directories.