-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JS] definePrompt returns undefined outputSchema #723
Comments
This is WAI -- The two options is either using the import { defineDotprompt } from '@genkit-ai/dotprompt';
const prompt = defineDotprompt({
name: "testPrompt",
input: {
schema: inputSchema
},
output: {
format: 'json',
schema: outputSchema,
},
}, `What type is the {{property}} property on a color?` ); |
Ah-ha, that For context: I'm working on an object-oriented wrapper around Genkit to complement an ODM that I already built around Firestore, so I'm trying to avoid forcing developers to write Dotprompt files in case they'd rather keep everything defined in-code. Thanks again! Edit: I almost forgot to ask, will |
Yes, exactly, |
Describe the bug
definePrompt
returns an undefinedoutputSchema
even when a validoutputSchema
is provided.To Reproduce
I'm trying to run the below test code but I keep getting this error:
Uncaught (in promise) Error: No JSON object or array found in model output
. I tried passing bothoutputSchema
andoutput
to definePrompt to test (just in case).Code:
When I inspect the logged prompt object the
outputSchema
isundefined
:Expected behavior
If I run the below code instead, with the property
rgb
, I get the expected response:Code:
Runtime
Node version
Additional context
Note that I tried providing an outputSchema to renderPrompt as well, with the same result. I also tried awaiting renderPrompt and logged the result, but it doesn't look like that's where the outputSchema is designed to be provided. So, I'm presuming it should be provided to definePrompt instead, which does seem more intuitive.
Thanks, and please let me know if I can provide additional context!
The text was updated successfully, but these errors were encountered: