Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add additional checks for openai stream requires action #936

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

utkarsh-dixit
Copy link
Collaborator

@utkarsh-dixit utkarsh-dixit commented Dec 2, 2024

Important

Add checks for valid run statuses in openai.ts and introduce filterByAvailableApps property with validation in actions.ts.

  • Behavior:
    • Add checks in waitAndHandleAssistantStreamToolCalls() and waitAndHandleAssistantToolCalls() in openai.ts to submit tool outputs only if run status is queued, in_progress, or requires_action.
  • Code Style:
    • Fix spacing in if conditions for runId checks in waitAndHandleAssistantStreamToolCalls() and waitAndHandleAssistantToolCalls().
  • Models:
    • Add filterByAvailableApps boolean property to AdvancedUseCaseSearchQueryDTO in schemas.gen.ts and types.gen.ts.
    • Add validation in findActionEnumsByUseCase() in actions.ts to ensure filterByAvailableApps and apps are not both provided.

This description was created by Ellipsis for 1a8c915. It will automatically update as commits are pushed.

Copy link

vercel bot commented Dec 2, 2024

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

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 2, 2024 9:23am

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 38317cc in 11 seconds

More details
  • Looked at 59 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. js/src/frameworks/openai.ts:171
  • Draft comment:
    The check for run status before submitting tool outputs is redundant here since it's already checked in the while loop condition. Consider removing it to avoid unnecessary checks.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The check for run status before submitting tool outputs is repeated unnecessarily.
2. js/src/frameworks/openai.ts:145
  • Draft comment:
    The check for run status before submitting tool outputs is redundant here since it's already checked in the while loop condition. Consider removing it to avoid unnecessary checks.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The check for run status before submitting tool outputs is repeated unnecessarily.

Workflow ID: wflow_DwerCMGd59ZR2D0E


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 56b8836 in 26 seconds

More details
  • Looked at 23 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_t2P1uCKokdBErPoT


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

js/src/frameworks/openai.ts Outdated Show resolved Hide resolved
@shreysingla11
Copy link
Collaborator

Code Review Summary

Overall Assessment: ✅ Approved

The changes improve the robustness of the OpenAI integration by adding important validation checks for stream states. The code quality is good with proper error handling and state validation.

Strengths:

  • Adds important validation for run states before submitting tool outputs
  • Improves handling of race conditions in streaming responses
  • Maintains consistent code formatting
  • Follows existing patterns in the codebase

Suggestions for Enhancement:

  1. Extract repeated state array into a constant at class level
  2. Add error logging for invalid run states
  3. Consider adding TypeScript type definitions for run status

The code is well-structured and the changes make the system more reliable. Good to merge after considering the minor suggestions.

Copy link

github-actions bot commented Dec 2, 2024

This comment was generated by github-actions[bot]!

JS SDK Coverage Report

📊 Coverage report for JS SDK can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/coverage-12116294270/coverage/index.html

📁 Test report folder can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/html-report-12116294270/html-report/report.html

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on cc7cf36 in 16 seconds

More details
  • Looked at 37 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. js/src/frameworks/openai.ts:145
  • Draft comment:
    The check for valid run statuses should include 'queued' and 'in_progress' as mentioned in the PR description. Consider updating the condition to:
                if (["queued", "in_progress", "requires_action"].includes(currentRun.status)) {
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.
2. js/src/frameworks/openai.ts:173
  • Draft comment:
    The check for valid run statuses should include 'queued' and 'in_progress' as mentioned in the PR description. Consider updating the condition to:
                if (["queued", "in_progress", "requires_action"].includes(runInfo.status)) {
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_GK2WavtpYfneHj4l


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 1a8c915 in 26 seconds

More details
  • Looked at 55 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/src/sdk/models/actions.ts:250
  • Draft comment:
    Ensure error messages are consistent. Consider using the same message as in line 192 for clarity.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The error message in line 250 is slightly different from the one in line 192. Consistency in error messages is important for clarity and maintainability.

Workflow ID: wflow_kMAfxihYDSmY9yC1


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

});
// Check if the run is still in a state that accepts tool outputs
const currentRun = await client.beta.threads.runs.retrieve(thread.id, runId);
if (currentRun.status === "requires_action") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Chore: (Not important)Can we use constants for things like this? Easy to maintain and scope of error is also reduced

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.

3 participants