btfranklin / CleverBird

A Swift package for seamless integration with OpenAI's API, enabling advanced chat capabilities and token management in your applications
MIT License
28 stars 4 forks source link

Response status code was unacceptable: 404 #6

Closed colbyn closed 12 months ago

colbyn commented 1 year ago

The following

let openAIAPIConnection = OpenAIAPIConnection(apiKey: CHATGPT_API_KEY)
let chatThread = ChatThread(connection: openAIAPIConnection)
    .addSystemMessage("You are a helpful assistant.")
    .addUserMessage("Who won the world series in 2020?")
let completion = try! await chatThread.complete()
print(completion)

Fails at runtime with the following message:

Fatal error: 'try!' expression unexpectedly raised an error: CleverBird.CleverBirdError.requestFailed(message: "Response status code was unacceptable: 404.")

I have yet to determine if it's me or the library.

colbyn commented 1 year ago

Using the .gpt35Turbo model I get

CleverBird.CleverBirdError.requestFailed(message: "Response status code was unacceptable: 429.")
btfranklin commented 1 year ago

The 429 response code is described thusly: The HTTP 429 Too Many Requests response status code indicates the user has sent too many requests in a given amount of time ("rate limiting")

That makes me think it's something on your side. Please let me know if you're unable to resolve this problem after waiting a bit. You might want to log into your OpenAI account and look at the "usage" tab to see what's going on.

colbyn commented 1 year ago

@btfranklin Yeah you may be right. I'll post any updates I encounter.

btfranklin commented 1 year ago

@colbyn Did you resolve this? If not, do you have any additional information?

btfranklin commented 12 months ago

Closed this issue since I assume it has been resolved. Please feel free to re-open if the problem happens again.