You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The latest version, 0.2.0, break the completion example, likely due to the stream being true and the decoding not expecting the JSON format which OpenAI returns.
To Reproduce
Steps to reproduce the behavior:
Create a new Xcode project
Use the example of the prompt in the README:
let query = CompletionsQuery(model: .textDavinci_003, prompt: "What is 42?", temperature: 0, max_tokens: 100, top_p: 1, frequency_penalty: 0, presence_penalty: 0, stop: ["\\n"]) openAI.completions(query: query) { result in //Handle result here } //or let result = try await openAI.completions(query: query)
Run the example and observe the following error:
failure(Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around line 1, column 0." UserInfo={NSDebugDescription=Invalid value around line 1, column 0., NSJSONSerializationErrorIndex=0}))))
Expected behavior
Reverting to the version before 0.2.0 works fine with an expected result without error.
Desktop (please complete the following information):
OS: macOS 13.3.1
The text was updated successfully, but these errors were encountered:
Describe the bug
The latest version, 0.2.0, break the completion example, likely due to the stream being true and the decoding not expecting the JSON format which OpenAI returns.
To Reproduce
Steps to reproduce the behavior:
let query = CompletionsQuery(model: .textDavinci_003, prompt: "What is 42?", temperature: 0, max_tokens: 100, top_p: 1, frequency_penalty: 0, presence_penalty: 0, stop: ["\\n"]) openAI.completions(query: query) { result in //Handle result here } //or let result = try await openAI.completions(query: query)
failure(Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around line 1, column 0." UserInfo={NSDebugDescription=Invalid value around line 1, column 0., NSJSONSerializationErrorIndex=0}))))
Expected behavior
Reverting to the version before 0.2.0 works fine with an expected result without error.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: