Documentation
¶
Overview ¶
Package anthropictest is a fake Anthropic API for tests: the Messages API, token counting and List Workspaces, answering as the test sets it up and recording what it was sent. Serve it with httptest.NewServer and point models.Deps.AnthropicURL at it.
Index ¶
Constants ¶
View Source
const WorkspaceNeeded = "This API key is not scoped to a workspace, so this request must include the anthropic-workspace-id header " +
"with the ID of the workspace to use. Add the header, or use an API key that is scoped to a workspace."
WorkspaceNeeded is Anthropic's refusal of a request that names no workspace, made with a key that covers a whole organisation (as the daemon logged it on 2026-10-07, MAI-57).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Workspaces []Workspace // what List Workspaces lists
ListStatus int // non-zero: List Workspaces is refused with this status
ProbeStatus int // non-zero: count_tokens is refused with this status; 400 = for want of a workspace
NeedsWorkspace bool // a message that names no workspace is refused with WorkspaceNeeded
Answer string // the tool input every message answers with; empty = {}
}
Config is how the fake answers.
type Seen ¶
type Seen struct {
Lists, Probes int
ListQuery string // the query of the last List Workspaces call
MessageWorkspaces []string // the anthropic-workspace-id of every message, in order; "" = none
APIKeys []string // the x-api-key of every request
}
Seen is what the fake was sent.
Click to show internal directories.
Click to hide internal directories.