You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have configured Genkit to be working with Cloud Functions using the onFlow wrapper. When running a flow from Genkit Tools UI I receive the following error: Cannot destructure property 'shape' of 'this._getCached(...)' as it is undefined.
To Reproduce
Init Genkit:
/**
* Configure the Genkit SDK.
* @see https://firebase.google.com/docs/genkit/get-started
*/
export function initGenkit(apiKey: string) {
configureGenkit({
plugins: [
// Load the Firebase plugin, which provides integrations with several
// Firebase services.
firebase({ projectId }),
// Load the Google AI plugin. You can optionally specify your API key
// by passing in a config object; if you don't, the Google AI plugin uses
// the value from the GOOGLE_GENAI_API_KEY environment variable, which is
// the recommended practice.
googleAI({ apiKey }),
dotprompt(),
],
// Log debug output to tbe console.
logLevel: 'debug',
// Perform OpenTelemetry instrumentation and enable trace collection.
enableTracingAndMetrics: true,
flowStateStore: 'firebase',
traceStore: 'firebase',
telemetry: {
instrumentation: 'firebase',
logger: 'firebase',
},
});
}
Zod schema's:
import { defineSchema } from '@genkit-ai/core';
import { z } from '@genkit-ai/core/schema';
import { dietaryRestrictions } from '../../types/nutrition';
export const nutritionGoalInputSchema = defineSchema(
'NutritionGoalInputSchema',
z.object({
age: z
.number()
.min(0, 'Age must be a non-negative number.')
.describe('The age of the individual in years. Must be a non-negative number.'),
gender: z.enum(['female', 'male']).describe('The biological gender of the individual, either "female" or "male".'),
weightKg: z
.number()
.min(0, 'Weight must be a non-negative number.')
.describe('The body weight of the individual in kilograms. Must be a non-negative number.'),
lengthCm: z
.number()
.min(0, 'Height must be a non-negative number.')
.describe('The height of the individual in centimeters. Must be a non-negative number.'),
activityLevel: z
.enum(['extra_active', 'very_active', 'moderately_active', 'lightly_active', 'sedentary'])
.describe(
'The general activity level (Physical Activity Level) of the individual throughout the day excluding formal exercise."'
),
dietaryGoals: z.object({
goalType: z
.enum(['fat_loss', 'muscle_gain'])
.describe(
'The primary dietary objective of the individual. Options are: "fat_loss" for reducing body fat percentage, and "muscle_gain" for increasing muscle mass.'
),
}),
dietaryRestrictions: z
.array(z.union([z.enum(dietaryRestrictions), z.string()]))
.optional()
.describe(
'A list of dietary restrictions or preferences for the individual. These can include specific dietary patterns like "vegan", "vegetarian", "kosher" or "halal"'
),
})
);
export type NutritionGoalInputSchema = typeof nutritionGoalInputSchema;
export const nutritionGoalOutputSchema = defineSchema(
'NutritionGoalOutputSchema',
z.object({
specs: z.object({
calories: z
.number()
.min(0, 'Calories must be a non-negative number.')
.describe(
"The total estimated energy requirement for the individual in kilocalories (kcal) per day. This is calculated based on the individual's activity level, age, weight, height, gender, and dietary goals."
),
protein: z
.number()
.min(0, 'Protein must be a non-negative number.')
.describe(
'The total daily recommended protein intake in grams (g) for the individual, calculated based on body weight, activity level, and dietary objectives.'
),
fat: z
.number()
.min(0, 'Fat must be a non-negative number.')
.describe(
'The total daily recommended fat intake in grams (g) for the individual, derived from the percentage of total calories allocated to dietary fat based on activity level and goals.'
),
carbs: z
.number()
.min(0, 'Carbohydrates must be a non-negative number.')
.describe(
'The total daily recommended carbohydrate intake in grams (g) for the individual, derived from the remaining calories after accounting for protein and fat, adjusted for dietary preferences and activity level.'
),
}),
})
);
export type NutritionGoalOutputSchema = typeof nutritionGoalOutputSchema;
Describe the bug
I have configured Genkit to be working with Cloud Functions using the onFlow wrapper. When running a flow from Genkit Tools UI I receive the following error:
Cannot destructure property 'shape' of 'this._getCached(...)' as it is undefined.
To Reproduce
Init Genkit:
Zod schema's:
Flow:
Expected behavior
I expected the flow to run as desired. When I test the prompt from the Genkit Tools UI, it works as expected.
Screenshots
Failing flow:
Runtime (please complete the following information):
** Node version
Additional context
Using Cloud Functions 2nd gen with local emulators.
The text was updated successfully, but these errors were encountered: