Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions js/testapps/dev-ui-gallery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"dependencies": {
"@genkit-ai/ai": "workspace:*",
"@genkit-ai/core": "workspace:*",
"@genkit-ai/dotprompt": "workspace:*",
"@genkit-ai/flow": "workspace:*",
"genkitx-chromadb": "workspace:*",
"@genkit-ai/dev-local-vectorstore": "workspace:*",
"@genkit-ai/dotprompt": "workspace:*",
"@genkit-ai/evaluator": "workspace:*",
"@genkit-ai/firebase": "workspace:*",
"@genkit-ai/flow": "workspace:*",
"@genkit-ai/googleai": "workspace:*",
"@genkit-ai/vertexai": "workspace:*",
"genkitx-chromadb": "workspace:*",
"genkitx-ollama": "workspace:*",
"genkitx-pinecone": "workspace:*",
"@genkit-ai/evaluator": "workspace:*",
"@genkit-ai/vertexai": "workspace:*",
"zod": "^3.22.4"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-pro
model: googleai/gemini-1.5-flash-latest
input:
schema:
firstName: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-1.5-pro-latest
model: googleai/gemini-1.5-flash-latest
config:
maxOutputTokens: 2048
temperature: 0.6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-pro
model: googleai/gemini-1.5-flash-latest
input:
schema:
name: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-pro
model: googleai/gemini-1.5-flash-latest
config:
maxOutputTokens: 2048
temperature: 0.6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-1.5-pro-latest
model: googleai/gemini-1.5-flash-latest
config:
maxOutputTokens: 2048
temperature: 0.6
Expand Down
28 changes: 28 additions & 0 deletions js/testapps/dev-ui-gallery/prompts/tools.prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
model: googleai/gemini-1.5-flash-latest
config:
maxOutputTokens: 2048
temperature: 0.6
topK: 16
topP: 0.95
stopSequences:
- STAWP!
safetySettings:
- category: HARM_CATEGORY_HATE_SPEECH
threshold: BLOCK_ONLY_HIGH
- category: HARM_CATEGORY_DANGEROUS_CONTENT
threshold: BLOCK_ONLY_HIGH
- category: HARM_CATEGORY_HARASSMENT
threshold: BLOCK_ONLY_HIGH
- category: HARM_CATEGORY_SEXUALLY_EXPLICIT
threshold: BLOCK_ONLY_HIGH
input:
schema:
city: string
default:
city: Cambridge, MA
tools:
- getWeather
---

Is it raining in {{city}}?
4 changes: 3 additions & 1 deletion js/testapps/dev-ui-gallery/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ export default configureGenkit({
firebase(),

// model providers
googleAI({ apiVersion: ['v1', 'v1beta'] }),
googleAI({
apiVersion: ['v1', 'v1beta'],
}),
ollama({
models: [
{ name: 'llama2' },
Expand Down
12 changes: 6 additions & 6 deletions js/testapps/dev-ui-gallery/src/main/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ defineFlow(
outputSchema: z.string(),
streamSchema: z.string(),
},
async (input, streamingCallback) => {
async (input) => {
const codeDefinedPrompt = await prompt('codeDefinedPrompt');
const response = await codeDefinedPrompt.generate({
input,
Expand All @@ -113,7 +113,7 @@ defineFlow(
// Dotprompt file - text output
//

prompt('dotprompt-hello').then((prompt) => {
prompt('hello').then((prompt) => {
defineFlow(
{
name: 'flowDotPrompt',
Expand All @@ -128,7 +128,7 @@ prompt('dotprompt-hello').then((prompt) => {
// Dotprompt file - variant, text output
//

prompt('dotprompt-hello', { variant: 'first-last-name' }).then((prompt) => {
prompt('hello', { variant: 'first-last-name' }).then((prompt) => {
defineFlow(
{
name: 'flowDotPromptVariant',
Expand All @@ -143,7 +143,7 @@ prompt('dotprompt-hello', { variant: 'first-last-name' }).then((prompt) => {
// Dotprompt file - json output
//

prompt('dotprompt-hello', { variant: 'json-output' }).then((prompt) => {
prompt('hello', { variant: 'json-output' }).then((prompt) => {
defineFlow(
{
name: 'flowDotPromptJsonOutput',
Expand All @@ -154,7 +154,7 @@ prompt('dotprompt-hello', { variant: 'json-output' }).then((prompt) => {
);
});

prompt('dotprompt-hello', { variant: 'system' }).then((prompt) => {
prompt('hello', { variant: 'system' }).then((prompt) => {
defineFlow(
{
name: 'flowDotPromptSystemMessage',
Expand All @@ -165,7 +165,7 @@ prompt('dotprompt-hello', { variant: 'system' }).then((prompt) => {
);
});

prompt('dotprompt-hello', { variant: 'history' }).then((prompt) => {
prompt('hello', { variant: 'history' }).then((prompt) => {
defineFlow(
{
name: 'flowDotPromptHistory',
Expand Down
12 changes: 12 additions & 0 deletions js/testapps/dev-ui-gallery/src/main/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,15 @@ defineTool(
};
}
);

defineTool(
{
name: 'getTime',
description: 'Get the current time',
inputSchema: z.object({ timezone: z.string().optional() }),
outputSchema: z.object({ time: z.number() }),
},
async (input) => {
return { time: Date.now() };
}
);