google-gemini / generative-ai-python

The official Python library for the Google Gemini API
https://pypi.org/project/google-generativeai/
Apache License 2.0
1.19k stars 227 forks source link

Unclear finish_reason #363

Closed akshit0201 closed 1 week ago

akshit0201 commented 1 month ago

Description of the bug:

I'm just asking to summarize a high school textbook which I'm feeding as images, was working perfectly fine on Friday, getting the following error today:

GenerateContentResponse(
    done=True,
    iterator=None,
    result=glm.GenerateContentResponse({
      "candidates": [
        {
          "finish_reason": 4,
          "index": 0,
          "safety_ratings": [],
          "token_count": 0,
          "grounding_attributions": []
        }
      ]
    }),
)

I don't understand what finish_reason 4 means, it's not given here: https://ai.google.dev/api/rest/v1/GenerateContentResponse

Actual vs expected behavior:

Actual: "finish_reason": 4

Expected: `"finish_reason": [Should be one of https://ai.google.dev/api/rest/v1/GenerateContentResponse#finishreason]

Any other information you'd like to share?

SDK version: 0.5.4

singhniraj08 commented 1 month ago

@akshit0201, Thank you reporting this issue. This looks like an intermittent error and should work now. This repository is for issues related to Python SDK client bugs or improvements and the client doesn't control the service's responses. For issues related to Gemini API, we would suggest you to use "Send Feedback" option in Gemini docs. Ref: Screenshot below. You can also post this issue on Discourse forum.

image

github-actions[bot] commented 3 weeks ago

Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs.

github-actions[bot] commented 1 week ago

This issue was closed because it has been inactive for 28 days. Please post a new issue if you need further assistance. Thanks!