Skip to content

Comments

Update OpenAI library to v6.6.0 and change default model to gpt-5-mini#16

Merged
Bullrich merged 6 commits intomainfrom
copilot/update-openai-library
Oct 20, 2025
Merged

Update OpenAI library to v6.6.0 and change default model to gpt-5-mini#16
Bullrich merged 6 commits intomainfrom
copilot/update-openai-library

Conversation

Copy link
Contributor

Copilot AI commented Oct 20, 2025

Update OpenAI library and change default model to gpt-5-mini

  • Update OpenAI library from version 4.80.0 to latest (6.6.0)
  • Change DEFAULT_MODEL in src/story.ts from "gpt-4o" to "gpt-5-mini"
  • Change default chatModel in src/verify.ts from "gpt-4-turbo" to "gpt-5-mini"
  • Change default chatModel in src/chat.ts from "gpt-4-turbo" to "gpt-5-mini"
  • Use omni-moderation-latest for automatic updates
  • Fix temperature handling for gpt-5-mini (model only supports default temperature)
  • Fix TypeScript compatibility issues with OpenAI v6 API changes
  • Add comprehensive JSDoc documentation to all exported methods
  • Update README with detailed API reference and usage examples
  • Run lint and build to verify changes
  • Run security scan (no vulnerabilities found)

Summary

All requested changes have been successfully implemented with fixes for API compatibility and comprehensive documentation:

  1. OpenAI Library Update: Updated from v4.80.0 to v6.6.0 (latest)
  2. Model Changes: Updated all default models to gpt-5-mini
  3. Moderation Model Update: Using omni-moderation-latest to automatically use the latest version without requiring updates
  4. Temperature Fix: gpt-5-mini only supports default temperature (1), so temperature parameter is now conditionally omitted for this model
  5. API Compatibility: Fixed TypeScript type issues introduced by OpenAI v6 API changes
  6. Documentation: Added comprehensive JSDoc comments to all exported classes and methods (Story, ChatAssistant, ImageGenerator, verifyPrompt), and updated README with detailed API reference including parameters, return types, and usage examples

All builds and linters pass successfully.

Fixes #14

Original prompt

This section details on the original issue you should resolve

<issue_title>Update to latest</issue_title>
<issue_description>Update the OpenAI library to latest and ensure that the model used by default is gpt-5-mini.

You will need to update the openai library.

This needs to be changed in:

Also update the omni-moderation-latest in src/verify.ts to omni-moderation.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #14


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Bullrich <8524599+Bullrich@users.noreply.github.com>
Copilot AI changed the title [WIP] Update OpenAI library to latest version Update OpenAI library to v6.6.0 and change default model to gpt-5-mini Oct 20, 2025
Copilot AI requested a review from Bullrich October 20, 2025 22:52
@coderabbitai
Copy link

coderabbitai bot commented Oct 20, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Comment @coderabbitai help to get the list of available commands and usage tips.

@Bullrich
Copy link
Member

@copilot please fix the test. You can try to run them first to see if they even get to work (even if it fails because you are missing an api key).

This are the errors:

Run node e2e-test.mjs
🚀 Starting E2E tests for story-gpt
📝 Test 1: Testing createStory()
Generating story for prompt A short tale about a brave mouse
❌ createStory failed: 400 Unsupported value: 'temperature' does not support 0.44 with this model. Only the default (1) value is supported.
📝 Test 2: Testing Story.generateStory()
Generating story for prompt A tiny story about a cat
❌ Story.generateStory failed: 400 Unsupported value: 'temperature' does not support 0.4 with this model. Only the default (1) value is supported.
📝 Test 3: Testing verifyPrompt() with valid prompt
❌ verifyPrompt (valid) failed: 400 Invalid value for 'model' = omni-moderation. Please check the OpenAI documentation and try again.
📝 Test 4: Testing verifyPrompt() with invalid prompt
❌ verifyPrompt (invalid) failed: 400 Invalid value for 'model' = omni-moderation. Please check the OpenAI documentation and try again.
📝 Test 5: Testing ImageGenerator.generateImage()

Co-authored-by: Bullrich <8524599+Bullrich@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 20, 2025

@copilot please fix the test. You can try to run them first to see if they even get to work (even if it fails because you are missing an api key).

This are the errors:
...

Fixed in commit 0423b1e.

The tests were failing due to two issues:

  1. Temperature: gpt-5-mini only supports the default temperature value (1). Updated ChatAssistant to conditionally omit the temperature parameter when using this model.
  2. Moderation model: omni-moderation is not a valid model name in the OpenAI API. Changed to omni-moderation-2024-09-26 which is the current stable version.

The build now passes successfully.

Copy link
Member

@Bullrich Bullrich left a comment

Choose a reason for hiding this comment

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

@copilot please address my comments and also let me know, have you updated the docs for the values that now are missing if there are any docs? If not, please document the methods that we expose

src/verify.ts Outdated
export async function verifyPrompt(prompt: string, openai: OpenAI, chatModel: string = "gpt-5-mini"): Promise<StoryResult> {
const moderator = await openai.moderations.create({
model: "omni-moderation-latest",
model: "omni-moderation-2024-09-26",
Copy link
Member

Choose a reason for hiding this comment

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

can we please use latest or whatever is available that means something similar? I don't want to use dated versions that end up expiring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to omni-moderation-latest in commit f4ed18e. This will automatically use the latest moderation model without requiring updates when new versions are released.

Co-authored-by: Bullrich <8524599+Bullrich@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 20, 2025

@copilot please address my comments and also let me know, have you updated the docs for the values that now are missing if there are any docs? If not, please document the methods that we expose

Addressed in commit f4ed18e:

  1. Changed moderation model to omni-moderation-latest
  2. Added comprehensive JSDoc documentation to all exported methods in:
    • Story class (constructor, generateStory, generateTitle, generateImage)
    • ChatAssistant class (constructor, chat method)
    • ImageGenerator class (constructor, generateImage, generateImages)
    • verifyPrompt function
  3. Updated README with complete API reference including:
    • All exported functions and classes
    • Parameter descriptions and types
    • Return types
    • Usage examples
    • Important notes about temperature with gpt-5-mini

All JSDoc comments now correctly reference gpt-5-mini as the default model and note that it only supports temperature=1.

Copilot AI requested a review from Bullrich October 20, 2025 23:51
@Bullrich Bullrich marked this pull request as ready for review October 20, 2025 23:54
@Bullrich Bullrich merged commit db440ec into main Oct 20, 2025
10 checks passed
@Bullrich Bullrich deleted the copilot/update-openai-library branch October 20, 2025 23:55
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.

Update to latest

2 participants