<?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 Re: SSL Verification failed when trying to use OpenAI library in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4398440#M7013</link>
    <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/913195"&gt;@nilendraFabric&lt;/a&gt;&amp;nbsp;We are not using custom key for certificate signing. Actually the above certificate is something that comes default with the spark environment (linux). I just pointed the http client to that certificate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am just wondering why it doesn't cause issue with requests library when I am hitting HTTPS sites. Strange though!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2025 15:04:06 GMT</pubDate>
    <dc:creator>govindarajan_d</dc:creator>
    <dc:date>2025-02-06T15:04:06Z</dc:date>
    <item>
      <title>SSL Verification failed when trying to use OpenAI library</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4396386#M6956</link>
      <description>&lt;P&gt;I am using an Azure OpenAI model with Python notebook in Fabric.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;client = openai.AzureOpenAI( 
  api_key=AZURE_OPENAI_API_KEY, 
  azure_endpoint=AZURE_OPENAI_ENDPOINT, 
  api_version=API_VERSION
) 

response = client.chat.completions.create() &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above code when run throws SSL issue, although if I try it in local environment it works fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error that appears is:&amp;nbsp;&lt;/P&gt;
&lt;ARTICLE class="" dir="auto" data-testid="conversation-turn-16" data-scroll-anchor="false"&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class="" dir="auto" data-message-author-role="user" data-message-id="274911af-f3cb-4ce2-9931-2123aba6d7d4"&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;ARTICLE class="" dir="auto" data-testid="conversation-turn-17" data-scroll-anchor="true"&gt;
&lt;P&gt;I tried the following installations to make sure SSL certificates are:&lt;/P&gt;
&lt;P&gt;pip install -U openai&lt;BR /&gt;pip install pip-system-certs&lt;BR /&gt;pip install --upgrade certifi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/ARTICLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/ARTICLE&gt;</description>
      <pubDate>Wed, 05 Feb 2025 12:53:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4396386#M6956</guid>
      <dc:creator>govindarajan_d</dc:creator>
      <dc:date>2025-02-05T12:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: SSL Verification failed when trying to use OpenAI library</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4396403#M6957</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/644992"&gt;@govindarajan_d&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;give it a try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import httpx&lt;/P&gt;&lt;P&gt;client = openai.AzureOpenAI(&lt;BR /&gt;api_key=AZURE_OPENAI_API_KEY,&lt;BR /&gt;azure_endpoint=AZURE_OPENAI_ENDPOINT,&lt;BR /&gt;api_version=API_VERSION,&lt;BR /&gt;http_client=httpx.Client(verify="/path/to/your/custom_certificate.pem")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;not recommended for prod, but lets see if this works&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 13:00:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4396403#M6957</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-02-05T13:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: SSL Verification failed when trying to use OpenAI library</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4396971#M6968</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/913195"&gt;@nilendraFabric&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code worked, I pointed it to the existing certificate.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;        client = openai.AzureOpenAI(
            api_key=AZURE_OPENAI_API_KEY,
            azure_endpoint=AZURE_OPENAI_ENDPOINT,
            api_version=API_VERSION,
            http_client=httpx.Client(verify="/etc/ssl/certs/ca-certificates.crt"),
        )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But why doesn't it work normally when other libraries like requests work without issues? Also, for production what would you suggest?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 18:44:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4396971#M6968</guid>
      <dc:creator>govindarajan_d</dc:creator>
      <dc:date>2025-02-05T18:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: SSL Verification failed when trying to use OpenAI library</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4397025#M6969</link>
      <description>&lt;P&gt;Great it worked&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/644992"&gt;@govindarajan_d&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest store pem in Key vault and then use it here.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;or store it in a place where it cant be accessed unauthorised.&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;it often contains sensitive information such as private keys, which must be protected from unauthorized access.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if this is helpful please accept the solution&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 19:24:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4397025#M6969</guid>
      <dc:creator>nilendraFabric</dc:creator>
      <dc:date>2025-02-05T19:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: SSL Verification failed when trying to use OpenAI library</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4397969#M6998</link>
      <description>&lt;P&gt;Also works with&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;http_client&lt;/SPAN&gt;&lt;SPAN&gt;=httpx.AsyncClient&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 06 Feb 2025 10:04:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4397969#M6998</guid>
      <dc:creator>PPuente</dc:creator>
      <dc:date>2025-02-06T10:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: SSL Verification failed when trying to use OpenAI library</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4398440#M7013</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/913195"&gt;@nilendraFabric&lt;/a&gt;&amp;nbsp;We are not using custom key for certificate signing. Actually the above certificate is something that comes default with the spark environment (linux). I just pointed the http client to that certificate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am just wondering why it doesn't cause issue with requests library when I am hitting HTTPS sites. Strange though!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 15:04:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/SSL-Verification-failed-when-trying-to-use-OpenAI-library/m-p/4398440#M7013</guid>
      <dc:creator>govindarajan_d</dc:creator>
      <dc:date>2025-02-06T15:04:06Z</dc:date>
    </item>
  </channel>
</rss>

