Skip to content

Commit

Permalink
feat: Added Chat prompt format (based off Alpaca)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrutalCoding committed Sep 16, 2023
1 parent baa2b05 commit 86105c0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
5 changes: 5 additions & 0 deletions shady_ai_flutter/lib/data/prompt_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ class PromptConfig with _$PromptConfig {
assistant: '',
);

static const alpaca = PromptConfig(
label: 'Chat',
defaultPromptFormat: "A chat.\nUSER: {prompt}\nASSISTANT:",
);

static const none = PromptConfig(
label: 'Empty',
defaultPromptFormat: '',
Expand Down
43 changes: 38 additions & 5 deletions shady_ai_flutter/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -355,16 +355,44 @@ class MyHomePage extends HookConsumerWidget {
),
),
const SizedBox(
height: 16,
height: 32,
),
const Text(
'This might take a while. Please wait.',
),
const SizedBox(
height: 16,
height: 64,
),
CircularProgressIndicator
.adaptive(),
const SizedBox(
height: 64,
),
Text(
'Prompt template:',
style: Theme.of(
context,
)
.textTheme
.titleLarge,
),
const SizedBox(
height: 8,
),
Text(
promptTemplate.value
.getCompletePrompt,
style: Theme.of(
context,
)
.textTheme
.bodyMedium
?.copyWith(
fontStyle:
FontStyle
.italic,
),
),
],
),
),
Expand All @@ -389,8 +417,8 @@ class MyHomePage extends HookConsumerWidget {
pathToFile: filePath.value,
modelContextSize: promptTemplate
.value.contextSize,
originalPrompt: promptTemplate
.value.getCompletePrompt,
originalPrompt:
promptTemplate.value,
);

// Show response in a dialog
Expand All @@ -402,7 +430,7 @@ class MyHomePage extends HookConsumerWidget {
'Response',
),
content: Text(
response.response,
response,
),
);
},
Expand Down Expand Up @@ -508,6 +536,11 @@ class MyHomePage extends HookConsumerWidget {
promptTemplate.value = template;
},
dropdownMenuEntries: [
DropdownMenuEntry(
value: PromptConfig.alpaca,
label:
PromptConfig.alpaca.label,
),
DropdownMenuEntry(
value: PromptConfig.synthia,
label:
Expand Down

0 comments on commit 86105c0

Please sign in to comment.