这是indexloc提供的服务,不要输入任何密码
Skip to content

Silent failure when output token limit is reached when using generateContent #828

@Dansyuqri

Description

@Dansyuqri

When using generateContent, errors due to output token limit being reached is not captured. The error object returns empty {}

Environment details

  • Programming language: TypeScript
  • OS: MacOS / Unix-based
  • Language runtime version: 5.7.3
  • Package version: 1.10.0

Steps to reproduce

  1. Using Seed value of 0, maxOutputToken of 1 and temperature value of 0.1, call generateContent with a prompt to count instances of object in any video. (the expectation is that the output token will exceed 1)
  2. An error will be thrown by generateContent, but body will be empty {}
Image

note: the above image is from a screenshot from a log. Essentially, the generateContent is wrapped by a try/catch block, and the error thrown is simply {}

Expected behaviour

There should be some kind of the error handling that indicates that the error is truly due to maxOutputToken being reached. For example, if we were to set the config.httpOptions.timeout to 100 milliseconds, we can get a simple error message of APIError from the SDK.

see below for example

Image

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responseissues requiring a response from the usertype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions