Skip to content

GenerateContentConfig.httpOptions.timeout is ignored in favor of client default timeout #794

@blakekjohnson

Description

@blakekjohnson

Environment details

  • Programming language: Java
  • OS: MacOS
  • Language runtime version: Azul Zulu 21.0.2
  • Package version:

Steps to reproduce

When attempting to use the provided GenerateContentConfig with a timeout specified in HttpOptions we are observing some inconsistencies based on whether or not the initial Client has a specified timeout within HttpOptions.

  1. Create a new Client with a distinctly low timeout
final Client client = new Client.Builder()
    .project(GOOGLE_API_PROJECT)
    .location(location)
    .credentials(credentials)
    .vertexAI(true)
    .clientOptions(
        ClientOptions.builder()
            .maxConnections(MAX_CONNECTIONS)
            .maxConnectionsPerHost(MAX_CONNECTIONS)
            .build())
    .httpOptions(HttpOptions.builder().timeout(100).apiVersion("v1").build())
    .build();
  1. Using the client make a call to generate content where GenerateContentConfig has an override for the timeout in it's HttpOptions
final GenerateContentConfig config = GenerateContentConfig.builder().
    .httpOptions(HttpOptions.builder()
        .timeout(30000)
        .apiVersion("v1")
        .build())
    // Rest of builder here
    .build();
final GenerateContentResponse response = client.models
    .generateContent(modelName, contentParts, config);
  1. Observe that the call immediately times out despite having provided a larger timeout window
  2. Repeat above steps while omitting the default timeout and HttpOptions during client creation
  3. Observe that the call respects the provided timeout from GenerateContentConfig

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: 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