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

Fix optional fields in api #2421

Merged
merged 2 commits into from
Nov 25, 2024
Merged

Fix optional fields in api #2421

merged 2 commits into from
Nov 25, 2024

Conversation

hlohaus
Copy link
Collaborator

@hlohaus hlohaus commented Nov 25, 2024

No description provided.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, @h Lohaus! This pull request addresses a good point and improves the code.

The changes to the ChatCompletionsConfig and ImageGenerationConfig classes are clean and make the optional fields more concise. Removing the Field(examples=[None]) is a great simplification.

The changes in g4f/client/__init__.py regarding safe_aclose look good, ensuring proper resource cleanup even if a generator doesn't have an aclose method.

The modifications to the async_generate and async_create_variation methods, especially the checks for hasattr(provider_handler, "create_async_generator") and hasattr(provider, "create_async_generator"), improve the robustness of the code by handling different provider types more gracefully. This change also resolves potential issues.

The change in publish-workflow.yaml to explicitly name the artifact is a good addition for clarity.

Overall, this pull request is well-written, easy to understand, and makes the code cleaner and more reliable. I approve these changes.

@hlohaus hlohaus merged commit a722abb into xtekky:main Nov 25, 2024
1 check passed
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.

1 participant