Spaces:
Runtime error
Runtime error
| 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 | |
| ) | |
| 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) | |