create method

Future<RunResponse?> create(
  1. String assistantId,
  2. String threadId
)

CREATE A RUN TO EXECUTE THE ASSISTANT

Implementation

Future<RunResponse?> create(String assistantId, String threadId)async{
  Internet net = Internet();
  try{
    var data = {
      "assistant_id" : assistantId
    };
    var res = await net.openAIAssitant(data, "threads/$threadId/runs", apiKey);

    if(res.statusCode == 200){
      var r = RunResponse.fromJson(jsonDecode(res.body));
      return r;
    }else{
      return null;
    }
  }catch(e){
    if (kDebugMode) {
      print(e.toString());
    }
    return null;
  }
}