Skip to content

@effect/ai: add an option to disable JSON auto-parsing for tool calls #6007

@accplan

Description

@accplan

What is the problem this feature would solve?

Sometimes llms return invalid, but repairable JSON . For example, GLM 4.6 from OpenRouter sometimes adds {} after a valid JSON object. OpenRouter's "response healing" doesn't help in this case.

What is the feature you are proposing to solve the problem?

Right now function Tool.unsafeSecureJsonParse is being invoked on each tool call and fails when provided with invalid JSON. I would like an option to override or disable this behavior and parse the llm response myself.

What alternatives have you considered?

For now I just retry until it succeeds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions