Content-Length: 274627 | pFad | https://github.com/googleapis/python-aiplatform/commit/b91edf52e2b993c3301a419ad89b473c31c60cc3

1D fix: raise AttributeError for accessing non-existent fields of a proto. · googleapis/python-aiplatform@b91edf5 · GitHub
Skip to content

Commit b91edf5

Browse files
yeesiancopybara-github
authored andcommitted
fix: raise AttributeError for accessing non-existent fields of a proto.
PiperOrigin-RevId: 614668287
1 parent f90c9cc commit b91edf5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vertexai/generative_models/_generative_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ def text(self) -> str:
15261526
if len(self.parts) > 1:
15271527
raise ValueError("Multiple content parts are not supported.")
15281528
if not self.parts:
1529-
raise ValueError("Content has no parts.")
1529+
raise AttributeError("Content has no parts.")
15301530
return self.parts[0].text
15311531

15321532

@@ -1612,7 +1612,7 @@ def to_dict(self) -> Dict[str, Any]:
16121612
@property
16131613
def text(self) -> str:
16141614
if "text" not in self._raw_part:
1615-
raise ValueError("Part has no text.")
1615+
raise AttributeError("Part has no text.")
16161616
return self._raw_part.text
16171617

16181618
@property

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/python-aiplatform/commit/b91edf52e2b993c3301a419ad89b473c31c60cc3

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy