Skip to content

Transform response before parsing JSON #4710

Closed
@egoist

Description

@egoist

Feature Description

When generating structured output (like generateObject), some models like DeepSeek v3 failed to follow the instructions and generate json in a code block instead:

Image

which makes ai sdk throw the following error:

No object generated: could not parse the response.

It would be nice if we can modify the output the remove the code fence before ai sdk starts to parse it

Use Cases

make json response work in other models

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions