<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to Fetch Azure OpenAI api_version and engine Dynamically After  Resource Creation via Python? in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/how-to-fetch-azure-openai-api-version-and-engine-dynamically/m-p/105927#M9545</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using Python to automate the creation of Azure OpenAI resources via the Azure Management API. I am successfully able to create the resource, but I need to dynamically fetch the following details after the resource is created:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;API Version&lt;/STRONG&gt; (api_version)&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Engine&lt;/STRONG&gt; (such as text-davinci-003, gpt-3.5-turbo, etc.)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here are the steps I have taken so far:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Created Resource&lt;/STRONG&gt;: I use the Azure Management API to create the OpenAI resource (PUT request).&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Fetch API Keys&lt;/STRONG&gt;: After the resource is created, I fetch the API keys by calling listKeys.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;However, when the resource is created, I am unable to dynamically retrieve the &lt;STRONG&gt;API version&lt;/STRONG&gt; and &lt;STRONG&gt;engine&lt;/STRONG&gt; directly from the resource.&lt;/P&gt;&lt;H3&gt;Problem:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;The api_version returned is showing as Unknown even though I know there is a specific version associated with the OpenAI resource.&lt;/LI&gt;&lt;LI&gt;I am unable to retrieve the engine types dynamically (like text-davinci-003, gpt-3.5-turbo, etc.) after the resource creation.&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;What I’ve Tried:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;I tried using the exportTemplate API, but it only gives me a template and not the specific api_version and engine I need.&lt;/LI&gt;&lt;LI&gt;I also tried checking the resource properties, but the api_version field remains Unknown.&lt;/LI&gt;&lt;LI&gt;I even tried making an API call to https://&amp;lt;resource_name&amp;gt;.openai.azure.com/v1/engines, but I receive DNS resolution issues.&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;My Goal:&lt;/H3&gt;&lt;P&gt;I would like to automate the process of retrieving the &lt;STRONG&gt;API version&lt;/STRONG&gt; and &lt;STRONG&gt;engine&lt;/STRONG&gt; dynamically after the resource is created, using Python and Azure API.&lt;/P&gt;&lt;P&gt;Is there a way to retrieve this information directly after the resource creation or via a different API endpoint?&lt;/P&gt;&lt;P&gt;Any help or guidance would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2025 14:57:22 GMT</pubDate>
    <dc:creator>Sudheer2</dc:creator>
    <dc:date>2025-01-16T14:57:22Z</dc:date>
    <item>
      <title>How to Fetch Azure OpenAI api_version and engine Dynamically After  Resource Creation via Python?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-fetch-azure-openai-api-version-and-engine-dynamically/m-p/105927#M9545</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using Python to automate the creation of Azure OpenAI resources via the Azure Management API. I am successfully able to create the resource, but I need to dynamically fetch the following details after the resource is created:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;API Version&lt;/STRONG&gt; (api_version)&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Engine&lt;/STRONG&gt; (such as text-davinci-003, gpt-3.5-turbo, etc.)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here are the steps I have taken so far:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Created Resource&lt;/STRONG&gt;: I use the Azure Management API to create the OpenAI resource (PUT request).&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Fetch API Keys&lt;/STRONG&gt;: After the resource is created, I fetch the API keys by calling listKeys.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;However, when the resource is created, I am unable to dynamically retrieve the &lt;STRONG&gt;API version&lt;/STRONG&gt; and &lt;STRONG&gt;engine&lt;/STRONG&gt; directly from the resource.&lt;/P&gt;&lt;H3&gt;Problem:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;The api_version returned is showing as Unknown even though I know there is a specific version associated with the OpenAI resource.&lt;/LI&gt;&lt;LI&gt;I am unable to retrieve the engine types dynamically (like text-davinci-003, gpt-3.5-turbo, etc.) after the resource creation.&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;What I’ve Tried:&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;I tried using the exportTemplate API, but it only gives me a template and not the specific api_version and engine I need.&lt;/LI&gt;&lt;LI&gt;I also tried checking the resource properties, but the api_version field remains Unknown.&lt;/LI&gt;&lt;LI&gt;I even tried making an API call to https://&amp;lt;resource_name&amp;gt;.openai.azure.com/v1/engines, but I receive DNS resolution issues.&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;My Goal:&lt;/H3&gt;&lt;P&gt;I would like to automate the process of retrieving the &lt;STRONG&gt;API version&lt;/STRONG&gt; and &lt;STRONG&gt;engine&lt;/STRONG&gt; dynamically after the resource is created, using Python and Azure API.&lt;/P&gt;&lt;P&gt;Is there a way to retrieve this information directly after the resource creation or via a different API endpoint?&lt;/P&gt;&lt;P&gt;Any help or guidance would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 14:57:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-fetch-azure-openai-api-version-and-engine-dynamically/m-p/105927#M9545</guid>
      <dc:creator>Sudheer2</dc:creator>
      <dc:date>2025-01-16T14:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to Fetch Azure OpenAI api_version and engine Dynamically After  Resource Creation via Python</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-fetch-azure-openai-api-version-and-engine-dynamically/m-p/138979#M11020</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Sudheer,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's been a while since you posted, but are you still facing this issue? Here are a few things you could check if needed:&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;STRONG&gt;API version&lt;/STRONG&gt;&lt;/H3&gt;
&lt;P&gt;In Azure OpenAI, &lt;STRONG&gt;api-version&lt;/STRONG&gt; is a query parameter on the data-plane (inference) requests, not a property stored on the resource. You supply and pin it per request,&amp;nbsp;e.g.,&amp;nbsp;&lt;CODE class="qt3gz9f"&gt;?api-version=2024-10-21&lt;/CODE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Programmatically, keep a mapping in code to your approved versions (e.g., latest GA vs. preview) based on Microsoft’s “API lifecycle” guidance, rather than reading it from the ARM resource.&lt;/P&gt;
&lt;P&gt;If you’re integrating through Databricks External Models, set &lt;CODE class="qt3gz9f"&gt;openai_api_version&lt;/CODE&gt; on the endpoint configuration to the pinned version (for example, 2023-05-15 or the current GA you use).&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/ai-services/openai/reference" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/ai-services/openai/reference&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/generative-ai/external-models/" target="_blank" rel="noopener"&gt; https://learn.microsoft.com/en-us/azure/databricks/generative-ai/external-models/&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;H3&gt;&lt;STRONG&gt;Engine/model enumeration after resource creation&lt;/STRONG&gt;&lt;/H3&gt;
&lt;P&gt;Azure OpenAI has moved away from the legacy “v1/engines” surface. In Azure the concept you target in requests is your &lt;STRONG&gt;deployment&lt;/STRONG&gt; of a model (e.g., gpt-35-turbo), using paths like &lt;CODE class="qt3gz9f"&gt;/openai/deployments/{deployment-id}/chat/completions&lt;/CODE&gt; (or completions/embeddings). To know what you can call, you:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;List your resource’s &lt;STRONG&gt;deployments&lt;/STRONG&gt; (control-plane; via Azure management API/CLI), or&lt;/LI&gt;
&lt;LI&gt;List &lt;STRONG&gt;available models&lt;/STRONG&gt; for your region using the models catalog (concept docs) to choose models to deploy, then deploy and query by deployment name.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;In Databricks &lt;STRONG&gt;External Models&lt;/STRONG&gt;, point to a deployment by filling &lt;CODE class="qt3gz9f"&gt;openai_deployment_name&lt;/CODE&gt;&amp;nbsp;and use the unified OpenAI-compatible request format. Databricks forwards to Azure OpenAI and centrally manages credentials and governance.&lt;/P&gt;
&lt;H3&gt;&lt;STRONG&gt;Endpoint path and fixing the DNS/engines error&lt;/STRONG&gt;&lt;/H3&gt;
&lt;P&gt;The Azure OpenAI data-plane requests use the &lt;STRONG&gt;openai/deployments&lt;/STRONG&gt; path instead of&amp;nbsp;&lt;CODE class="qt3gz9f"&gt;v1/engines&lt;/CODE&gt;. For example:&lt;/P&gt;
&lt;DIV class="go8b9g1 _7pq7t6cl" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="qt3gz9e hljs language-bash _1ymogdh2"&gt;POST https://{resource}.openai.azure.com/openai/deployments/{deployment}/chat/completions?api-version=2024-10-21&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="go8b9g3 _7pq7t62y _7pq7t6cm _7pq7t6ay _7pq7t6bo"&gt;
&lt;DIV class="_17yk06p0"&gt;&lt;SPAN&gt;This should resolve correctly assuming the hostname is reachable in your network.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;If you’re behind private networking (Private Endpoint, firewall/VNet restrictions), ensure your client’s DNS/network allows resolution to &lt;/SPAN&gt;&lt;CODE class="qt3gz9f"&gt;{resource}.openai.azure.com&lt;/CODE&gt;&lt;SPAN&gt;; otherwise you’ll see failures unrelated to the path itself.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;H3 class="_7uu25p0 qt3gz9c _7pq7t612 heading3 _7uu25p1"&gt;Top next steps to try&lt;/H3&gt;
&lt;UL class="qt3gz97 qt3gz92"&gt;
&lt;LI class="qt3gz9a"&gt;
&lt;P class="qt3gz91 paragraph"&gt;Use the correct Azure OpenAI data-plane path and explicitly pin an &lt;STRONG&gt;api-version&lt;/STRONG&gt;. Azure OpenAI requests should use &lt;CODE class="qt3gz9f"&gt;/openai/deployments/{deployment}/...&lt;/CODE&gt; (not &lt;CODE class="qt3gz9f"&gt;v1/engines&lt;/CODE&gt;) and include &lt;CODE class="qt3gz9f"&gt;?api-version=...&lt;/CODE&gt; (for example, &lt;CODE class="qt3gz9f"&gt;2024-10-21&lt;/CODE&gt;).&lt;/P&gt;
&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;
&lt;P class="qt3gz91 paragraph"&gt;Query by a model &lt;STRONG&gt;deployment&lt;/STRONG&gt; name (your deployed model, e.g., &lt;CODE class="qt3gz9f"&gt;gpt-35-turbo&lt;/CODE&gt;) rather than “engine.” In Azure OpenAI you call the deployment, not a generic engine list. Ensure your code uses the deployment ID you created and passes it in the URL path.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;
&lt;P class="qt3gz91 paragraph"&gt;Centralize the config in &lt;STRONG&gt;Databricks External Models&lt;/STRONG&gt; so the base URL, deployment name, and version are pinned once. Set &lt;CODE class="qt3gz9f"&gt;openai_api_base&lt;/CODE&gt;, &lt;CODE class="qt3gz9f"&gt;openai_deployment_name&lt;/CODE&gt;, and &lt;CODE class="qt3gz9f"&gt;openai_api_version&lt;/CODE&gt; in the endpoint config. Databricks will forward requests and manage governance and secrets for you.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI class="qt3gz9a"&gt;
&lt;P class="qt3gz91 paragraph"&gt;If you saw DNS or connect failures, verify workspace networking vs. Azure OpenAI. Private endpoints/firewall rules can block outbound resolution. Make sure the hostname &lt;CODE class="qt3gz9f"&gt;https://{resource}.openai.azure.com&lt;/CODE&gt; is reachable or configure the approved network path.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I hope that helps, but if not then let us know!&lt;/P&gt;
&lt;P&gt;-James&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 23:33:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-fetch-azure-openai-api-version-and-engine-dynamically/m-p/138979#M11020</guid>
      <dc:creator>jamesl</dc:creator>
      <dc:date>2025-11-13T23:33:11Z</dc:date>
    </item>
  </channel>
</rss>

