Documentation
¶
Overview ¶
Package modeltest checks an HTTP-backed agent.Model against the streaming contract the agent loop relies on:
- The adapter releases its response when the consumer stops early. An adapter that reads a streamed response in its own goroutine and sends each event on an unbuffered channel blocks forever once nobody is receiving, holding the response body and its connection. Breaking out of Stream.Events, or cancelling the context passed to Model.Stream, must close the response body.
- A response that ends before the provider's end-of-turn marker is an error. A connection closed partway through a turn must never read as a complete message, which the agent would journal as the model's answer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(t *testing.T, newModel func(baseURL string, client *http.Client) agent.Model, event func(i int) string)
Run runs the checks. newModel returns the adapter under test pointed at baseURL and using client for its requests. event returns the i-th server-sent event of an endless text response, in the provider's wire format and including its trailing blank line; it must not end the turn. The test server sends one every few milliseconds until the client goes away, as a long model response does, or, for the truncation check, stops after two.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.