FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

httpx client closed prematurely upon generate_content if the google.genai.Client is used as a temporary object · Issue #1763 · googleapis/python-genai · GitHub

httpx client closed prematurely upon generate_content if the google.genai.Client is used as a temporary object #1763

Description

Environment details

  • Programming language: Python
  • Language runtime version: 3.10.19
  • Package version: 1.52.0 (httpx 0.28.1)

Steps to reproduce

from google.genai import Client as GoogleGenAIClient
from google.genai.types import Content, Part

def make_client():
  return GoogleGenAIClient(vertexai=True, location="global")

contents = [Content(role="user", parts=[Part.from_text(text="hello world")])]

// this will cause httpx client closed error
make_client().models.generate_content(model="gemini-2.0-flash-001", contents=contents)

// ...
//  File "/opt/venv/lib/python3.10/site-packages/httpx/_client.py", line 901, in send
//    raise RuntimeError("Cannot send a request, as the client has been closed.")

// this will succeed
client = make_client()
client.models.generate_content(model="gemini-2.0-flash-001", contents=contents)

Activity

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

Metadata

Metadata

Assignees

Labels

api: vertex-aiIssues related to the Vertex AI API.priority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responsetype: 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


    Back | FazBrowse Home | New Git URL