LlmDrafter class
LLM-backed drafter for any OpenAI-compatible /chat/completions API
(OpenRouter, OpenAI, Groq, Together, a local Ollama/LM Studio server, etc.).
Configure the endpoint and credentials via constructor arguments or environment variables:
baseUrl→STRINGLOCALE_BASE_URL(falls back to OpenRouter)apiKey→STRINGLOCALE_API_KEYthenOPENROUTER_API_KEY
Note: Dart HTTP is async; the compiler awaits these, so this exposes async variants. The Drafter interface stays sync for the offline path; the async LLM calls are used by the async compiler entry points.
- Implementers
Constructors
Properties
- apiKey → String?
-
final
- baseUrl → String?
-
Endpoint URL. When null, resolved from
STRINGLOCALE_BASE_URL/OPENROUTER_BASE_URL, defaulting to defaultBaseUrl.final - hashCode → int
-
The hash code for this object.
no setterinherited
- model → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → void -
draftEnum(
String value, String locale, String language, String? context) → Future< String> -
draftTemplate(
String baseText, String locale, String language, String axisDesc, Set< String> placeholders) → Future<String> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited