Skip to content

Issues with the XML parsing prompt outputs #455

@rodel-palm

Description

@rodel-palm

Bug description

We have been using the AdalFlow prompt optimization feature from quite early in line with the example as written out in https://adalflow.sylph.ai/use_cases/classification.html. Since version 1.1.3 we however encounter more problems with XML's not able of being parsed. More so than the JSON parser that was used before. The JSON parsing was flaky at times as well, but to lesser degree in our experience.

We noticed that when there's an XML parsing error on the output it will continue with the other (proposed variable, reasoning) labels in place. Which is not the best in our case. We now opted to manually extract the proposed variable from the checkpoint and use that in the following step. This tries to circumvent the problem rather than having proper guardrails in place to try and prevent this.

We are use Gemini Flash 2.5, which might be more sensitive to this, but anyway to make this more robust?

What version are you seeing the problem on?

1.1.3

How to reproduce the bug

This problem is difficult to give exact reproducing examples for as it depends both on the data and LLM.

Error messages and logs

The following errors tend to appear:

XML parsing error: not well-formed (invalid token): line X, column B

Environment

More info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working, either in /adalflow, /tutorials, or /use cases...

    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