Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jkanalakis opened this issue Aug 1, 2024 · 5 comments

Comments

@jkanalakis
Copy link

jkanalakis commented Aug 1, 2024

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".

@jkanalakis jkanalakis changed the title Sample returns an error Call to createRun() results in error for OpenAI Assistants with "File search" or "Code interpreter" turned on Aug 1, 2024
@shipinev
Copy link
Member

shipinev commented Aug 1, 2024

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
Copy link
Author

@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. (#17) But this one can be closed out. I also personally think that (#1) could be closed since there isclear developer documentation.
Thank you.
John K.

@shipinev
Copy link
Member

shipinev commented Aug 1, 2024

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

@shipinev shipinev closed this as completed Aug 1, 2024
@jkanalakis
Copy link
Author

jkanalakis commented Aug 1, 2024 via email

@shipinev
Copy link
Member

shipinev commented Aug 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants