Skip to content

Commit 666de2b

Browse files
authored
Updated prompt files in dev-ui-gallery (#235)
1 parent cb4643b commit 666de2b

File tree

10 files changed

+59
-17
lines changed

10 files changed

+59
-17
lines changed

js/testapps/dev-ui-gallery/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
"dependencies": {
2121
"@genkit-ai/ai": "workspace:*",
2222
"@genkit-ai/core": "workspace:*",
23-
"@genkit-ai/dotprompt": "workspace:*",
24-
"@genkit-ai/flow": "workspace:*",
25-
"genkitx-chromadb": "workspace:*",
2623
"@genkit-ai/dev-local-vectorstore": "workspace:*",
24+
"@genkit-ai/dotprompt": "workspace:*",
25+
"@genkit-ai/evaluator": "workspace:*",
2726
"@genkit-ai/firebase": "workspace:*",
27+
"@genkit-ai/flow": "workspace:*",
2828
"@genkit-ai/googleai": "workspace:*",
29+
"@genkit-ai/vertexai": "workspace:*",
30+
"genkitx-chromadb": "workspace:*",
2931
"genkitx-ollama": "workspace:*",
3032
"genkitx-pinecone": "workspace:*",
31-
"@genkit-ai/evaluator": "workspace:*",
32-
"@genkit-ai/vertexai": "workspace:*",
3333
"zod": "^3.22.4"
3434
}
3535
}

js/testapps/dev-ui-gallery/prompts/dotprompt-hello.first-last-name.prompt renamed to js/testapps/dev-ui-gallery/prompts/hello.first-last-name.prompt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
model: googleai/gemini-pro
2+
model: googleai/gemini-1.5-flash-latest
33
input:
44
schema:
55
firstName: string

js/testapps/dev-ui-gallery/prompts/dotprompt-hello.history.prompt renamed to js/testapps/dev-ui-gallery/prompts/hello.history.prompt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
model: googleai/gemini-1.5-pro-latest
2+
model: googleai/gemini-1.5-flash-latest
33
config:
44
maxOutputTokens: 2048
55
temperature: 0.6

js/testapps/dev-ui-gallery/prompts/dotprompt-hello.json-output.prompt renamed to js/testapps/dev-ui-gallery/prompts/hello.json-output.prompt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
model: googleai/gemini-pro
2+
model: googleai/gemini-1.5-flash-latest
33
input:
44
schema:
55
name: string

js/testapps/dev-ui-gallery/prompts/dotprompt-hello.prompt renamed to js/testapps/dev-ui-gallery/prompts/hello.prompt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
model: googleai/gemini-pro
2+
model: googleai/gemini-1.5-flash-latest
33
config:
44
maxOutputTokens: 2048
55
temperature: 0.6

js/testapps/dev-ui-gallery/prompts/dotprompt-hello.system.prompt renamed to js/testapps/dev-ui-gallery/prompts/hello.system.prompt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
model: googleai/gemini-1.5-pro-latest
2+
model: googleai/gemini-1.5-flash-latest
33
config:
44
maxOutputTokens: 2048
55
temperature: 0.6
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
model: googleai/gemini-1.5-flash-latest
3+
config:
4+
maxOutputTokens: 2048
5+
temperature: 0.6
6+
topK: 16
7+
topP: 0.95
8+
stopSequences:
9+
- STAWP!
10+
safetySettings:
11+
- category: HARM_CATEGORY_HATE_SPEECH
12+
threshold: BLOCK_ONLY_HIGH
13+
- category: HARM_CATEGORY_DANGEROUS_CONTENT
14+
threshold: BLOCK_ONLY_HIGH
15+
- category: HARM_CATEGORY_HARASSMENT
16+
threshold: BLOCK_ONLY_HIGH
17+
- category: HARM_CATEGORY_SEXUALLY_EXPLICIT
18+
threshold: BLOCK_ONLY_HIGH
19+
input:
20+
schema:
21+
city: string
22+
default:
23+
city: Cambridge, MA
24+
tools:
25+
- getWeather
26+
---
27+
28+
Is it raining in {{city}}?

js/testapps/dev-ui-gallery/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ export default configureGenkit({
6868
firebase(),
6969

7070
// model providers
71-
googleAI({ apiVersion: ['v1', 'v1beta'] }),
71+
googleAI({
72+
apiVersion: ['v1', 'v1beta'],
73+
}),
7274
ollama({
7375
models: [
7476
{ name: 'llama2' },

js/testapps/dev-ui-gallery/src/main/prompts.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ defineFlow(
9999
outputSchema: z.string(),
100100
streamSchema: z.string(),
101101
},
102-
async (input, streamingCallback) => {
102+
async (input) => {
103103
const codeDefinedPrompt = await prompt('codeDefinedPrompt');
104104
const response = await codeDefinedPrompt.generate({
105105
input,
@@ -113,7 +113,7 @@ defineFlow(
113113
// Dotprompt file - text output
114114
//
115115

116-
prompt('dotprompt-hello').then((prompt) => {
116+
prompt('hello').then((prompt) => {
117117
defineFlow(
118118
{
119119
name: 'flowDotPrompt',
@@ -128,7 +128,7 @@ prompt('dotprompt-hello').then((prompt) => {
128128
// Dotprompt file - variant, text output
129129
//
130130

131-
prompt('dotprompt-hello', { variant: 'first-last-name' }).then((prompt) => {
131+
prompt('hello', { variant: 'first-last-name' }).then((prompt) => {
132132
defineFlow(
133133
{
134134
name: 'flowDotPromptVariant',
@@ -143,7 +143,7 @@ prompt('dotprompt-hello', { variant: 'first-last-name' }).then((prompt) => {
143143
// Dotprompt file - json output
144144
//
145145

146-
prompt('dotprompt-hello', { variant: 'json-output' }).then((prompt) => {
146+
prompt('hello', { variant: 'json-output' }).then((prompt) => {
147147
defineFlow(
148148
{
149149
name: 'flowDotPromptJsonOutput',
@@ -154,7 +154,7 @@ prompt('dotprompt-hello', { variant: 'json-output' }).then((prompt) => {
154154
);
155155
});
156156

157-
prompt('dotprompt-hello', { variant: 'system' }).then((prompt) => {
157+
prompt('hello', { variant: 'system' }).then((prompt) => {
158158
defineFlow(
159159
{
160160
name: 'flowDotPromptSystemMessage',
@@ -165,7 +165,7 @@ prompt('dotprompt-hello', { variant: 'system' }).then((prompt) => {
165165
);
166166
});
167167

168-
prompt('dotprompt-hello', { variant: 'history' }).then((prompt) => {
168+
prompt('hello', { variant: 'history' }).then((prompt) => {
169169
defineFlow(
170170
{
171171
name: 'flowDotPromptHistory',

js/testapps/dev-ui-gallery/src/main/tools.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,15 @@ defineTool(
3434
};
3535
}
3636
);
37+
38+
defineTool(
39+
{
40+
name: 'getTime',
41+
description: 'Get the current time',
42+
inputSchema: z.object({ timezone: z.string().optional() }),
43+
outputSchema: z.object({ time: z.number() }),
44+
},
45+
async (input) => {
46+
return { time: Date.now() };
47+
}
48+
);

0 commit comments

Comments
 (0)