Skip to content

vercel ai sdk generateText warns cause system messages are contained in messages array #1024

@8de2fdb0

Description

@8de2fdb0

Currently there is a warning from coming from callse vercel ai's generateText function.

AI SDK Warning: System messages in the prompt or messages fields can be a security risk because they may enable prompt injection attacks. Use the system option instead when possible. Set allowSystemInMessages to true to suppress this warning, or false to throw an error.

System prompt messages should be moved to the system parameter of generateText.

see:

https://ai-sdk.dev/docs/reference/ai-sdk-core/generate-text#allow-system-in-messages

https://ai-sdk.dev/docs/reference/ai-sdk-core/generate-text#system

Looks like it was added recently and will be rejected in the next mayor (6.x to 7.x)

https://github.com/vercel/ai/blob/main/packages/ai/CHANGELOG.md#700-beta112

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions