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

Reorganize crate #23

Merged
merged 8 commits into from
May 21, 2024
Merged

Reorganize crate #23

merged 8 commits into from
May 21, 2024

Conversation

kamillitman
Copy link
Contributor

@kamillitman kamillitman commented May 17, 2024

This PR re-organizes the crate structure to make it easier to maintain and expand in the future.

This PR does not introduce any new functionality and should be backwards compatible. Legacy structs are still accessible like they were in the past, and separate examples were created for them.

Key changes:

  • All legacy structs moved into a separate module. These are mostly there for backwards compatibility
  • New module created for Assistants (for now only includes OpenAI sub-module)
  • Separate examples created for legacy implementations (to ensure they still work). Current examples updated to account for new structure
image image

@@ -0,0 +1,5 @@
mod openai_assistant_legacy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make it deprecated?

#[deprecated(
since = "0.6.1",
note = "This struct is deprecated. Please use the `assistants::OpenAIAssistant` struct for latest functionality including Assistants API v2."
)]
Copy link
Contributor Author

@kamillitman kamillitman May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darioalessandro,

I added this script to all deprecated public structs. This will result in a warning if someone is trying to use any of the struct and point them to the correct alternative.

If you run the examples marked as 'deprecated_' you will get those warnings too. There should be no warnings for the standard examples.

Now, those 'deprecated_' examples make the cargo clippy fail. Any thoughts on what should I do with them? Suppressing deprecation warnings is an option but is that the right call? Or I can just remove the examples with deprecated structs?

mod utils;

pub use crate::assistant::OpenAIAssistant;
pub use crate::assistant::OpenAIAssistantVersion;
#[allow(deprecated)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darioalessandro, I had to allow deprecated for this module to make CI happy.

@kamillitman kamillitman merged commit 91a011c into main May 21, 2024
1 check passed
@kamillitman kamillitman deleted the reorganize-crate branch May 21, 2024 12:36
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

Successfully merging this pull request may close these issues.

2 participants