Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanmai committed May 3, 2024
1 parent 02ce0b9 commit fe3dbec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/helm/clients/vertexai_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,16 @@ def _make_multimodal_request(self, request: Request) -> RequestResult:
try:

def do_it() -> Dict[str, Any]:
response = model.generate_content(
response: GenerationResponse = model.generate_content(
contents, generation_config=parameters, safety_settings=self.safety_settings
)
# Depending on the version of the Vertex AI library and the type of prompt blocking,
# prompt blocking can show up in many ways, so this defensively handles most of these ways
if raw_response.prompt_feedback.block_reason:
if response.prompt_feedback.block_reason:
raise VertexAIContentBlockedError(
f"Prompt blocked with reason: {raw_response.prompt_feedback.block_reason}"
f"Prompt blocked with reason: {response.prompt_feedback.block_reason}"
)
if not raw_response.candidates:
if not response.candidates:
raise VertexAIContentBlockedError(f"No candidates in response: {response}")
# We should only have one candidate
assert (
Expand Down

0 comments on commit fe3dbec

Please sign in to comment.