openai-kit icon indicating copy to clipboard operation
openai-kit copied to clipboard

Update README.md with More Thorough Documentation

Open julianworden opened this issue 1 year ago • 4 comments

I started working with this library because it was listed here, but the documentation was quite minimal and I ended up having to experiment a lot in order to figure out how to do most things. It's possible that not all of the info in this PR is 100% correct, but code examples such as these would've been very helpful for me when I first started using this library so I'm confident that at least some of this will be useful.

One thing I did remove was this section from the setup instructions:

defer {
    // it's important to shutdown the httpClient after all requests are done, even if one failed. See: https://github.com/swift-server/async-http-client
    try? httpClient.syncShutdown()
}

While I'm sure it'd be important to include this block, I cannot figure out how to actually use it in the context of an app. If I call it when the app is first initialized, I get an error message after sending my first message. Currently, I have a sample app running just fine without this block, so if someone would like to incorporate this block into my examples I'll leave that up to you.

Thanks!

julianworden avatar May 10 '23 15:05 julianworden