Skip to content

Conversation

steven10a
Copy link
Collaborator

Added safety_identifier: 'oai-guardrails-ts' to the LLM calls

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a safety identifier to LLM calls so requests can be associated with a guardrails identifier.

  • Injects safety_identifier into responses and chat payloads
  • Uses a ts-ignore to bypass missing OpenAI type definitions

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/resources/responses/responses.ts Adds safety_identifier to the responses request payload.
src/resources/chat/chat.ts Adds safety_identifier to the chat request payload.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +88 to 90
// @ts-ignore - safety_identifier is not defined in OpenAI types yet
safety_identifier: 'oai-guardrails-ts',
}),
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Avoid using // @ts-ignore here. Prefer defining a local type augmentation (e.g., extend the request params type with safety_identifier) or use // @ts-expect-error to ensure we revisit this when types change; this prevents silently suppressing unrelated type errors.

Suggested change
// @ts-ignore - safety_identifier is not defined in OpenAI types yet
safety_identifier: 'oai-guardrails-ts',
}),
safety_identifier: 'oai-guardrails-ts',
} as Omit<OpenAI.Responses.ResponseCreateParams, 'input' | 'model' | 'stream' | 'tools'> & { input: typeof modifiedInput; model: typeof model; stream: typeof stream; tools?: typeof tools; safety_identifier: string }),

Copilot uses AI. Check for mistakes.

model,
stream,
...kwargs,
// @ts-ignore - safety_identifier is not defined in OpenAI types yet
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Same as in responses: replace // @ts-ignore with a typed approach (type augmentation or // @ts-expect-error) so we don't mask other potential type issues.

Suggested change
// @ts-ignore - safety_identifier is not defined in OpenAI types yet
// @ts-expect-error - safety_identifier is not defined in OpenAI types yet

Copilot uses AI. Check for mistakes.

Comment on lines +88 to +89
// @ts-ignore - safety_identifier is not defined in OpenAI types yet
safety_identifier: 'oai-guardrails-ts',
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title mentions adding a 'safety header', but this change adds a request payload field. Please either adjust the title/description or implement this as an HTTP header in the request layer if a header is required.

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

@gabor-openai gabor-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@gabor-openai gabor-openai merged commit 8527a84 into main Oct 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants