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: handle empty string in ChatSession.send_message #134

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

Hamza-nabil
Copy link
Contributor

@Hamza-nabil Hamza-nabil commented Dec 17, 2023

Description of the change

Update ChatSession.send_message to check for empty contents. If contents is empty a TypeError (Same behavior as GenerativeModel.generate_content)

Motivation

Fixing issue : #133

Type of change

Choose one: Bug fix

Checklist

  • I have performed a self-review of my code.
  • I have added detailed comments to my code where applicable.
  • I have verified that my change does not break existing code.
  • My PR is based on the latest changes of the main branch (if unsure, please run git pull --rebase upstream main).
  • I am familiar with the Google Style Guide for the language I have coded in.
  • I have read through the Contributing Guide and signed the Contributor License Agreement.

@Hamza-nabil Hamza-nabil requested a review from a team as a code owner December 17, 2023 00:29
@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:python sdk Issue/PR related to Python SDK labels Dec 17, 2023
Copy link
Collaborator

@MarkDaoust MarkDaoust left a comment

Choose a reason for hiding this comment

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

That sounds right. I can't think of any cases where an empty Content would be valid.
Could we move this to content_types.to_content so it applies everywhere?

@Hamza-nabil
Copy link
Contributor Author

Thank you for your feedback ! I've updated the code as suggested.

Copy link
Collaborator

@MarkDaoust MarkDaoust left a comment

Choose a reason for hiding this comment

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

Thanks!

@MarkDaoust MarkDaoust merged commit b23546f into google-gemini:main Dec 19, 2023
6 checks passed
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:python sdk Issue/PR related to Python SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants