How to include json data into prompt api

510 views Asked by At

I want to send data to chatgpt via the gpt-4 api. My data is in json format and I'm having trouble sending it along with the prompt.

{
   "model":"gpt-4",
   "messages":[
      {
         "role":"system",
         "content":"You are a helpful assistant."
      },
      {
         "role":"user",
         "content":"here, I put prompt, including describing data and what I would like it to do"
               }
            ],
            "temperature":0.5,
            "max_tokens":500
         }
     
     
     My data is in json format like this :
     the data to be analyzed is something like this
{
            "somekey": "value",
            "somekey2": "value",
            "somekey3": "value",
            "somekey4": "value",
            "somekey5": "value",
            "somekey6": "value"
        },

I'll have 30-40 records at a time. Just doing it via postman for now

My prompt by itself is about 350 words. Any guidance would be appreciated

0

There are 0 answers