From a5edba9317eea293b54041e2ab3f4d7d171f0003 Mon Sep 17 00:00:00 2001 From: Swapnil Roy Date: Fri, 6 Nov 2026 17:06:17 +0530 Subject: [PATCH] docs(ocr): fix Python OCR snippets for Azure Foundry and Mistral AI - Pass fields as keyword arguments instead of body={...}, which the SDK wraps again and sends as {"body": {...}} - Use /ocr instead of /v1/ocr; the SDK base URL already ends in /v1 - Use result.pages; GenericResponse is not subscriptable Co-authored-by: Cursor --- integrations/llms/azure-foundry.mdx | 18 ++++++++---------- integrations/llms/mistral-ai.mdx | 18 ++++++++---------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/integrations/llms/azure-foundry.mdx b/integrations/llms/azure-foundry.mdx index 513324b71..39502c958 100644 --- a/integrations/llms/azure-foundry.mdx +++ b/integrations/llms/azure-foundry.mdx @@ -993,18 +993,16 @@ client = Portkey( ) result = client.post( - "/v1/ocr", - body={ - "model": "mistral-ocr-4-0", - "document": { - "type": "document_url", - "document_url": "data:application/pdf;base64," - }, - "include_image_base64": True - } + "/ocr", + model="mistral-ocr-4-0", + document={ + "type": "document_url", + "document_url": "data:application/pdf;base64," + }, + include_image_base64=True ) -for page in result["pages"]: +for page in result.pages: print(f"Page {page['index']}: {page['markdown'][:100]}") ``` diff --git a/integrations/llms/mistral-ai.mdx b/integrations/llms/mistral-ai.mdx index b8a7f56f7..cf5774d11 100644 --- a/integrations/llms/mistral-ai.mdx +++ b/integrations/llms/mistral-ai.mdx @@ -379,18 +379,16 @@ portkey = Portkey( ) response = portkey.post( - "/v1/ocr", - body={ - "model": "mistral-ocr-latest", - "document": { - "type": "document_url", - "document_url": "https://example.com/document.pdf" - }, - "include_image_base64": True - } + "/ocr", + model="mistral-ocr-latest", + document={ + "type": "document_url", + "document_url": "https://example.com/document.pdf" + }, + include_image_base64=True ) -for page in response["pages"]: +for page in response.pages: print(f"Page {page['index']}: {page['markdown'][:100]}") ```