<?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 Calling Azure OpenAi from base SAS in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Calling-Azure-OpenAi-from-base-SAS/m-p/942102#M10911</link>
    <description>&lt;P&gt;Is it possible to call an Azure OpenAI API from base SAS and chat with an LLM (i.e. ChatGPT-4)?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of what I am thinking. Prompt ChatGPT-4 with "Hello chat gpt" and capture the response in JSON. This just gives me a 404 error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone gotten something like this to work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let api_key= xxxxxxxxxxxxxxxxxxxxxxxxx;
%let question = %str(%"Hello chat gpt%");

/* Body of the POST request */
filename in temp;
data _null_;
file in;
put;
put "{";
put '"model": "gpt-4", "messages": [{"role": "user", "content": '"&amp;amp;question }]";
put "}";
run;

/* reference that file as IN= parm in PROC HTTP POST */
filename resp "%sysfunc(getoption(WORK))/echo.json";
proc http
method="POST"
url="&amp;lt;End Point URL&amp;gt;/openai/deployments/gpt-4/chat/completions?api-version=2024-02-01"
ct="application/json"
in=in
out=resp;
headers "Authorization" = "Bearer &amp;amp;api_key.";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 31 Aug 2024 14:16:06 GMT</pubDate>
    <dc:creator>supp</dc:creator>
    <dc:date>2024-08-31T14:16:06Z</dc:date>
    <item>
      <title>Calling Azure OpenAi from base SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Calling-Azure-OpenAi-from-base-SAS/m-p/942102#M10911</link>
      <description>&lt;P&gt;Is it possible to call an Azure OpenAI API from base SAS and chat with an LLM (i.e. ChatGPT-4)?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of what I am thinking. Prompt ChatGPT-4 with "Hello chat gpt" and capture the response in JSON. This just gives me a 404 error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone gotten something like this to work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let api_key= xxxxxxxxxxxxxxxxxxxxxxxxx;
%let question = %str(%"Hello chat gpt%");

/* Body of the POST request */
filename in temp;
data _null_;
file in;
put;
put "{";
put '"model": "gpt-4", "messages": [{"role": "user", "content": '"&amp;amp;question }]";
put "}";
run;

/* reference that file as IN= parm in PROC HTTP POST */
filename resp "%sysfunc(getoption(WORK))/echo.json";
proc http
method="POST"
url="&amp;lt;End Point URL&amp;gt;/openai/deployments/gpt-4/chat/completions?api-version=2024-02-01"
ct="application/json"
in=in
out=resp;
headers "Authorization" = "Bearer &amp;amp;api_key.";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 31 Aug 2024 14:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Calling-Azure-OpenAi-from-base-SAS/m-p/942102#M10911</guid>
      <dc:creator>supp</dc:creator>
      <dc:date>2024-08-31T14:16:06Z</dc:date>
    </item>
  </channel>
</rss>

