AiPromptApi class
AI Prompt API — local LLM prompt expansion.
Provides type-safe Dart access to the DartScript Prompt Expander, which uses a local Ollama model to expand short prompts into detailed ones.
All methods are static and require VSCode.initialize to have been called first (the adapter is obtained from the singleton).
Examples
// Expand a prompt with the default profile
final result = await AiPromptApi.process('refactor the auth module');
if (result.success) {
print(result.result);
}
// Use a specific profile and model
final result2 = await AiPromptApi.process(
'add error handling',
profile: 'detailed',
model: 'qwen3:14b',
);
// List available profiles
final profiles = await AiPromptApi.getProfiles();
for (final p in profiles) {
print('${p.key}: ${p.label}${p.isDefault ? " (default)" : ""}');
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
Static Methods
-
getModels(
{int timeoutSeconds = 30}) → Future< AiModelsResult> - List all configured Ollama model configs.
-
getProfiles(
{int timeoutSeconds = 30}) → Future< List< AiPromptProfile> > - List all available prompt expander profiles.
-
process(
String prompt, {String? profile, String? model, int timeoutSeconds = 120}) → Future< AiPromptResult> - Expand a prompt using the local Ollama model.
-
removeModel(
String key, {int timeoutSeconds = 30}) → Future< Map< String, dynamic> > - Remove an Ollama model configuration.
-
removeProfile(
String key, {int timeoutSeconds = 30}) → Future< Map< String, dynamic> > - Remove a prompt expander profile.
-
updateModel(
String key, Map< String, dynamic> model, {int timeoutSeconds = 30}) → Future<Map< String, dynamic> > - Create or update an Ollama model configuration.
-
updateProfile(
String key, Map< String, dynamic> profile, {int timeoutSeconds = 30}) → Future<Map< String, dynamic> > - Create or update a prompt expander profile.