summaryrefslogtreecommitdiff
path: root/internal/llm/provider.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-28 23:28:31 +0300
committerPaul Buetow <paul@buetow.org>2025-08-28 23:28:31 +0300
commit86aafe22eaf04687288e5a730acf0a473719c514 (patch)
treeb1a618442f903cf5de37d65f0b9d86392bb8194d /internal/llm/provider.go
parente3a7a18558fa5631c44fb70af673877d855206fc (diff)
copilot: add session token + codex code completion; lsp: prefer native CodeCompleter with chat fallback; remove obsolete throttle path; add tests; bump version to 0.3.0v0.3.0
Diffstat (limited to 'internal/llm/provider.go')
-rw-r--r--internal/llm/provider.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/internal/llm/provider.go b/internal/llm/provider.go
index ed9ca59..7ab58c6 100644
--- a/internal/llm/provider.go
+++ b/internal/llm/provider.go
@@ -28,10 +28,20 @@ type Client interface {
// token-by-token streaming responses. Callers can type-assert to Streamer and
// fall back to Client.Chat when not implemented.
type Streamer interface {
- // ChatStream sends chat messages and invokes onDelta with incremental text
- // chunks as they are produced by the model. Implementations should call
- // onDelta with empty strings sparingly (prefer only non-empty chunks).
- ChatStream(ctx context.Context, messages []Message, onDelta func(string), opts ...RequestOption) error
+ // ChatStream sends chat messages and invokes onDelta with incremental text
+ // chunks as they are produced by the model. Implementations should call
+ // onDelta with empty strings sparingly (prefer only non-empty chunks).
+ ChatStream(ctx context.Context, messages []Message, onDelta func(string), opts ...RequestOption) error
+}
+
+// CodeCompleter is an optional interface for providers that support a
+// prompt/suffix code-completion API (e.g., Copilot Codex endpoint). Clients
+// can type-assert to this and prefer it over chat when available.
+type CodeCompleter interface {
+ // CodeCompletion requests up to n suggestions given a left-hand prompt and
+ // right-hand suffix around the cursor. Language is advisory and may be
+ // ignored. Temperature applies when provider supports it.
+ CodeCompletion(ctx context.Context, prompt string, suffix string, n int, language string, temperature float64) ([]string, error)
}
// Options for a request. Providers may ignore unsupported fields.