Documentation
¶
Overview ¶
Package systemonetest provides a scriptable fake System One server that emulates Ollama 0.35 and Jev-compatible remote gateways. It is used by Go tests and by the WebUI Playwright run.
Index ¶
- Constants
- type Mode
- type Option
- type Recorded
- type Server
- func (s *Server) BaseURL() string
- func (s *Server) Count(path string) int
- func (s *Server) Delay(d time.Duration)
- func (s *Server) FailNext(status int)
- func (s *Server) Requests() []Recorded
- func (s *Server) Reset()
- func (s *Server) SetCost(c float64)
- func (s *Server) SetDecision(choice string, probs map[string]float64)
- func (s *Server) SetQuestionDecision(question, choice string, probs map[string]float64)
- func (s *Server) SetRawResponse(body string)
Constants ¶
const ( DuplicateChargeP = 0.9760968387170561 DuplicateChargeConfidence = 0.9145015492062412 )
Recorded probability values of DuplicateChargeResponseJSON.
const DuplicateChargeResponseJSON = `` /* 274-byte string literal not displayed */
DuplicateChargeResponseJSON is the recorded /v1/systemone answer for a billing-intent question.
const OllamaShowTev1JSON = `` /* 158-byte string literal not displayed */
OllamaShowTev1JSON is the /api/show body for tev1:0.8b.
const OllamaTagsJSON = `` /* 845-byte string literal not displayed */
OllamaTagsJSON is the /api/tags body used by NewOllama035.
const OllamaVersionJSON = `{"version":"0.35.0"}`
OllamaVersionJSON is the /api/version body.
const OpenRouterModelsJSON = `{"data":[{"id":"openai/gpt-5"},{"id":"typesafe/jev-1.13"},{"id":"~typesafe/jev-latest"}]}`
OpenRouterModelsJSON is an OpenAI-style mixed catalogue.
const TypeSafeModelsJSON = `{"models":["jev-latest","jev-1.13"]}`
TypeSafeModelsJSON is the {"models":[...]} shape.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Server)
Option customises a Server.
func WithAPIKey ¶
WithAPIKey requires "Authorization: Bearer <key>" on every request.
func WithAcceptedModels ¶
WithAcceptedModels restricts the model ids accepted by /v1/systemone.
func WithModelsJSON ¶
WithModelsJSON sets the /v1/models body (remote mode) and the set of ids accepted by /v1/systemone.
func WithModelsStatus ¶
WithModelsStatus makes /v1/models answer with the given status (e.g. 404).
func WithShowJSON ¶
WithShowJSON overrides the /api/show body (Ollama mode).
func WithTagsJSON ¶
WithTagsJSON overrides the /api/tags body (Ollama mode).
func WithVersion ¶
WithVersion overrides the /api/version value (Ollama mode).
type Server ¶
Server is the fake backend.
func NewOllama035 ¶
NewOllama035 starts a server serving the recorded Ollama 0.35.0 fixtures.
func (*Server) FailNext ¶
FailNext queues an error status for the next request (any path). Several calls queue several failures, consumed in order.
func (*Server) SetDecision ¶
SetDecision scripts the answer returned for every choice question. A nil probs map gives probability 1 to choice.
func (*Server) SetQuestionDecision ¶
SetQuestionDecision scripts the answer for one named question, overriding SetDecision for that question only.
func (*Server) SetRawResponse ¶
SetRawResponse scripts a verbatim 200 body for /v1/systemone.