Mock AI provider responses for testing, development, and simulation purposes.
{{provider}}
- Provider name (e.g., “openai”, “anthropic”){{model}}
- Model name (e.g., “gpt-4”, “claude-3”){{faker.*}}
- Fake data generation (see Configuration Reference)Field | Type | Default | Description |
---|---|---|---|
Enabled | bool | false | Enable/disable the entire plugin |
DefaultBehavior | string | "passthrough" | Action when no rules match: "passthrough" , "success" , "error" |
GlobalLatency | *Latency | nil | Global latency applied to all rules |
Rules | []MockRule | [] | List of mock rules evaluated in priority order |
Field | Type | Default | Description |
---|---|---|---|
Name | string | - | Unique rule name for identification |
Enabled | bool | true | Enable/disable this specific rule |
Priority | int | 0 | Higher numbers = higher priority |
Probability | float64 | 1.0 | Activation probability (0.0=never, 1.0=always) |
Conditions | Conditions | {} | Matching conditions (empty = match all) |
Responses | []Response | - | Possible responses (weighted random selection) |
Latency | *Latency | nil | Rule-specific latency override |
Field | Type | Description |
---|---|---|
Providers | []string | Match specific providers: ["openai", "anthropic"] |
Models | []string | Match specific models: ["gpt-4", "claude-3"] |
MessageRegex | *string | Regex pattern to match message content |
RequestSize | *SizeRange | Request size constraints in bytes |
Field | Type | Description |
---|---|---|
Type | string | Response type: "success" or "error" |
Weight | float64 | Weight for random selection (default: 1.0) |
Content | *SuccessResponse | Required if Type="success" |
Error | *ErrorResponse | Required if Type="error" |
AllowFallbacks | *bool | Control fallback behavior (nil =allow, false =block) |
Field | Type | Description |
---|---|---|
Message | string | Static response message |
MessageTemplate | *string | Template with variables: {{provider}} , {{model}} , {{faker.*}} |
Model | *string | Override model name in response |
Usage | *Usage | Token usage information |
FinishReason | *string | Completion reason (default: "stop" ) |
CustomFields | map[string]interface{} | Additional metadata fields |
Field | Type | Description |
---|---|---|
Message | string | Error message to return |
Type | *string | Error type (e.g., "rate_limit" , "auth_error" ) |
Code | *string | Error code (e.g., "429" , "401" ) |
StatusCode | *int | HTTP status code |
Field | Type | Description |
---|---|---|
Type | string | Latency type: "fixed" or "uniform" |
Min | time.Duration | Minimum/exact latency (use time.Millisecond ) |
Max | time.Duration | Maximum latency (required for "uniform" ) |
time.Duration
constants:
100 * time.Millisecond
100
(nanoseconds, barely noticeable){{faker.name}}
- Full name{{faker.first_name}}
- First name only{{faker.last_name}}
- Last name only{{faker.email}}
- Email address{{faker.phone}}
- Phone number{{faker.address}}
- Street address{{faker.city}}
- City name{{faker.state}}
- State/province{{faker.zip_code}}
- Postal code{{faker.company}}
- Company name{{faker.job_title}}
- Job title{{faker.lorem_ipsum}}
- Lorem ipsum text{{faker.lorem_ipsum:10}}
- Lorem ipsum with 10 words{{faker.uuid}}
- UUID v4{{faker.hex_color}}
- Hex color code{{faker.integer}}
- Random integer (1-100){{faker.integer:10,50}}
- Random integer between 10-50{{faker.float}}
- Random float (0-100, 2 decimals){{faker.float:1,10}}
- Random float between 1-10{{faker.boolean}}
- Random boolean{{faker.date}}
- Date (YYYY-MM-DD format){{faker.datetime}}
- Datetime (YYYY-MM-DD HH:MM:SS format)Enabled: true
rule.Enabled: true
Probability: 1.0
for testingtime.Duration
constants, not raw integers: