Skip to content

Unexpected citation format #1060

@fatihyildiz-cs

Description

@fatihyildiz-cs

The response I get from Claude 4.5 references the citation documents with inline xml tags (<cite index=\\"1-17,1-18,1-19\\">) rather than populating the citations field in the TextBlock. Same problem was mentioned in #1031 and @pjuhos noted that it was fixed but I'm experiencing it with Anthropic 0.72.0 (without using the web fetch tool)

Here is the response i get (I instruct claude to respond with a json):

Message(
    id="msg_vrtx_01PuyNnGoNLoyfoxCfJVcS36",
    content=[
        TextBlock(
            citations=None,
            text='```json\n{\n  "result": [\n    {\n      "discussionPoint": "<cite index=\\"1-17,1-18,1-19\\">Heidi Alexander extended condolences on behalf of the Committee and Transport for London to the family of Pam Alexander, a former non-executive of the Crossrail Board between 2015 and 2018 and former member of the LLDC who chaired its planning committee, following her recent passing.</cite>",\n      "actionItems": []\n    }\n  ]\n}\n```',
            type="text",
        )
    ],
    model="claude-sonnet-4-5-20250929",
    role="assistant",
    stop_reason="end_turn",
    stop_sequence=None,
    type="message",
    usage=Usage(
        cache_creation=None,
        cache_creation_input_tokens=0,
        cache_read_input_tokens=0,
        input_tokens=10868,
        output_tokens=134,
        server_tool_use=None,
        service_tier=None,
    ),
)

Also, I see that the citation examples in the docs let Claude return free text rather than structured JSON. Is there anything particular I need to pay attention to when expecting a JSON response with citations? Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions