-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
JSON Parsing Error in generateObject Function with Unterminated String #1921
Comments
You have increased the |
I tried this example with Is this expected? |
Please try without |
Thanks for the reply. No difference for me, even if I use
Clearly something is off given that it's parsing webpack 😅. All I'm trying is: export async function GET(request: NextRequest) {
// imports...
const { text } = await generateText({
model: openai("gpt-3.5-turbo"),
prompt: "tell me a good joke.",
temperature: 0,
});
console.log({ text });
return new NextResponse();
} I'm simply running this code within an API route. I must be doing something incorrectly. Just not sure what. |
Problem solved ✅ Solution: Changing the API route from a I'm guessing there were weird caching issues from marking the route as a |
Description
Steps to Reproduce
Code example
Additional context
Actual error :
The function returns an unterminated string error at position 166 in the JSON data :
Possible Cause
The model might include characters like quotation marks or parentheses that are not correctly escaped, leading to parsing errors. This could be an issue with how the model's output is formatted or escaped before parsing into JSON.
The text was updated successfully, but these errors were encountered: