Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use ChatGoogleGenerativeAI with Gemini with proxy endpoint #682

Open
ferrygun opened this issue Jan 9, 2025 · 1 comment
Open

Comments

@ferrygun
Copy link

ferrygun commented Jan 9, 2025

I am getting this error with Gemini API and proxy endpoint as per my company endpoint:

object GenerateContentResponse can't be used in 'await' expression

This the code, how can make this works?

from langchain_google_genai import ChatGoogleGenerativeAI

llm = ChatGoogleGenerativeAI(
        model="gemini-1.5-pro",
            client_options={
                "api_endpoint": <Proxy_Endpoint>",
            },
            google_api_key="<api_key>", 
            transport="rest")
@kevinkupski
Copy link

Did you try to use rest_asyncio for the transport parameter? That worked for me. I guess the asyncio implementation is required when using the model with the asyncio functions (e.g. astream).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants