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

[BFCL] Resolve Issue in Gemini Model When No Model Output #809

Merged
merged 5 commits into from
Dec 3, 2024

Conversation

HuanzhiMao
Copy link
Collaborator

@HuanzhiMao HuanzhiMao commented Dec 3, 2024

When the Gemini models output no content, the api_response.candidates will be [], and so calling api_response.candidates[0].content.parts will give IndexError: list index out of range. We should check if there is a candidate before accessing its content.

@HuanzhiMao HuanzhiMao added the BFCL-General General BFCL Issue label Dec 3, 2024
@HuanzhiMao HuanzhiMao changed the title [BFCL] Resolve Issue in Gemini Model (Prompt Mode) When No Model Output [BFCL] Resolve Issue in Gemini Model When No Model Output Dec 3, 2024
@HuanzhiMao
Copy link
Collaborator Author

Hey @gabrielibagon, could you kindly verify if this is the best way to patch it?

@gabrielibagon
Copy link
Contributor

This looks good to me. I'm curious on what situations Gemini returns no candidates vs no parts, since I've not often encountered no candidates being returned. But this seems like the right approach for that situation.

Copy link
Collaborator

@Fanjia-Yan Fanjia-Yan left a comment

Choose a reason for hiding this comment

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

LGTM. In PR description, attach an error test case and error output. This can help Gemini folks locate the model/serving issue.

@HuanzhiMao HuanzhiMao merged commit d7e52e5 into ShishirPatil:main Dec 3, 2024
@HuanzhiMao HuanzhiMao deleted the gemini-fix branch December 3, 2024 20:04
@HuanzhiMao
Copy link
Collaborator Author

This looks good to me. I'm curious on what situations Gemini returns no candidates vs no parts, since I've not often encountered no candidates being returned. But this seems like the right approach for that situation.

The previous implementation of checking len(api_response.candidates[0].content.parts) works most of the time. It is only in the irrelevance category that sometimes there are no candidates. And this happens pretty often in the prompt mode (such as gemini-1.5-pro-002).

VishnuSuresh27 pushed a commit to VishnuSuresh27/gorilla that referenced this pull request Dec 6, 2024
…il#809)

When the Gemini models output no content, the `api_response.candidates`
will be `[]`, and so calling `api_response.candidates[0].content.parts`
will give `IndexError: list index out of range`. We should check if
there is a candidate before accessing its content.
HuanzhiMao added a commit that referenced this pull request Dec 7, 2024
This PR updates the leaderboard to reflect the change in score due to
the following PR merge:

1. #747 
2. #770 
3. #768 
4. #750 
5. #763 
6. #772 
7. #777 
8. #778 
9. #786 
10. #787 
11. #697 
12. #718 
13. #755 
14. #796 
15. #789 
16. #804 
17. #808 
18. #809
19. #811 
20. #810 

Models were evaluated using checkpoint commit d7e52e5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFCL-General General BFCL Issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants