Documentation
¶
Overview ¶
Package perception defines transport-free content interpretation and image observation contracts. Providers decide which modalities they can handle; callers decide what content may be sent to them.
Index ¶
Constants ¶
const APIVersion = "intelligence.perception/v1"
Variables ¶
var ErrInvalid = errors.New("invalid perception value")
Functions ¶
This section is empty.
Types ¶
type Finding ¶
type Finding struct {
Kind string `json:"kind"`
Text string `json:"text"`
SourceParts []int `json:"sourceParts"`
Confidence *float64 `json:"confidence,omitempty"`
}
Finding preserves the source part indexes for model-produced claims.
type InterpretRequest ¶
type InterpretRequest struct {
APIVersion string `json:"apiVersion"`
RequestID string `json:"requestId,omitempty"`
Model string `json:"model"`
Parts []Part `json:"parts"`
Prompt string `json:"prompt,omitempty"`
}
func (InterpretRequest) Validate ¶
func (r InterpretRequest) Validate() error
type InterpretResponse ¶
type InterpretResponse struct {
APIVersion string `json:"apiVersion"`
RequestID string `json:"requestId,omitempty"`
Findings []Finding `json:"findings"`
}
func (InterpretResponse) Validate ¶
func (r InterpretResponse) Validate(request InterpretRequest) error
type Interpreter ¶
type Interpreter interface {
Interpret(context.Context, InterpretRequest) (InterpretResponse, error)
}
type Observation ¶
type Observation struct {
Kind string `json:"kind"`
Label string `json:"label"`
Confidence float64 `json:"confidence"`
Region Region `json:"region"`
Mask string `json:"mask,omitempty"`
Evidence string `json:"evidence,omitempty"`
}
Observation describes a detected region. Mask is a base64 PNG, when set.
type ObserveRequest ¶
type ObserveRequest struct {
APIVersion string `json:"apiVersion"`
RequestID string `json:"requestId,omitempty"`
Model string `json:"model"`
MediaType string `json:"mediaType"`
Image []byte `json:"image"`
Prompt string `json:"prompt,omitempty"`
}
func (ObserveRequest) Validate ¶
func (r ObserveRequest) Validate() error
type ObserveResponse ¶
type ObserveResponse struct {
APIVersion string `json:"apiVersion"`
RequestID string `json:"requestId,omitempty"`
Observations []Observation `json:"observations"`
}
func (ObserveResponse) Validate ¶
func (r ObserveResponse) Validate(request ObserveRequest) error
type Observer ¶
type Observer interface {
Observe(context.Context, ObserveRequest) (ObserveResponse, error)
}