BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
smackerz1988
Pyrite | Level 9

Hello,

 

I'm working on a sas macro that calls in ChatGPT into a SAS enviroment. I'm using this code whcih works successfully

 

 data _null_;
    file in;
    put "{";
    put '"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content"'}']'; 
    put "}";
    run;
 /* Reference that file as IN= parm in PROC HTTP POST */
    filename resp "%sysfunc(getoption(WORK))/echo.json";

    /* Send the request and payload */
    proc http 
        method = "POST"
        url    = "https://api.openai.com/v1/chat/completions"
        ct     = "application/json"
        in     = in
        out    = resp;
        headers "Authorization" = "Bearer &api_key.";
    run;    

 

My question is how do I alter this so I can explore some of the beta plug-ins that were introduced?. I do have a chatgpt 4 subscription so this is not an issue. is it better to create a separate macro for plug in specific requests as it would be a separate url or can it be altered within a single macro call?

1 ACCEPTED SOLUTION

Accepted Solutions
rudfaden
Lapis Lazuli | Level 10

No. Proc http can get data from websites

 

View solution in original post

3 REPLIES 3
rudfaden
Lapis Lazuli | Level 10
Which parameter do you want to change?
smackerz1988
Pyrite | Level 9

I guess what I'm trying to ascertain is can PROC HTTP be used to bring in plug ins associated with applications such as ChatGPT? Such as PDF Reader?

rudfaden
Lapis Lazuli | Level 10

No. Proc http can get data from websites

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1488 views
  • 0 likes
  • 2 in conversation