modelproxyapi

package
v0.1.54 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package modelproxyapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSpec

func GetSpec() (swagger *openapi3.T, err error)

GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.

func GetSpecJSON

func GetSpecJSON() ([]byte, error)

GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.

func GetSwagger deprecated

func GetSwagger() (*openapi3.T, error)

GetSwagger returns the OpenAPI specification corresponding to the generated code in this file.

Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger to openapi3.T. Use GetSpec instead. This wrapper is retained for backwards compatibility.

func NewCancelModelCallRequest

func NewCancelModelCallRequest(server string, callId Id) (*http.Request, error)

NewCancelModelCallRequest constructs an http.Request for the CancelModelCall method

func NewCreateModelCallRequest

func NewCreateModelCallRequest(server string, body CreateModelCallJSONRequestBody) (*http.Request, error)

NewCreateModelCallRequest calls the generic CreateModelCall builder with application/json body

func NewCreateModelCallRequestWithBody

func NewCreateModelCallRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCreateModelCallRequestWithBody constructs an http.Request for the CreateModelCall method, with any body, and a specified content type

func NewGetModelCallRequest

func NewGetModelCallRequest(server string, callId Id) (*http.Request, error)

NewGetModelCallRequest constructs an http.Request for the GetModelCall method

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type CancelModelCallResponse

type CancelModelCallResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON202 the response for an HTTP 202 `application/json` response
	JSON202 *ModelCall
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
	// JSON503 the response for an HTTP 503 `application/json` response
	JSON503 *Error
}

func ParseCancelModelCallResponse

func ParseCancelModelCallResponse(rsp *http.Response) (*CancelModelCallResponse, error)

ParseCancelModelCallResponse parses an HTTP response from a CancelModelCallWithResponse call

func (CancelModelCallResponse) ContentType

func (r CancelModelCallResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (CancelModelCallResponse) GetBody

func (r CancelModelCallResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (CancelModelCallResponse) GetJSON202

func (r CancelModelCallResponse) GetJSON202() *ModelCall

GetJSON202 returns the response for an HTTP 202 `application/json` response

func (CancelModelCallResponse) GetJSON404

func (r CancelModelCallResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (CancelModelCallResponse) GetJSON503

func (r CancelModelCallResponse) GetJSON503() *Error

GetJSON503 returns the response for an HTTP 503 `application/json` response

func (CancelModelCallResponse) Status

func (r CancelModelCallResponse) Status() string

Status returns HTTPResponse.Status

func (CancelModelCallResponse) StatusCode

func (r CancelModelCallResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) CancelModelCall

func (c *Client) CancelModelCall(ctx context.Context, callId Id, reqEditors ...RequestEditorFn) (*http.Response, error)

CancelModelCall performs a POST /model-calls/{callId}/cancellations (the `CancelModelCall` operationId) request.

Expresses cancel intent; already incurred usage stays in the ledger.

func (*Client) CreateModelCall

func (c *Client) CreateModelCall(ctx context.Context, body CreateModelCallJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateModelCall performs a POST /model-calls (the `CreateModelCall` operationId) request. Takes a body of the `application/json` content type.

Opens a model call and streams frames. The response is Server-Sent Events; the final frame is `done` or `error`. A lost response is queried by callId, never resent. D4a (DEC-070): a caller that reads the frames' stream identity sends `Accept: text/event-stream; frame-identity=1`; a Proxy that honours it answers `Content-Type: text/event-stream; frame-identity=1`, and the frames carry `frameOrigin` (all of them, except the original frames of a call recorded before D4a, which have no stream to name). Without the parameter the frames are as before D4a, so a reader validating an older contract never meets the members; a Proxy before D4a ignores it and answers the plain type.

func (*Client) CreateModelCallWithBody

func (c *Client) CreateModelCallWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateModelCallWithBody performs a POST /model-calls (the `CreateModelCall` operationId) request, with any type of body and a specified content type.

Opens a model call and streams frames. The response is Server-Sent Events; the final frame is `done` or `error`. A lost response is queried by callId, never resent. D4a (DEC-070): a caller that reads the frames' stream identity sends `Accept: text/event-stream; frame-identity=1`; a Proxy that honours it answers `Content-Type: text/event-stream; frame-identity=1`, and the frames carry `frameOrigin` (all of them, except the original frames of a call recorded before D4a, which have no stream to name). Without the parameter the frames are as before D4a, so a reader validating an older contract never meets the members; a Proxy before D4a ignores it and answers the plain type.

func (*Client) GetModelCall

func (c *Client) GetModelCall(ctx context.Context, callId Id, reqEditors ...RequestEditorFn) (*http.Response, error)

GetModelCall performs a GET /model-calls/{callId} (the `GetModelCall` operationId) request.

Queries the original call outcome and usage; querying never sends again.

type ClientInterface

type ClientInterface interface {

	// CreateModelCallWithBody performs a POST /model-calls (the `CreateModelCall` operationId) request,
	// with any type of body and a specified content type.
	//
	// Opens a model call and streams frames. The response is Server-Sent Events; the final frame is `done` or `error`. A lost response is queried by callId, never resent. D4a (DEC-070): a caller that reads the frames' stream identity sends `Accept: text/event-stream; frame-identity=1`; a Proxy that honours it answers `Content-Type: text/event-stream; frame-identity=1`, and the frames carry `frameOrigin` (all of them, except the original frames of a call recorded before D4a, which have no stream to name). Without the parameter the frames are as before D4a, so a reader validating an older contract never meets the members; a Proxy before D4a ignores it and answers the plain type.
	CreateModelCallWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateModelCall performs a POST /model-calls (the `CreateModelCall` operationId) request.
	// Takes a body of the `application/json` content type.
	//
	// Opens a model call and streams frames. The response is Server-Sent Events; the final frame is `done` or `error`. A lost response is queried by callId, never resent. D4a (DEC-070): a caller that reads the frames' stream identity sends `Accept: text/event-stream; frame-identity=1`; a Proxy that honours it answers `Content-Type: text/event-stream; frame-identity=1`, and the frames carry `frameOrigin` (all of them, except the original frames of a call recorded before D4a, which have no stream to name). Without the parameter the frames are as before D4a, so a reader validating an older contract never meets the members; a Proxy before D4a ignores it and answers the plain type.
	CreateModelCall(ctx context.Context, body CreateModelCallJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetModelCall performs a GET /model-calls/{callId} (the `GetModelCall` operationId) request.
	//
	// Queries the original call outcome and usage; querying never sends again.
	GetModelCall(ctx context.Context, callId Id, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CancelModelCall performs a POST /model-calls/{callId}/cancellations (the `CancelModelCall` operationId) request.
	//
	// Expresses cancel intent; already incurred usage stays in the ledger.
	CancelModelCall(ctx context.Context, callId Id, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) CancelModelCallWithResponse

func (c *ClientWithResponses) CancelModelCallWithResponse(ctx context.Context, callId Id, reqEditors ...RequestEditorFn) (*CancelModelCallResponse, error)

CancelModelCallWithResponse performs a POST /model-calls/{callId}/cancellations (the `CancelModelCall` operationId) request.

Expresses cancel intent; already incurred usage stays in the ledger.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) CreateModelCallWithBodyWithResponse

func (c *ClientWithResponses) CreateModelCallWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateModelCallResponse, error)

CreateModelCallWithBodyWithResponse performs a POST /model-calls (the `CreateModelCall` operationId) request, with any type of body and a specified content type.

Opens a model call and streams frames. The response is Server-Sent Events; the final frame is `done` or `error`. A lost response is queried by callId, never resent. D4a (DEC-070): a caller that reads the frames' stream identity sends `Accept: text/event-stream; frame-identity=1`; a Proxy that honours it answers `Content-Type: text/event-stream; frame-identity=1`, and the frames carry `frameOrigin` (all of them, except the original frames of a call recorded before D4a, which have no stream to name). Without the parameter the frames are as before D4a, so a reader validating an older contract never meets the members; a Proxy before D4a ignores it and answers the plain type.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) CreateModelCallWithResponse

func (c *ClientWithResponses) CreateModelCallWithResponse(ctx context.Context, body CreateModelCallJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateModelCallResponse, error)

CreateModelCallWithResponse performs a POST /model-calls (the `CreateModelCall` operationId) request. Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Opens a model call and streams frames. The response is Server-Sent Events; the final frame is `done` or `error`. A lost response is queried by callId, never resent. D4a (DEC-070): a caller that reads the frames' stream identity sends `Accept: text/event-stream; frame-identity=1`; a Proxy that honours it answers `Content-Type: text/event-stream; frame-identity=1`, and the frames carry `frameOrigin` (all of them, except the original frames of a call recorded before D4a, which have no stream to name). Without the parameter the frames are as before D4a, so a reader validating an older contract never meets the members; a Proxy before D4a ignores it and answers the plain type.

func (*ClientWithResponses) GetModelCallWithResponse

func (c *ClientWithResponses) GetModelCallWithResponse(ctx context.Context, callId Id, reqEditors ...RequestEditorFn) (*GetModelCallResponse, error)

GetModelCallWithResponse performs a GET /model-calls/{callId} (the `GetModelCall` operationId) request.

Queries the original call outcome and usage; querying never sends again.

Returns a wrapper object for the known response body format(s).

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// CreateModelCallWithBodyWithResponse performs a POST /model-calls (the `CreateModelCall` operationId) request,
	// with any type of body and a specified content type.
	//
	// Opens a model call and streams frames. The response is Server-Sent Events; the final frame is `done` or `error`. A lost response is queried by callId, never resent. D4a (DEC-070): a caller that reads the frames' stream identity sends `Accept: text/event-stream; frame-identity=1`; a Proxy that honours it answers `Content-Type: text/event-stream; frame-identity=1`, and the frames carry `frameOrigin` (all of them, except the original frames of a call recorded before D4a, which have no stream to name). Without the parameter the frames are as before D4a, so a reader validating an older contract never meets the members; a Proxy before D4a ignores it and answers the plain type.
	//
	// Returns a wrapper object for the known response body format(s).
	CreateModelCallWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateModelCallResponse, error)

	// CreateModelCallWithResponse performs a POST /model-calls (the `CreateModelCall` operationId) request.
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Opens a model call and streams frames. The response is Server-Sent Events; the final frame is `done` or `error`. A lost response is queried by callId, never resent. D4a (DEC-070): a caller that reads the frames' stream identity sends `Accept: text/event-stream; frame-identity=1`; a Proxy that honours it answers `Content-Type: text/event-stream; frame-identity=1`, and the frames carry `frameOrigin` (all of them, except the original frames of a call recorded before D4a, which have no stream to name). Without the parameter the frames are as before D4a, so a reader validating an older contract never meets the members; a Proxy before D4a ignores it and answers the plain type.
	CreateModelCallWithResponse(ctx context.Context, body CreateModelCallJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateModelCallResponse, error)

	// GetModelCallWithResponse performs a GET /model-calls/{callId} (the `GetModelCall` operationId) request.
	//
	// Queries the original call outcome and usage; querying never sends again.
	//
	// Returns a wrapper object for the known response body format(s).
	GetModelCallWithResponse(ctx context.Context, callId Id, reqEditors ...RequestEditorFn) (*GetModelCallResponse, error)

	// CancelModelCallWithResponse performs a POST /model-calls/{callId}/cancellations (the `CancelModelCall` operationId) request.
	//
	// Expresses cancel intent; already incurred usage stays in the ledger.
	//
	// Returns a wrapper object for the known response body format(s).
	CancelModelCallWithResponse(ctx context.Context, callId Id, reqEditors ...RequestEditorFn) (*CancelModelCallResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type CreateModelCallJSONRequestBody

type CreateModelCallJSONRequestBody = ModelCallRequest

CreateModelCallJSONRequestBody defines body for CreateModelCall for application/json ContentType.

type CreateModelCallResponse

type CreateModelCallResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON400 the response for an HTTP 400 `application/json` response
	JSON400 *Error
	// JSON403 the response for an HTTP 403 `application/json` response
	JSON403 *Error
	// JSON409 the response for an HTTP 409 `application/json` response
	JSON409 *Error
	// JSON429 the response for an HTTP 429 `application/json` response
	JSON429 *Error
	// JSON503 the response for an HTTP 503 `application/json` response
	JSON503 *Error
}

func ParseCreateModelCallResponse

func ParseCreateModelCallResponse(rsp *http.Response) (*CreateModelCallResponse, error)

ParseCreateModelCallResponse parses an HTTP response from a CreateModelCallWithResponse call

func (CreateModelCallResponse) ContentType

func (r CreateModelCallResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (CreateModelCallResponse) GetBody

func (r CreateModelCallResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (CreateModelCallResponse) GetJSON400

func (r CreateModelCallResponse) GetJSON400() *Error

GetJSON400 returns the response for an HTTP 400 `application/json` response

func (CreateModelCallResponse) GetJSON403

func (r CreateModelCallResponse) GetJSON403() *Error

GetJSON403 returns the response for an HTTP 403 `application/json` response

func (CreateModelCallResponse) GetJSON409

func (r CreateModelCallResponse) GetJSON409() *Error

GetJSON409 returns the response for an HTTP 409 `application/json` response

func (CreateModelCallResponse) GetJSON429

func (r CreateModelCallResponse) GetJSON429() *Error

GetJSON429 returns the response for an HTTP 429 `application/json` response

func (CreateModelCallResponse) GetJSON503

func (r CreateModelCallResponse) GetJSON503() *Error

GetJSON503 returns the response for an HTTP 503 `application/json` response

func (CreateModelCallResponse) Status

func (r CreateModelCallResponse) Status() string

Status returns HTTPResponse.Status

func (CreateModelCallResponse) StatusCode

func (r CreateModelCallResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Digest

type Digest = string

Digest defines model for Digest.

type Error

type Error = ErrorEnvelope

Error defines model for Error.

type ErrorEnvelope

type ErrorEnvelope struct {
	Error struct {
		Code      ErrorEnvelopeErrorCode `json:"code"`
		Message   string                 `json:"message"`
		RequestId Id                     `json:"requestId"`
		Retryable bool                   `json:"retryable"`
	} `json:"error"`
}

ErrorEnvelope defines model for ErrorEnvelope.

type ErrorEnvelopeErrorCode

type ErrorEnvelopeErrorCode string

ErrorEnvelopeErrorCode defines model for ErrorEnvelope.Error.Code.

const (
	BUDGETEXHAUSTED       ErrorEnvelopeErrorCode = "BUDGET_EXHAUSTED"
	DEPENDENCYUNAVAILABLE ErrorEnvelopeErrorCode = "DEPENDENCY_UNAVAILABLE"
	EFFECTUNCERTAIN       ErrorEnvelopeErrorCode = "EFFECT_UNCERTAIN"
	FORBIDDEN             ErrorEnvelopeErrorCode = "FORBIDDEN"
	IDEMPOTENCYCONFLICT   ErrorEnvelopeErrorCode = "IDEMPOTENCY_CONFLICT"
	INVALIDARGUMENT       ErrorEnvelopeErrorCode = "INVALID_ARGUMENT"
	NOTFOUND              ErrorEnvelopeErrorCode = "NOT_FOUND"
	PROFILEUNQUALIFIED    ErrorEnvelopeErrorCode = "PROFILE_UNQUALIFIED"
	STALEEXECUTION        ErrorEnvelopeErrorCode = "STALE_EXECUTION"
	UNAUTHENTICATED       ErrorEnvelopeErrorCode = "UNAUTHENTICATED"
)

Defines values for ErrorEnvelopeErrorCode.

func (ErrorEnvelopeErrorCode) Valid

func (e ErrorEnvelopeErrorCode) Valid() bool

Valid indicates whether the value is a known member of the ErrorEnvelopeErrorCode enum.

type ExecutionBinding

type ExecutionBinding struct {
	AttemptId      Id       `json:"attemptId"`
	ExecutionEpoch Sequence `json:"executionEpoch"`
	InstanceId     *Id      `json:"instanceId,omitempty"`
	OperationId    Id       `json:"operationId"`
	TenantId       Id       `json:"tenantId"`
}

ExecutionBinding defines model for ExecutionBinding.

type GetModelCallResponse

type GetModelCallResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *ModelCall
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *Error
	// JSON503 the response for an HTTP 503 `application/json` response
	JSON503 *Error
}

func ParseGetModelCallResponse

func ParseGetModelCallResponse(rsp *http.Response) (*GetModelCallResponse, error)

ParseGetModelCallResponse parses an HTTP response from a GetModelCallWithResponse call

func (GetModelCallResponse) ContentType

func (r GetModelCallResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetModelCallResponse) GetBody

func (r GetModelCallResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetModelCallResponse) GetJSON200

func (r GetModelCallResponse) GetJSON200() *ModelCall

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetModelCallResponse) GetJSON404

func (r GetModelCallResponse) GetJSON404() *Error

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (GetModelCallResponse) GetJSON503

func (r GetModelCallResponse) GetJSON503() *Error

GetJSON503 returns the response for an HTTP 503 `application/json` response

func (GetModelCallResponse) Status

func (r GetModelCallResponse) Status() string

Status returns HTTPResponse.Status

func (GetModelCallResponse) StatusCode

func (r GetModelCallResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Id

type Id = string

Id defines model for Id.

type Message

type Message struct {
	Content    string             `json:"content"`
	Role       MessageRole        `json:"role"`
	ToolCallId *Id                `json:"toolCallId,omitempty"`
	ToolCalls  *[]MessageToolCall `json:"toolCalls,omitempty"`
}

Message One message of the history. `toolCalls` belongs to assistant messages (the calls the model made); `toolCallId` belongs to tool messages (the result of exactly one earlier assistant tool call). The Proxy refuses either member on another role and a tool message that answers no earlier call.

type MessageRole

type MessageRole string

MessageRole defines model for Message.Role.

const (
	Assistant MessageRole = "assistant"
	System    MessageRole = "system"
	Tool      MessageRole = "tool"
	User      MessageRole = "user"
)

Defines values for MessageRole.

func (MessageRole) Valid

func (e MessageRole) Valid() bool

Valid indicates whether the value is a known member of the MessageRole enum.

type MessageToolCall added in v0.1.3

type MessageToolCall struct {
	Arguments  string `json:"arguments"`
	Name       string `json:"name"`
	ToolCallId Id     `json:"toolCallId"`
}

MessageToolCall One tool call an assistant message made, replayed to the model as the round trip the model produced; `arguments` is the JSON object text of the tool_call frame.

type ModelCall

type ModelCall struct {
	CallId          Id             `json:"callId"`
	CreatedAt       Timestamp      `json:"createdAt"`
	DispatchId      Id             `json:"dispatchId"`
	ErrorCode       *string        `json:"errorCode,omitempty"`
	FencedAt        *Timestamp     `json:"fencedAt,omitempty"`
	NativeReference *string        `json:"nativeReference,omitempty"`
	RouteId         Id             `json:"routeId"`
	State           ModelCallState `json:"state"`
	UpdatedAt       Timestamp      `json:"updatedAt"`
	Usage           *Usage         `json:"usage,omitempty"`
}

ModelCall `fencedAt` is set when the sweep reclaimed the send as unknown (errorCode SENDER_LOST) and fenced its stream (DEC-068, CR-04): from then on the original sender can append no frame and no result, though it may still report usage, so the ledger stays truthful. A fence proves that no stream write can follow, not that the provider stopped generating.

type ModelCallRequest

type ModelCallRequest struct {
	Binding          ExecutionBinding  `json:"binding"`
	CallId           Id                `json:"callId"`
	Deadline         Timestamp         `json:"deadline"`
	EvidenceRef      *string           `json:"evidenceRef,omitempty"`
	MaxExposure      Money             `json:"maxExposure"`
	MaxOutputTokens  int               `json:"maxOutputTokens"`
	Messages         []Message         `json:"messages"`
	RequestDigest    Digest            `json:"requestDigest"`
	RouteId          Id                `json:"routeId"`
	SupersedesCallId *Id               `json:"supersedesCallId,omitempty"`
	Tools            *[]ToolDefinition `json:"tools,omitempty"`
}

ModelCallRequest defines model for ModelCallRequest.

type ModelCallState

type ModelCallState string

ModelCallState defines model for ModelCall.State.

const (
	ModelCallStateAdmitting ModelCallState = "admitting"
	ModelCallStateCanceled  ModelCallState = "canceled"
	ModelCallStateDenied    ModelCallState = "denied"
	ModelCallStateFailed    ModelCallState = "failed"
	ModelCallStateSending   ModelCallState = "sending"
	ModelCallStateSucceeded ModelCallState = "succeeded"
	ModelCallStateUnknown   ModelCallState = "unknown"
)

Defines values for ModelCallState.

func (ModelCallState) Valid

func (e ModelCallState) Valid() bool

Valid indicates whether the value is a known member of the ModelCallState enum.

type Money

type Money struct {
	Amount   string `json:"amount"`
	Currency string `json:"currency"`
}

Money defines model for Money.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type Sequence

type Sequence = string

Sequence defines model for Sequence.

type StreamFrame

type StreamFrame struct {
	CallId    Id      `json:"callId"`
	ErrorCode *string `json:"errorCode,omitempty"`

	// FrameOrigin D4a (design 0001 §8.2, DEC-070): `original` frames belong to the call's original stream (`originalStreamId`, sequences from 0); `recovery` frames carry recovery state only, never text, and never advance a reader's original watermark (the synthetic SENDER_LOST and PERMISSION_LOST frames). `originalStreamId` is created once with the call record and is present on original frames. Both are present only on a stream opened with `frame-identity=1` (createModelCall); an original frame of a call recorded before D4a has neither, and a chat reader then records its reply whole.
	FrameOrigin      *StreamFrameFrameOrigin `json:"frameOrigin,omitempty"`
	OriginalStreamId *Id                     `json:"originalStreamId,omitempty"`
	Outcome          *StreamFrameOutcome     `json:"outcome,omitempty"`
	Sequence         Sequence                `json:"sequence"`
	Text             *string                 `json:"text,omitempty"`
	ToolCall         *struct {
		Arguments       *string `json:"arguments,omitempty"`
		ArgumentsDigest Digest  `json:"argumentsDigest"`
		Name            string  `json:"name"`
		ToolCallId      Id      `json:"toolCallId"`
	} `json:"toolCall,omitempty"`
	Type  StreamFrameType `json:"type"`
	Usage *Usage          `json:"usage,omitempty"`
}

StreamFrame One SSE `data` payload; `sequence` is monotonic per call and bounded by the route profile.

type StreamFrameFrameOrigin added in v0.1.52

type StreamFrameFrameOrigin string

StreamFrameFrameOrigin D4a (design 0001 §8.2, DEC-070): `original` frames belong to the call's original stream (`originalStreamId`, sequences from 0); `recovery` frames carry recovery state only, never text, and never advance a reader's original watermark (the synthetic SENDER_LOST and PERMISSION_LOST frames). `originalStreamId` is created once with the call record and is present on original frames. Both are present only on a stream opened with `frame-identity=1` (createModelCall); an original frame of a call recorded before D4a has neither, and a chat reader then records its reply whole.

const (
	Original StreamFrameFrameOrigin = "original"
	Recovery StreamFrameFrameOrigin = "recovery"
)

Defines values for StreamFrameFrameOrigin.

func (StreamFrameFrameOrigin) Valid added in v0.1.52

func (e StreamFrameFrameOrigin) Valid() bool

Valid indicates whether the value is a known member of the StreamFrameFrameOrigin enum.

type StreamFrameOutcome

type StreamFrameOutcome string

StreamFrameOutcome defines model for StreamFrame.Outcome.

const (
	StreamFrameOutcomeCanceled  StreamFrameOutcome = "canceled"
	StreamFrameOutcomeFailed    StreamFrameOutcome = "failed"
	StreamFrameOutcomeSucceeded StreamFrameOutcome = "succeeded"
	StreamFrameOutcomeUnknown   StreamFrameOutcome = "unknown"
)

Defines values for StreamFrameOutcome.

func (StreamFrameOutcome) Valid

func (e StreamFrameOutcome) Valid() bool

Valid indicates whether the value is a known member of the StreamFrameOutcome enum.

type StreamFrameType

type StreamFrameType string

StreamFrameType defines model for StreamFrame.Type.

const (
	StreamFrameTypeAdmitted StreamFrameType = "admitted"
	StreamFrameTypeDone     StreamFrameType = "done"
	StreamFrameTypeError    StreamFrameType = "error"
	StreamFrameTypeText     StreamFrameType = "text"
	StreamFrameTypeToolCall StreamFrameType = "tool_call"
	StreamFrameTypeUsage    StreamFrameType = "usage"
)

Defines values for StreamFrameType.

func (StreamFrameType) Valid

func (e StreamFrameType) Valid() bool

Valid indicates whether the value is a known member of the StreamFrameType enum.

type Timestamp

type Timestamp = string

Timestamp defines model for Timestamp.

type ToolDefinition

type ToolDefinition struct {
	Description       *string `json:"description,omitempty"`
	InputSchemaDigest Digest  `json:"inputSchemaDigest"`
	Name              string  `json:"name"`
}

ToolDefinition defines model for ToolDefinition.

type Usage

type Usage struct {
	CachedInputUnits Sequence `json:"cachedInputUnits"`
	InputUnits       Sequence `json:"inputUnits"`
	OutputUnits      Sequence `json:"outputUnits"`
	ReasoningUnits   Sequence `json:"reasoningUnits"`
}

Usage defines model for Usage.

Jump to

Keyboard shortcuts

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