adamrushy / OpenAISwift

This is a wrapper library around the ChatGPT and OpenAI HTTP API
MIT License
1.62k stars 246 forks source link

Problems of ChatGPT #50

Closed underthestars-zhy closed 1 year ago

underthestars-zhy commented 1 year ago

sometimes it will throw an error:

decodingError(error: Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "object", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"object\", intValue: nil) (\"object\").", underlyingError: nil))) [request-id: CAB2D22B-D7D9-4F45-AF7C-9086A7F5471F]
adamrushy commented 1 year ago

Yeah, we have PR's incoming which makes this an optional value. Although, it won't resolve your underlying issue from OpenAI... can you share some sample code/prompts you're sending?

underthestars-zhy commented 1 year ago

let chat: [ChatMessage] = [
                            ChatMessage(role: .system, content: "You are a helpful L2 English teaching assistant."),
                            ChatMessage(role: .user, content: "I am learning the word \(input.word), and I need some help on it.\n" + "Could you tell me the prefix, root, and suffix of this word \"$1\"?"),
                        ]
let result = try? await openAI.sendChat(with: chat)
kemiljk commented 1 year ago
let chat: [ChatMessage] = [
                            ChatMessage(role: .system, content: "You are a helpful L2 English teaching assistant."),
                            ChatMessage(role: .user, content: "I am learning the word \(input.word), and I need some help on it.\n" + "Could you tell me the prefix, root, and suffix of this word \"$1\"?"),
                        ]
let result = try? await openAI.sendChat(with: chat)

Out of interest, @underthestars-zhy do you have a funded account or are you using the trial? I've seen people encounter this error before when they're in the 3 month trial due to hitting token limits.

underthestars-zhy commented 1 year ago

I am using trial. But I don’t think I hit the limit. Because my first time use this api, it returned an error.Sent from my iPhoneOn Mar 22, 2023, at 04:01, Karl @.***> wrote:

let chat: [ChatMessage] = [ ChatMessage(role: .system, content: "You are a helpful L2 English teaching assistant."), ChatMessage(role: .user, content: "I am learning the word (input.word), and I need some help on it.\n" + "Could you tell me the prefix, root, and suffix of this word \"$1\"?"), ] let result = try? await openAI.sendChat(with: chat)

Out of interest, @underthestars-zhy do you have a funded account or are you using the trial? I've seen people encounter this error before when they're in the 3 month trial due to hitting token limits.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

kemiljk commented 1 year ago

Yeah, this is interesting. Maybe you've not hit the limit but I think the free API rate limits requests a lot so you may be having issues due to that.

Did you set up the free trial more than 3 months ago?

In the cases I've seen before, once someone added billing details to their account, they stopped seeing this error.

underthestars-zhy commented 1 year ago

No just 1 hours ago. It seems in the evening(morning in the US) this problems occurs more frequently. Sent from my iPhoneOn Mar 22, 2023, at 16:18, Karl @.***> wrote: Yeah, this is interesting. Maybe you've not hit the limit but I think the free API rate limits requests a lot so you may be having issues due to that. Did you set up the free trial more than 3 months ago? In the cases I've seen before, once someone added billing details to their account, they stopped seeing this error.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>