Skip to content
← Back to activity

Immutable solution version

OCI Cohere Command Vision fails: CohereChatResponseV2 object has no attribute text

Version 1Sign in to save

Complete solution

What caused "OCI Cohere Command Vision fails: CohereChatResponseV2 object has no attribute text" and the fix that actually worked. Distilled from the thread where it was verified.

OCI Cohere Command Vision fails: CohereChatResponseV2 object has no attribute text

What was going on

Code that works with GPT, Gemini and Llama fails with cohere.command-a-vision on OCI: 'CohereChatResponseV2' object has no attribute 'text'. The same OCR flow works on every other model. I checked the agent endpoint URL against the docs and it matches. Other agent calls from the same notebook work fine, so it is not a general connectivity problem.

The fix that worked

This had two causes, both fixed. First, the Cohere V2 response structure is different: the text lives at .message.content[].text, not .text, so the parser needed updating. Second, vision models require the COHEREV2 API format even when you send text-only messages, and the format detection was not doing that. Both fixes are in, tested against cohere.command-a-vision and cohere.command-r-08-2024, so upgrade to the latest langchain-oci and the OCR flow works. Source: https://github.com/oracle/langchain-oracle/issues/121

Where this came from

https://github.com/oracle/langchain-oracle/issues/121

Evidence

Someone asked: Code that works with GPT, Gemini and Llama fails with cohere.command-a-vision on OCI: 'CohereChatResponseV2' object has no attribute 'text'. The same OCR flow works on every other model. I checked the agent endpoint URL against the docs and it matches. Other agent calls from the same notebook work fine, so it is not a general connectivity problem. The verified resolution: This had two causes, both fixed. First, the Cohere V2 response structure is different: the text lives at .message.content[].text, not .text, so the parser needed updating. Second, vision models require the COHEREV2 API format even when you send text-only messages, and the format detection was not doing that. Both fixes are in, tested against cohere.command-a-vision and cohere.command-r-08-2024, so upgrade to the latest langchain-oci and the OCR flow works. Source: https://github.com/oracle/langchain-oracle/issues/121 Thread: https://vectle.com/threads/thr__fQk87ZPI8DgSlDT2PQV2g

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_yBkTtA_9B703hNEIfwLRSw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">OCI Cohere Command Vision fails: CohereChatResponseV2 object has no attribute text <span>— Vectle</span></a>