Documentation
¶
Overview ¶
Package codecompletion owns native FIM and explicitly selected instructed completion.
Index ¶
- Variables
- func AssistantText(output any) string
- func Contract() servicecontract.Contract
- type Autocompleter
- type Editor
- type NextEditExecutor
- type NextEditRequest
- type NextEditService
- func (s *NextEditService) CancelPending()
- func (s *NextEditService) ExecutionFingerprint(format string) (string, error)
- func (s *NextEditService) Predict(ctx context.Context, request NextEditRequest) ([]modelcontract.TextEdit, error)
- func (s *NextEditService) PredictLatest(ctx context.Context, editor Editor, request NextEditRequest) ([]modelcontract.TextEdit, error)
- type PromptExecutor
- type Prompter
- type Request
- type Service
- func (s *Service) CancelPending()
- func (s *Service) Complete(ctx context.Context, request Request) (string, error)
- func (s *Service) CompleteLatest(ctx context.Context, editor Editor, request Request) (string, error)
- func (s *Service) ExecutionFingerprint(mode, format string) (string, error)
- func (s *Service) Fingerprint() (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrSuperseded = errors.New("code completion was superseded")
ErrSuperseded identifies a completion replaced by a newer request for the same editor.
Functions ¶
func AssistantText ¶
AssistantText extracts visible assistant output from a completion-chain result.
func Contract ¶
func Contract() servicecontract.Contract
Contract describes editor predictions independently of the IDE and ACP adapters.
Types ¶
type Autocompleter ¶
type Autocompleter interface {
Autocomplete(context.Context, llmrepo.Request, modelrepo.AutocompleteRequest) (modelrepo.AutocompleteResult, llmrepo.Meta, error)
}
Autocompleter executes a native FIM request on the selected runtime route.
type Editor ¶
Editor identifies one document in one IDE client, independently of its selected route.
type NextEditExecutor ¶
type NextEditExecutor interface {
NextEdit(context.Context, llmrepo.Request, modelrepo.NextEditRequest) (modelrepo.NextEditResult, llmrepo.Meta, error)
}
NextEditExecutor executes the selected model's declared edit operation.
type NextEditRequest ¶
type NextEditRequest struct {
Provider string
Model string
Format string
Input modelcontract.NextEditInput
MaxTokens int
}
NextEditRequest selects a route and an explicit editable document snapshot.
type NextEditService ¶
type NextEditService struct {
// contains filtered or unexported fields
}
NextEditService owns prediction identity, supersession and replacement validation.
func NewNextEdit ¶
func NewNextEdit(executor NextEditExecutor) (*NextEditService, error)
NewNextEdit constructs edit prediction with its required model executor.
func (*NextEditService) CancelPending ¶
func (s *NextEditService) CancelPending()
CancelPending fences predictions before their route is replaced.
func (*NextEditService) ExecutionFingerprint ¶
func (s *NextEditService) ExecutionFingerprint(format string) (string, error)
ExecutionFingerprint identifies the edit prompt, parser and service semantics.
func (*NextEditService) Predict ¶
func (s *NextEditService) Predict(ctx context.Context, request NextEditRequest) ([]modelcontract.TextEdit, error)
Predict verifies or executes an isolated prediction on the selected route.
func (*NextEditService) PredictLatest ¶
func (s *NextEditService) PredictLatest(ctx context.Context, editor Editor, request NextEditRequest) ([]modelcontract.TextEdit, error)
PredictLatest supersedes the previous prediction for this client and document.
type PromptExecutor ¶
type PromptExecutor interface {
PromptExecute(context.Context, llmrepo.Request, string, float32, string, ...modelrepo.PromptArgument) (string, llmrepo.Meta, error)
}
PromptExecutor executes one bounded prompt on the selected model route.
type Prompter ¶
type Prompter interface {
Prompt(context.Context, agentservice.PromptRequest) (*agentservice.PromptResponse, error)
}
Prompter executes the configured completion chain without requiring a conversation session.
type Request ¶
type Request struct {
Mode string
Provider string
Model string
Prefix string
Suffix string
MaxTokens int
TemplateVars map[string]string
}
Request identifies a complete, explicitly selected completion route and input.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service owns the same completion operation used by IDE editing and setup verification.
func New ¶
func New(agent Prompter, chain *taskengine.TaskChainDefinition, native Autocompleter) (*Service, error)
New constructs completion with its required native executor, agent and instructed chain.
func NewNative ¶
func NewNative(native Autocompleter) (*Service, error)
NewNative constructs native completion without an instructed-chain dependency.
func NewPromptOnly ¶
func NewPromptOnly(prompt PromptExecutor, native Autocompleter) (*Service, error)
NewPromptOnly constructs completion with explicit prompt execution and native FIM dependencies.
func (*Service) CancelPending ¶
func (s *Service) CancelPending()
CancelPending fences results and requests cancellation before replacing a route executor.
func (*Service) Complete ¶
Complete runs the selected operation without substituting a route or retrying different settings.
func (*Service) CompleteLatest ¶
func (s *Service) CompleteLatest(ctx context.Context, editor Editor, request Request) (string, error)
CompleteLatest supersedes the entire prior completion operation for this editor.
func (*Service) ExecutionFingerprint ¶
ExecutionFingerprint binds verification to the selected operation implementation.
func (*Service) Fingerprint ¶
Fingerprint identifies the loaded completion chain used by editing and verification.