Learn how to monitor Azure Content Understanding with Openlayer
Openlayer integrates with Azure Content Understanding, Microsoft’s service for extracting structured data and insights from documents, images, audio, and video using LLMs.
To use monitoring mode, instrument your code to publish the analysis requests your AI system makes to the Openlayer platform. Each begin_analyze → poller.result() call is automatically traced and published with inputs, outputs, latency, token usage, and the underlying model used.
import osfrom azure.ai.contentunderstanding import ContentUnderstandingClientfrom azure.ai.contentunderstanding.models import AnalysisInputfrom azure.core.credentials import AzureKeyCredential# 1. Set the environment variablesos.environ["OPENLAYER_API_KEY"] = "YOUR_OPENLAYER_API_KEY_HERE"os.environ["OPENLAYER_INFERENCE_PIPELINE_ID"] = "YOUR_OPENLAYER_INFERENCE_PIPELINE_ID_HERE"# 2. Call `init` to auto-instrument the installed LLM SDKs (Content Understanding, etc.)from openlayer.lib import init# Set attachment options if you want to upload documents to Openlayer storageinit( attachment_upload_enabled=True, # upload binary/file attachments url_upload_enabled=True, # also download & re-upload external URLs)client = ContentUnderstandingClient( # auto-traced by Openlayer endpoint="YOUR_AZURE_CONTENT_UNDERSTANDING_ENDPOINT_HERE", credential=AzureKeyCredential("YOUR_AZURE_CONTENT_UNDERSTANDING_KEY_HERE"), api_version="2025-11-01",)# 3. Use the client normally — tracing happens automaticallypoller = client.begin_analyze( analyzer_id="prebuilt-invoice", inputs=[AnalysisInput(url="https://example.com/invoice.pdf")],)result = poller.result()
See full Python example
Once instrumented, every analysis call is automatically published to Openlayer.
In the “Data” page of your Openlayer data source, you can see the traces for each request.After your AI system requests are continuously published and logged by Openlayer, you can
create tests that run at a regular cadence on top of them.
To store the source files alongside your traces in Openlayer, enable
attachment uploads in init() by setting attachment_upload_enabled=True
(for binary inputs) and url_upload_enabled=True (to also fetch and persist
URL-referenced files).
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.