File tree 2 files changed +8
-0
lines changed
vertexai/generative_models
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,8 @@ def test_chat_send_message_response_blocked_errors(
500
500
chat .send_message ("Please block with block_reason=OTHER." )
501
501
502
502
assert e .match ("Blocked for testing" )
503
+ # Checking that the original response and the block reason are accessible.
504
+ assert e .value .responses [0 ].prompt_feedback .block_reason .name == "OTHER"
503
505
# Checking that history did not get updated
504
506
assert len (chat .history ) == 2
505
507
Original file line number Diff line number Diff line change @@ -1642,6 +1642,12 @@ def text(self) -> str:
1642
1642
raise ValueError ("Response has no candidates (and no text)." )
1643
1643
return self .candidates [0 ].text
1644
1644
1645
+ @property
1646
+ def prompt_feedback (
1647
+ self ,
1648
+ ) -> gapic_prediction_service_types .GenerateContentResponse .PromptFeedback :
1649
+ return self ._raw_response .prompt_feedback
1650
+
1645
1651
1646
1652
class Candidate :
1647
1653
"""A response candidate generated by the model."""
You can’t perform that action at this time.
0 commit comments