Help us shape the future of Go! Take the 2026 Go Developer Survey

systemonetest

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package systemonetest provides a fake System One endpoint for the tests of the plugins that serve decision models.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// Models is the reply to a GET, the model listing. When empty, a GET
	// fails with a server error.
	Models string
	// Usage, when set, is the usage of every answer, in place of 312
	// input tokens and 48 output tokens.
	Usage map[string]any
	// Wrap, when set, wraps every answer in a server's envelope.
	Wrap func(reply map[string]any) any
	// contains filtered or unexported fields
}

Server answers whatever questions it is sent, so a test can check the whole path from a Go type to the wire and back. A choice is answered with its first option by name, a score with 1.3, a noul with 0.93, from the model jev-1.13.0 with 312 input tokens and 48 output tokens.

func (*Server) Calls

func (s *Server) Calls() int

Calls is how many requests were posted.

func (*Server) Last

func (s *Server) Last(t *testing.T) (*http.Request, map[string]any)

Last is the last request posted and its JSON body. It fails the test when nothing was posted.

func (*Server) Listings

func (s *Server) Listings() []string

Listings are the paths, with their queries, of the listings asked for.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler.

Jump to

Keyboard shortcuts

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