Skip to content

Commit 4960ae0

Browse files
committed
Remove reduntant client type check
1 parent aac8b8f commit 4960ae0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/guardrails/checks/text/moderation.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,9 @@ async def moderation(
165165
Returns:
166166
GuardrailResult: Indicates if tripwire was triggered, and details of flagged categories.
167167
"""
168-
client = None
169-
if ctx is not None:
170-
candidate = getattr(ctx, "guardrail_llm", None)
171-
if isinstance(candidate, AsyncOpenAI):
172-
client = candidate
173-
174168
# Try the context client first, fall back if moderation endpoint doesn't exist
169+
client = getattr(ctx, "guardrail_llm", None) if ctx is not None else None
170+
175171
if client is not None:
176172
try:
177173
resp = await _call_moderation_api(client, data)

0 commit comments

Comments
 (0)