Problem (one or two sentences)
Anthropic Vertex Claude completion handling currently assumes the first response content block is the visible text response.
This works for the common case, but it is less resilient if Claude returns an empty content array or includes non-text content blocks before the actual text block.
Context (who is affected and when)
Users using Claude models through Anthropic Vertex may receive responses where the content array contains multiple block types.
For example, a Claude response could include a non-text block before a text block:
[
{ type: "thinking", thinking: "internal reasoning" },
{ type: "text", text: "visible response" },
]
In this case, Zoo Code should still be able to extract the visible text response safely.
Desired behavior (conceptual, not technical)
Zoo Code should handle Anthropic Vertex Claude response content more defensively.
Instead of assuming the first content block is text, it should return the first available text block from the response content array.
If no text block exists, it should safely return an empty string.
Constraints / preferences (optional)
- Keep the existing behavior unchanged for normal text-only Claude responses.
- Avoid throwing when the content array is empty.
- Avoid returning an empty response when a valid text block exists later in the content array.
- Keep the change small and provider-specific.
Request checklist
Zoo Code Task Links (optional)
No response
Acceptance criteria (optional)
No response
Proposed approach (optional)
No response
Trade-offs / risks (optional)
No response
Problem (one or two sentences)
Anthropic Vertex Claude completion handling currently assumes the first response content block is the visible text response.
This works for the common case, but it is less resilient if Claude returns an empty content array or includes non-text content blocks before the actual text block.
Context (who is affected and when)
Users using Claude models through Anthropic Vertex may receive responses where the content array contains multiple block types.
For example, a Claude response could include a non-text block before a text block:
In this case, Zoo Code should still be able to extract the visible text response safely.
Desired behavior (conceptual, not technical)
Zoo Code should handle Anthropic Vertex Claude response content more defensively.
Instead of assuming the first content block is text, it should return the first available text block from the response content array.
If no text block exists, it should safely return an empty string.
Constraints / preferences (optional)
Request checklist
Zoo Code Task Links (optional)
No response
Acceptance criteria (optional)
No response
Proposed approach (optional)
No response
Trade-offs / risks (optional)
No response