exyte / OpenAI

MIT License
32 stars 1 forks source link

Call to createRun() results in error for OpenAI Assistants with "File search" or "Code interpreter" turned on #14

Closed jkanalakis closed 2 months ago

jkanalakis commented 2 months ago

I really like this library, but I'm having some difficulty with the sample. I only enter my OpenAI Key and the AssistantID and ran the sample project. The OpenAPI Library does not work with some OpenAI Assistant settings as shown below.

Screenshot 2024-07-31 at 8 09 33 PM

When I enable "File search" or "Code interpreter" the API request fails with the client.createRun() call and the following error message appears in the app log. When these options are both turned off, then everything works as expected.

decodingFailed(underlyingError: Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "tools", intValue: nil), _JSONKey(stringValue: "Index 1", intValue: 1), CodingKeys(stringValue: "type", intValue: nil)], debugDescription: "Cannot initialize ToolType from invalid String value file_search", underlyingError: nil)))

Based on this console output. It looks like there's a decoding failure due to an invalid string value "file_search" in the ToolType enum. So I think the ToolType enum also needs to include a case for "file_search".

shipinev commented 2 months ago

Hey @jkanalakis. It looks like we missed a few API changes that were added about 2 months ago. Thanks for pointing this out. I made some changes to the ToolType and related models to work with these updates. Before we release the hotfix, you can install it by specifying the branch name (main) in your dependency manager configuration.

Please let me know if it works for you now.

jkanalakis commented 2 months ago

@shipinev Yes, perfect! This works perfectly now with those Assistant settings turned on using the main branch. I still see the other problem i just reported. (https://github.com/exyte/OpenAI/issues/17) But this one can be closed out. I also personally think that (https://github.com/exyte/OpenAI/issues/1) could be closed since there isclear developer documentation. Thank you. John K.

shipinev commented 2 months ago

Great news! Thanks for checking it out. Yup, you're right, it's time to finally close #1 :D

jkanalakis commented 2 months ago

Great, thank you Dmitry. For completeness, will there be a new Git Release to 1.0.2?

Best wishes,

John K.


From: Dmitry Shipinev @.> Sent: Thursday, August 1, 2024 2:30 AM To: exyte/OpenAI @.> Cc: John Kanalakis @.>; Mention @.> Subject: Re: [exyte/OpenAI] Call to createRun() results in error for OpenAI Assistants with "File search" or "Code interpreter" turned on (Issue #14)

Closed #14https://github.com/exyte/OpenAI/issues/14 as completed.

— Reply to this email directly, view it on GitHubhttps://github.com/exyte/OpenAI/issues/14#event-13722976276, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAHXKFPG5ESRCSX5D7BVHALZPH52VAVCNFSM6AAAAABLZU2PBWVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTG4ZDEOJXGYZDONQ. You are receiving this because you were mentioned.Message ID: @.***>

shipinev commented 2 months ago

Hello John. Version 1.0.2 is available via SPM (https://github.com/exyte/OpenAI/releases/tag/1.0.2). The CocoaPods update should be available by Monday.