Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Get finish_reason: 6 without reason and content reply #476

Description

@A-baoYang

Description of the bug:

When sending some specific conversations to gemini-1.5-flash will get finish_reason: 6, and this finish_reason can't be found in official document:
image

Why is this cause?

Environment details

  • OS type and version: Ubuntu
  • Python version: 3.11.9
  • pip version: 24.0
  • package versions:
    google-ai-generativelanguage 0.6.6
    google-api-core 2.19.1
    google-api-python-client 2.137.0
    google-auth 2.32.0
    google-auth-httplib2 0.2.0
    google-generativeai 0.7.2

Code example

GEMINI_MODEL = ChatGoogleGenerativeAI(
    model="gemini-1.5-flash",
    temperature=0,
)
prompt = ChatPromptTemplate.from_template(prompt_tmpl)
chain = prompt | GEMINI_MODEL | StrOutputParser()
response = chain.invoke(prompt_parmas)

Error trace

[2024-07-19 10:51:30,697] [langchain_google_genai.chat_models | line:561 | _response_to_result] [ERROR] - response: candidates {
  index: 0
  finish_reason: 6
}
usage_metadata {
  prompt_token_count: 1961
  total_token_count: 1961
}

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions