Open AI Client library v0.1.0

I just released an Open AI client library that uses the latest API endpoints. It supports everything except all the endpoints that require a file. I’m not doing much with the fine tunings and audio API’s but I will get around to testing those soon. For now though, the most useful API’s work like a charm. Please give me feedback!

14 Likes

Oh great. I was thinking of contributing to the existing (seemingly abandoned) library once I had some free time, but this is even better!

By the way, what’s currently preventing the endpoints that need a file?

1 Like

@Bonarc

Good question! Just need to figure out the multipart request, I actually have a TODO marked for it:

TODO: This is not working, need to look at HTTP::FormData - Crystal 1.7.3

def multipart_post(path : String, parameters : Hash)
  headers["Content-Type"] = "multipart/form-data"
  response = client.post("/v1" + path, headers: headers, form: parameters.to_json)
  handle_response(response)
end

Once that is complete it can be used across all of the file related endpoints. It shouldn’t be hard too implement but I was going to prioritize implementing streaming with server sent events for the completion endpoints because I need that first! Any help would be appreciated!!

1 Like