-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-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.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- Programming language: Python
- OS: Linux
- Language runtime version: 3.11, Anaconda
- Package version: 1.24
Steps to reproduce
conda config --append channels conda-forge
conda create -n myenv
conda activate myenv
pip install google-cloud-aiplatform
$ python -c 'from vertexai.generative_models import _generative_models as g
part1 = g.Part.from_uri(uri="gs://foo/bar", mime_type="baz")
gapic_content = g._to_content(part1)
parts = gapic_content.parts
part0 = parts[0]
print(type(part0))
# print("text" in part0)
# print("file_data" in part0)
print(part0._pb.WhichOneof("data"))
<class 'Part'>
Traceback (most recent call last):
File "<string>", line 9, in <module>
AttributeError: _pb
(issue_3129) user@w-avolkov-lydu7cih:~$ python
Python 3.11.0 (main, Mar 1 2023, 18:26:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from vertexai.generative_models import _generative_models as g
>>> part1 = g.Part.from_uri(uri="gs://foo/bar", mime_type="baz")
>>> gc = g._to_content(part1)
>>> type(gc)
<class 'google.cloud.aiplatform_v1beta1.types.content.Content'>
>>> type(gc.parts)
<class 'google.protobuf.pyext._message.RepeatedCompositeContainer'>
>>> type(gc.parts[0])
<class 'Part'>
>>> type(gc.parts[0]).__module__
>>> type(gc.parts[0]).__name__
'Part'
>>> type(gc.parts[0]).__dict__
mappingproxy({'DESCRIPTOR': <google.protobuf.pyext._message.MessageDescriptor object at 0x79c4ee245510>, '__module__': None, '__slots__': (), '__doc__': None, 'text': <field property 'google.cloud.aiplatform.v1beta1.Part.text'>, 'inline_data': <field property 'google.cloud.aiplatform.v1beta1.Part.inline_data'>, 'file_data': <field property 'google.cloud.aiplatform.v1beta1.Part.file_data'>, 'function_call': <field property 'google.cloud.aiplatform.v1beta1.Part.function_call'>, 'function_response': <field property 'google.cloud.aiplatform.v1beta1.Part.function_response'>, 'video_metadata': <field property 'google.cloud.aiplatform.v1beta1.Part.video_metadata'>})
See how gc
is a proper GAPIC proto-plus message, but gc.parts[0]
is a raw protobuf message.
See also googleapis/python-aiplatform#3129
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-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.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.