Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/__tests__/unit/chat-resources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ describe('Chat resource', () => {
messages,
model: 'gpt-4',
stream: false,
safety_identifier: 'oai-guardrails-ts',
});
expect(client.handleLlmResponse).toHaveBeenCalledWith(
{ id: 'chat-response' },
Expand Down Expand Up @@ -153,6 +154,7 @@ describe('Responses resource', () => {
model: 'gpt-4o',
stream: false,
tools: undefined,
safety_identifier: 'oai-guardrails-ts',
});
expect(client.handleLlmResponse).toHaveBeenCalledWith(
{ id: 'responses-api' },
Expand Down
2 changes: 2 additions & 0 deletions src/resources/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export class ChatCompletions {
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.

safety_identifier: 'oai-guardrails-ts',
}),
]);

Expand Down
2 changes: 2 additions & 0 deletions src/resources/responses/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export class Responses {
stream,
tools,
...kwargs,
// @ts-ignore - safety_identifier is not defined in OpenAI types yet
safety_identifier: 'oai-guardrails-ts',
Comment on lines +88 to +89
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.

}),
Comment on lines +88 to 90
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.

]);

Expand Down