Documentation
¶
Overview ¶
Package openaicompat implements the OpenAI Chat Completions-compatible wire protocol behind AgentSlot's provider-neutral ModelExecutor contract.
Index ¶
- func NewModule(config Config) (agentslot.Module, error)
- type Config
- type Executor
- func (e *Executor) CountTokens(ctx context.Context, request model.ModelRequest) (int, error)deprecated
- func (e *Executor) Execute(ctx context.Context, request model.ModelRequest, ...) (model.ModelStream, error)
- func (e *Executor) Inspect(ctx context.Context, config model.Config) (model.ExecutionCapabilities, error)
- func (e *Executor) Models(ctx context.Context) ([]model.Descriptor, error)
- type Model
- type TokenCounter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
ProviderKey string
BaseURL string
CredentialRef credential.Ref
// CredentialResolver is accepted only by New for direct construction.
// NewModule resolves CredentialRef through credential.resolver instead.
CredentialResolver credential.Resolver
Models []Model
HTTPClient *http.Client
MaxAttempts int
RetryBackoff time.Duration
RequestTimeout time.Duration
MaxEventBytes int
MaxOutputBytes int
// MaxAttachmentBytes bounds each artifact opened for a provider request.
// Zero uses the adapter default. The Store may enforce a lower limit.
MaxAttachmentBytes int64
ArtifactStore artifact.ArtifactStore
}
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func (*Executor) CountTokens
deprecated
CountTokens preserves the concrete Executor API used before token counting became an independently replaceable Slot. Runtime composition must resolve model.TokenCounterSlot instead of relying on this convenience method.
Deprecated: construct TokenCounter with NewTokenCounter or resolve model.TokenCounterSlot from an Assembly.
func (*Executor) Execute ¶
func (e *Executor) Execute(ctx context.Context, request model.ModelRequest, recorder model.AttemptRecorder) (model.ModelStream, error)
type TokenCounter ¶ added in v0.1.0
type TokenCounter struct {
// contains filtered or unexported fields
}
TokenCounter owns planning-time measurement for the exact wire projection produced by this adapter. It is deliberately exposed separately from Executor so applications can replace counting without replacing execution.
func NewTokenCounter ¶ added in v0.1.0
func NewTokenCounter(config Config) (*TokenCounter, error)
NewTokenCounter constructs the counter paired with this provider adapter.
func (*TokenCounter) CountTokens ¶ added in v0.1.0
func (c *TokenCounter) CountTokens(ctx context.Context, request model.ModelRequest) (int, error)