openAIAssitant method

Future openAIAssitant(
  1. Map data,
  2. dynamic endpoint,
  3. dynamic apiKey
)

MAKE A POST REQUEST

Implementation

Future openAIAssitant(Map data, endpoint, apiKey) async{


  var url = Uri.parse('https://api.openai.com/v1/$endpoint');
  var response = await http.post(url,
      body: jsonEncode(data),
      headers: {
        "Authorization" : "Bearer $apiKey",
        "Content-Type" : "application/json; charset=UTF-8",
        "OpenAI-Beta" : "assistants=v1"
      }
  );

  return response;

}