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 call aivoke with transport="rest". #268

Open
kento996 opened this issue Apr 2, 2024 · 2 comments
Open

Unable to call aivoke with transport="rest". #268

kento996 opened this issue Apr 2, 2024 · 2 comments
Assignees
Labels
component:python sdk Issue/PR related to Python SDK status:awaiting user response Awaiting a response from the author status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@kento996
Copy link

kento996 commented Apr 2, 2024

Description of the bug:

When I set transport="rest" in ChatGoogleGenerativeAI, I can't use chain.ainvoke

def get_gemini_pro() -> BaseChatModel:

    return ChatGoogleGenerativeAI(model="gemini-1.5-pro-latest",
                                  temperature=0,
                                  convert_system_message_to_human=True,
                                  transport="rest")
async def invokeChain(code):
    llm=get_gemini_pro()
    chain=descriptionGenTemplate()|llm|CodeoutputStruction()
    res= await chain.ainvoke({"code":code})
    print(res)
if __name__ == '__main__':

    code="""
xxxxxxxxxxxxxxx
"""
    asyncio.run(invokeChain(code))

Executing the above code displays the following error:

Traceback (most recent call last):
  File "f:\code\pythonProject\Gemini_CWEs\codeExpansion.py", line 93, in <module>
    asyncio.run(invokeChain(code))
  File "E:\anaconda\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^

                               ......

  File "C:\Users\kento\AppData\Local\pypoetry\Cache\virtualenvs\gemini-cwes-rly_BX-h-py3.11\Lib\site-packages\google\api_core\grpc_helpers_async.py", line 187, in error_remapped_callable
    raise TypeError("Unexpected type of call %s" % type(call))
TypeError: Unexpected type of call <class 'google.ai.generativelanguage_v1beta.types.generative_service.GenerateContentResponse'>

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

@kento996 kento996 added component:python sdk Issue/PR related to Python SDK type:bug Something isn't working labels Apr 2, 2024
@singhniraj08 singhniraj08 added the status:triaged Issue/PR triaged to the corresponding sub-team label Apr 4, 2024
@MarkDaoust
Copy link
Collaborator

MarkDaoust commented Apr 10, 2024

It might be that streaming with transport="rest" is broken.

Edit: No. Rest async streaming is broken.

@MarkDaoust MarkDaoust added the status:awaiting user response Awaiting a response from the author label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:python sdk Issue/PR related to Python SDK status:awaiting user response Awaiting a response from the author status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants