Skip to content

Commit e62de08

Browse files
fix(ci): unblock lint and docs build
1 parent 73d7114 commit e62de08

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

docs/configure-rails/guardrail-catalog/third-party.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ Pangea AI Guard <community/pangea>
304304
Patronus Evaluate API <community/patronus-evaluate-api>
305305
Patronus Lynx <community/patronus-lynx>
306306
PolicyAI <community/policyai>
307+
Polygraf <community/polygraf>
307308
Presidio <community/presidio>
308309
Private AI <community/privateai>
309310
Prompt Security <community/prompt-security>

nemoguardrails/embeddings/providers/google.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ def encode(self, documents: List[str]) -> List[List[float]]:
107107
embed_kwargs["output_dimensionality"] = self.output_dimensionality
108108

109109
results = self.client.models.embed_content(**embed_kwargs)
110-
return [emb.values for emb in results.embeddings]
110+
embeddings: List[List[float]] = []
111+
for emb in results.embeddings:
112+
# Some clients may return `None` values for embeddings on partial failures.
113+
# We treat that as an error to keep the return type stable.
114+
if emb.values is None:
115+
raise RuntimeError("Embedding response contained a null embedding vector.")
116+
embeddings.append(list(emb.values))
117+
return embeddings
111118
except Exception as e:
112119
raise RuntimeError(f"Failed to retrieve embeddings: {e}") from e

nemoguardrails/library/polygraf/request.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
log = logging.getLogger(__name__)
2424

2525

26-
async def polygraf_request(
27-
text: str, server_endpoint: str, api_key: Optional[str] = None
28-
) -> List[Dict[str, Any]]:
26+
async def polygraf_request(text: str, server_endpoint: str, api_key: Optional[str] = None) -> List[Dict[str, Any]]:
2927
"""Send a PII detection request to the Polygraf API.
3028
3129
Args:
@@ -55,13 +53,9 @@ async def polygraf_request(
5553
headers["Authorization"] = f"Bearer {api_key}"
5654

5755
async with aiohttp.ClientSession() as session:
58-
async with session.post(
59-
server_endpoint, json=payload, headers=headers
60-
) as resp:
56+
async with session.post(server_endpoint, json=payload, headers=headers) as resp:
6157
if resp.status != 200:
62-
raise ValueError(
63-
f"Polygraf call failed with status code {resp.status}.\nDetails: {await resp.text()}"
64-
)
58+
raise ValueError(f"Polygraf call failed with status code {resp.status}.\nDetails: {await resp.text()}")
6559

6660
try:
6761
data = await resp.json()

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ include = [
174174
"nemoguardrails/tracing/**",
175175
"nemoguardrails/server/**",
176176
"tests/test_callbacks.py",
177-
"nemoguardrails/benchmark/**",
178177
"nemoguardrails/guardrails/**"
179178
]
180179
exclude = [

0 commit comments

Comments
 (0)