Documentation
¶
Overview ¶
Package model bridges src/ctn/contract/model tensor providers to the Ext plugin contract. The wire contract is language-neutral; this package supplies Go host and guest helpers. A host still chooses and trusts a sealed provider package.
Index ¶
- Constants
- Variables
- func PackageExecutable(options ExecutablePackage) (packagekit.Manifest, error)
- func RegisterProvider(registry *author.Registry, provider domain.Provider, ...) (*plugin.Descriptor, error)
- func ServeCurrentExecutable(ctx context.Context, id, version string, provider domain.Provider, ...) error
- func ServeStdio(ctx context.Context, id plugin.Identity, provider domain.Provider, ...) error
- type Client
- type ExecutablePackage
- type InferRequest
- type InferResponse
- type ProcessCaller
Constants ¶
const ContractName = "model.tensor"
const ContractVersion = "v1"
const MaxWireTensorBytes = 16 << 20
const Protocol = ContractName + "/" + ContractVersion
Variables ¶
var ContractRef = plugin.ContractRef{Name: ContractName, Version: ContractVersion}
Functions ¶
func PackageExecutable ¶
func PackageExecutable(options ExecutablePackage) (packagekit.Manifest, error)
PackageExecutable seals a model.tensor/v1 guest without installing it.
func RegisterProvider ¶
func RegisterProvider(registry *author.Registry, provider domain.Provider, authorize func(context.Context, plugin.Request) error) (*plugin.Descriptor, error)
RegisterProvider serves a selected native provider. The guest reopens and verifies the model bundle on every call, and closes the native session. The authorize callback must enforce guest-side access policy.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls a model.tensor/v1 guest through an already authorized session.
func NewProcessClient ¶
func NewProcessClient(process ProcessCaller) *Client
NewProcessClient wraps a running package opened by an Ext host. The caller owns the process lifetime, package trust and authorization.
func (*Client) Infer ¶
func (c *Client) Infer(ctx context.Context, request InferRequest) (InferResponse, error)
type ExecutablePackage ¶
type ExecutablePackage struct {
ID, Version, Binary, OutputDir, OS, Arch string
}
type InferRequest ¶
type InferRequest struct {
Root string `json:"root"`
Reference string `json:"reference"`
Inputs []domain.Tensor `json:"inputs"`
}
func (InferRequest) Validate ¶
func (r InferRequest) Validate() error
type InferResponse ¶
func (InferResponse) Validate ¶
func (r InferResponse) Validate() error