UNPKG

@openai/agents-core

Version:

The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.

32 lines • 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OUTPUT_GUARDRAIL_BLOCKED_TOOL_OUTPUT = void 0; exports.createOutputGuardrailBlockedMessageResolver = createOutputGuardrailBlockedMessageResolver; exports.OUTPUT_GUARDRAIL_BLOCKED_TOOL_OUTPUT = 'Output withheld by an output guardrail.'; async function resolveOutputGuardrailBlockedMessage(configured, args) { if (typeof configured === 'string') { return configured.length > 0 ? configured : args.defaultMessage; } try { const resolved = await configured(args); if (typeof resolved === 'string' && resolved.length > 0) { return resolved; } } catch { // Formatter failures fail closed without exposing error details. } return args.defaultMessage; } function createOutputGuardrailBlockedMessageResolver(configured, state) { if (configured === undefined) { return undefined; } return (guardrailName) => resolveOutputGuardrailBlockedMessage(configured, { defaultMessage: exports.OUTPUT_GUARDRAIL_BLOCKED_TOOL_OUTPUT, guardrailName, agent: state._currentAgent, runContext: state._context, }); } //# sourceMappingURL=outputGuardrailBlockedMessage.js.map