Spaces:
Runtime error
Runtime error
File size: 711 Bytes
aa9134d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | from agents import Agent, output_guardrail, GuardrailFunctionOutput, Runner
from pydantic import BaseModel, Field
from model import model
class NoCode(BaseModel):
is_code: bool = Field(description='Checks for code in the report')
guard_agent = Agent(
name='guard_rail',
instructions='Checks whther the report has hidden code in it',
model=model,
output_type=NoCode
)
@output_guardrail
async def check_no_code(ctx, agent, report):
result = await Runner.run(guard_agent, report, context=ctx.context)
is_code = result.final_output.is_code
return GuardrailFunctionOutput(output_info={'found code': 'An embedded code was found'}, tripwire_triggered=is_code)
|