jacob-ai-bot / jacob

Just Another Coding Bot
https://jacb.ai
Apache License 2.0
131 stars 20 forks source link

JACoB PR for Issue Update OpenAI Request Handling to Use Portkey SDK #329

Closed jacob-ai-bot[bot] closed 1 week ago

jacob-ai-bot[bot] commented 2 weeks ago

Summary:

Description

We need to update the OpenAI request handling to use the Portkey SDK directly instead of the current OpenAI approach. This change is intended to improve our integration and potentially enhance performance by leveraging the Portkey SDK's capabilities.

The file to be updated is /src/server/openai/request.ts, which currently manages OpenAI API requests, handling token costs, context windows, and model-specific parameters for various AI models.

Expected Outcome

The OpenAI request handling in /src/server/openai/request.ts should be refactored to use the Portkey SDK directly. The updated implementation should replicate the existing functionality while utilizing the Portkey SDK to handle API requests. @jacob-ai-bot --skip-build

Plan:

Step 1: Edit /package.json

Task: Add Portkey SDK to project dependencies

Instructions: Add the Portkey SDK as a dependency in package.json under the dependencies section. Refer to the Portkey SDK documentation to determine the correct package name and version to include.

Exit Criteria: The Portkey SDK is listed as a dependency in package.json, and can be installed without errors.

Step 2: Edit /src/server/openai/request.ts

Task: Refactor OpenAI request handling to use Portkey SDK

Instructions: In the file /src/server/openai/request.ts, replace all instances of the OpenAI SDK usage with the Portkey SDK. Update the initialization code to use the Portkey SDK's client initialization methods. Adjust the API request calls to use the Portkey SDK's methods and parameters. Ensure all existing functionalities are preserved, including handling token costs, context windows, and model-specific parameters. Remove any OpenAI-specific configurations and headers that are no longer needed.

Exit Criteria: The OpenAI request handling in /src/server/openai/request.ts uses the Portkey SDK directly instead of the OpenAI SDK, with all existing functionality preserved and operational.

jacob-ai-bot[bot] commented 2 weeks ago

Hello human! 👋

This PR was created by JACoB to address the issue Update OpenAI Request Handling to Use Portkey SDK

Next Steps

  1. Please review the PR carefully. Auto-generated code can and will contain subtle bugs and mistakes.

  2. If you identify code that needs to be changed, please reject the PR with a specific reason. Be as detailed as possible in your comments. JACoB will take these comments, make changes to the code and push up changes. Please note that this process will take a few minutes.

  3. Once the code looks good, approve the PR and merge the code.