Skip to content

OpenAI - Migrate from Assistant API v1 to v2 #15061

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 5 commits into from
Dec 26, 2024
Merged

OpenAI - Migrate from Assistant API v1 to v2 #15061

merged 5 commits into from
Dec 26, 2024

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Dec 23, 2024

Resolves #15059

Summary by CodeRabbit

Release Notes

  • New Features
    • Updated the model used for image analysis tasks to enhance performance.
  • Version Updates
    • Multiple components and actions have been updated to new version numbers, ensuring users have the latest improvements and features.
    • Notable version increments include:
      • analyze-image-content: 0.1.2 → 0.1.3
      • cancel-run: 0.0.11 → 0.0.12
      • chat-with-assistant: 0.0.7 → 0.0.8
      • create-image: 0.1.18 → 0.1.19
      • package.json: 0.7.1 → 0.7.2
      • And many others across various components and actions.

Copy link

vercel bot commented Dec 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Dec 23, 2024 6:44pm
pipedream-docs ⬜️ Ignored (Inspect) Dec 23, 2024 6:44pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Dec 23, 2024 6:44pm

Copy link
Contributor

coderabbitai bot commented Dec 23, 2024

Warning

Rate limit exceeded

@michelle0927 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 33 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 0ba9587 and 8d651e0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • components/openai/package.json (2 hunks)

Walkthrough

This pull request involves a comprehensive update to the OpenAI component across multiple files. The primary changes include version number increments for various actions and modules, an update to the OpenAI API beta headers from "v1" to "v2", and a modification in the parseToolsArray function to replace "retrieval" with "file_search". The package dependency on @pipedream/platform has also been updated from version ^1.2.1 to ^3.0.3.

Changes

File Change Summary
components/openai/actions/*/ Version numbers incremented across multiple action modules (e.g., analyze-image-content, chat, create-image)
components/openai/common/helpers.mjs Replaced "retrieval" with "file_search" in tool types
components/openai/openai.app.mjs Updated _betaHeaders default version from "v1" to "v2"
components/openai/package.json Version updated to 0.7.2, platform dependency updated to ^3.0.3

Assessment against linked issues

Objective Addressed Explanation
Deprecation of v1 Assistants API [#15059] Updated beta headers to "v2" resolves the deprecation warning

Possibly related PRs

Suggested labels

ai-assisted

Suggested reviewers

  • jcortes

Poem

🐰 Hopping through code with glee,
OpenAI's updates, version 2 and 3!
From retrieval to file search we leap,
Assistants API, no longer asleep!
A rabbit's journey of API delight! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
components/openai/actions/analyze-image-content/analyze-image-content.mjs (1)

11-11: Increment version in documentation.
The version has been raised to "0.1.3". Ensure that associated documentation and release notes reflect this version change for accurate tracking.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecc849a and 0ba9587.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (44)
  • components/openai/actions/analyze-image-content/analyze-image-content.mjs (1 hunks)
  • components/openai/actions/cancel-run/cancel-run.mjs (1 hunks)
  • components/openai/actions/chat-with-assistant/chat-with-assistant.mjs (1 hunks)
  • components/openai/actions/chat/chat.mjs (1 hunks)
  • components/openai/actions/classify-items-into-categories/classify-items-into-categories.mjs (1 hunks)
  • components/openai/actions/convert-text-to-speech/convert-text-to-speech.mjs (1 hunks)
  • components/openai/actions/create-assistant/create-assistant.mjs (1 hunks)
  • components/openai/actions/create-batch/create-batch.mjs (1 hunks)
  • components/openai/actions/create-embeddings/create-embeddings.mjs (1 hunks)
  • components/openai/actions/create-fine-tuning-job/create-fine-tuning-job.mjs (1 hunks)
  • components/openai/actions/create-image/create-image.mjs (1 hunks)
  • components/openai/actions/create-moderation/create-moderation.mjs (1 hunks)
  • components/openai/actions/create-thread/create-thread.mjs (1 hunks)
  • components/openai/actions/create-transcription/create-transcription.mjs (1 hunks)
  • components/openai/actions/create-vector-store-file/create-vector-store-file.mjs (1 hunks)
  • components/openai/actions/create-vector-store/create-vector-store.mjs (1 hunks)
  • components/openai/actions/delete-file/delete-file.mjs (1 hunks)
  • components/openai/actions/delete-vector-store-file/delete-vector-store-file.mjs (1 hunks)
  • components/openai/actions/delete-vector-store/delete-vector-store.mjs (1 hunks)
  • components/openai/actions/list-files/list-files.mjs (1 hunks)
  • components/openai/actions/list-messages/list-messages.mjs (1 hunks)
  • components/openai/actions/list-run-steps/list-run-steps.mjs (1 hunks)
  • components/openai/actions/list-runs/list-runs.mjs (1 hunks)
  • components/openai/actions/list-vector-store-files/list-vector-store-files.mjs (1 hunks)
  • components/openai/actions/list-vector-stores/list-vector-stores.mjs (1 hunks)
  • components/openai/actions/modify-assistant/modify-assistant.mjs (1 hunks)
  • components/openai/actions/retrieve-file-content/retrieve-file-content.mjs (1 hunks)
  • components/openai/actions/retrieve-file/retrieve-file.mjs (1 hunks)
  • components/openai/actions/retrieve-run-step/retrieve-run-step.mjs (1 hunks)
  • components/openai/actions/retrieve-run/retrieve-run.mjs (1 hunks)
  • components/openai/actions/retrieve-vector-store-file/retrieve-vector-store-file.mjs (1 hunks)
  • components/openai/actions/retrieve-vector-store/retrieve-vector-store.mjs (1 hunks)
  • components/openai/actions/send-prompt/send-prompt.mjs (1 hunks)
  • components/openai/actions/submit-tool-outputs-to-run/submit-tool-outputs-to-run.mjs (1 hunks)
  • components/openai/actions/summarize/summarize.mjs (1 hunks)
  • components/openai/actions/translate-text/translate-text.mjs (1 hunks)
  • components/openai/actions/upload-file/upload-file.mjs (1 hunks)
  • components/openai/common/helpers.mjs (1 hunks)
  • components/openai/openai.app.mjs (1 hunks)
  • components/openai/package.json (2 hunks)
  • components/openai/sources/new-batch-completed/new-batch-completed.mjs (1 hunks)
  • components/openai/sources/new-file-created/new-file-created.mjs (1 hunks)
  • components/openai/sources/new-fine-tuning-job-created/new-fine-tuning-job-created.mjs (1 hunks)
  • components/openai/sources/new-run-state-changed/new-run-state-changed.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (40)
  • components/openai/actions/chat/chat.mjs
  • components/openai/actions/chat-with-assistant/chat-with-assistant.mjs
  • components/openai/actions/create-batch/create-batch.mjs
  • components/openai/actions/retrieve-run/retrieve-run.mjs
  • components/openai/actions/retrieve-file/retrieve-file.mjs
  • components/openai/actions/upload-file/upload-file.mjs
  • components/openai/actions/create-moderation/create-moderation.mjs
  • components/openai/actions/delete-file/delete-file.mjs
  • components/openai/actions/retrieve-vector-store/retrieve-vector-store.mjs
  • components/openai/actions/list-files/list-files.mjs
  • components/openai/actions/create-embeddings/create-embeddings.mjs
  • components/openai/actions/delete-vector-store/delete-vector-store.mjs
  • components/openai/actions/create-thread/create-thread.mjs
  • components/openai/actions/create-assistant/create-assistant.mjs
  • components/openai/actions/translate-text/translate-text.mjs
  • components/openai/actions/list-run-steps/list-run-steps.mjs
  • components/openai/actions/cancel-run/cancel-run.mjs
  • components/openai/actions/retrieve-run-step/retrieve-run-step.mjs
  • components/openai/actions/retrieve-file-content/retrieve-file-content.mjs
  • components/openai/actions/modify-assistant/modify-assistant.mjs
  • components/openai/actions/convert-text-to-speech/convert-text-to-speech.mjs
  • components/openai/actions/create-transcription/create-transcription.mjs
  • components/openai/actions/classify-items-into-categories/classify-items-into-categories.mjs
  • components/openai/actions/list-messages/list-messages.mjs
  • components/openai/sources/new-file-created/new-file-created.mjs
  • components/openai/actions/create-fine-tuning-job/create-fine-tuning-job.mjs
  • components/openai/actions/submit-tool-outputs-to-run/submit-tool-outputs-to-run.mjs
  • components/openai/sources/new-run-state-changed/new-run-state-changed.mjs
  • components/openai/sources/new-fine-tuning-job-created/new-fine-tuning-job-created.mjs
  • components/openai/actions/list-runs/list-runs.mjs
  • components/openai/actions/list-vector-stores/list-vector-stores.mjs
  • components/openai/actions/create-vector-store/create-vector-store.mjs
  • components/openai/actions/list-vector-store-files/list-vector-store-files.mjs
  • components/openai/actions/create-image/create-image.mjs
  • components/openai/actions/summarize/summarize.mjs
  • components/openai/actions/create-vector-store-file/create-vector-store-file.mjs
  • components/openai/actions/delete-vector-store-file/delete-vector-store-file.mjs
  • components/openai/actions/send-prompt/send-prompt.mjs
  • components/openai/actions/retrieve-vector-store-file/retrieve-vector-store-file.mjs
  • components/openai/sources/new-batch-completed/new-batch-completed.mjs
🔇 Additional comments (3)
components/openai/package.json (1)

18-18: Verify compatibility with platform v3.x.x

The major version jump in @pipedream/platform dependency (1.x.x → 3.x.x) might introduce breaking changes. Please ensure all platform API usage has been updated accordingly.

✅ Verification successful

Let's examine the actual platform API usage to verify compatibility.


Let's check the specific imports and platform API methods being used to ensure we have a complete picture.


Based on the results from our verification scripts, we can now provide a final assessment:

Platform v3.x.x compatibility appears safe

The codebase only uses basic platform features (db.get/set) which are stable across major versions. The usage is limited to simple key-value operations in source components, which are part of the core functionality maintained across platform versions.

  • Found db operations in source components:
    • new-run-state-changed.mjs
    • new-batch-completed.mjs
    • common/common.mjs

No complex platform API patterns or deprecated methods were detected that could be affected by breaking changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for platform API usage patterns that might need updates

# Look for platform API imports and usage
echo "Searching for platform API usage patterns:"
rg -l "@pipedream/platform" components/openai/

Length of output: 648


Script:

#!/bin/bash
# Check imports and usage of platform APIs in the files
echo "=== Platform API Usage Analysis ==="

# Search for specific platform imports and their usage
rg -A 2 "from '@pipedream/platform'" components/openai/

# Search for common platform API patterns
echo -e "\n=== Common Platform API Patterns ==="
rg "this\.(http|db|store)" components/openai/

Length of output: 931


Script:

#!/bin/bash
# Search for all platform imports
echo "=== Platform Imports ==="
rg "import.*from '@pipedream/platform'" components/openai/

# Search for specific platform API method usage
echo -e "\n=== Platform API Method Usage ==="
rg "app\.(http|db|store)" components/openai/

Length of output: 255

components/openai/common/helpers.mjs (1)

7-7: Confirm consistent usage of "file_search" across the codebase.
Renaming "retrieval" to "file_search" appears straightforward. Verify if any references or documentation still refer to "retrieval."

Run the following script to identify any lingering references to "retrieval" within the repository:

✅ Verification successful

Let me search for any remaining references to "file_search" to ensure consistency.


The term "file_search" is consistently used across the codebase

The search results show that "file_search" is used consistently in the OpenAI component files, specifically in:

  • components/openai/common/helpers.mjs
  • components/openai/actions/common/common-assistants.mjs
  • components/openai/common/constants.mjs

There are no lingering references to "retrieval" in relation to this functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
rg "retrieval" -A 3 -B 3

Length of output: 61799


Script:

#!/bin/bash
# Search for "file_search" references
rg "file_search" -A 3 -B 3

Length of output: 2053

components/openai/openai.app.mjs (1)

319-319: Migrate gracefully to API beta version "v2".
Switching from "v1" to "v2" ensures functionality aligns with the newer API. Confirm all downstream services handle the new response format or additional fields returned by version "v2."

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] OpenAI - Chat with Assistant failed
2 participants