Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

2 participants