Help us shape the future of Go! Take the 2026 Go Developer Survey

codecompletion

package
v0.32.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletionRequest

type CompletionRequest struct {
	Prefix    string // Code before the cursor
	Suffix    string // Code after the cursor
	Language  string // Language ID (e.g., "go", "typescript")
	FilePath  string // File being edited
	MaxTokens int    // Max tokens to generate (default 128 if 0)
}

CompletionRequest holds the context for a code completion request.

type CompletionResult

type CompletionResult struct {
	Text       string
	TokensUsed int
}

CompletionResult contains the generated completion.

func GenerateCompletion

func GenerateCompletion(ctx context.Context, client api.ClientInterface, req CompletionRequest) (*CompletionResult, error)

GenerateCompletion generates a code completion using chat-formatted FIM.

The caller's context is honored (e.g. r.Context() from an HTTP handler) so that an aborted request cancels the in-flight LLM call; a timeout is layered on top to bound total generation time.

Jump to

Keyboard shortcuts

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