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

[Bug] AttributeError 'NoneType' object has no attribute 'usage_metadata' #662

Open
luke-han opened this issue Dec 23, 2024 · 2 comments
Open

Comments

@luke-han
Copy link

Hello,

I got this error from here (v2.0.8)

AttributeError 'NoneType' object has no attribute 'usage_metadata'

It looks like response_chunk can be None

@PragyanTiwari
Copy link

PragyanTiwari commented Dec 28, 2024

I think that the response_chunk attribute, i.e., usage_metadata, isn't set during initialization.

Instead, we need to use a dict-style method to dynamically retrieve the usage_metadata:

usage_metadata = proto.Message.to_dict(response_chunk['usage_metadata'])

I made that update in my forked repo, check for it here

@lkuligin
Copy link
Collaborator

@luke-han could you provide a reproducible sample, please?

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

3 participants