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

Revamp Python SDK: Wrapper #89

Closed
csgulati09 opened this issue Feb 23, 2024 · 1 comment · Fixed by #90
Closed

Revamp Python SDK: Wrapper #89

csgulati09 opened this issue Feb 23, 2024 · 1 comment · Fixed by #90
Assignees

Comments

@csgulati09
Copy link
Collaborator

Building our SDK in a way that it is a wrapper around OpenAI SDK.

Instead of calling our Gateway, making a call to OpenAI SDK with all the needed changes

Copy link

dosubot bot commented Feb 23, 2024

🤖

Based on the information you've provided, it seems like you want to replace the current calls to your Gateway with calls to the OpenAI SDK. Here's a general approach on how you can proceed:

  1. Identify the OpenAI SDK methods you need: First, you need to identify which methods from the OpenAI SDK you need to use to replace the calls to your Gateway. The OpenAI SDK has a comprehensive list of methods for different tasks, so you should be able to find the ones that match your needs.

  2. Modify the post methods: The post methods in the Portkey and AsyncPortkey classes are the ones making the calls to your Gateway. You need to modify these methods to call the OpenAI SDK methods instead.

Here's a simplified example of how you might modify the post method in the Portkey class:

from openai import OpenAI

class Portkey:
    def __init__(self, api_key):
        self.openai = OpenAI(api_key)

    def post(self, url: str, **kwargs):
        # Replace this with the appropriate OpenAI SDK method
        return self.openai.method_name(**kwargs)

And similarly for the AsyncPortkey class:

from openai import AsyncOpenAI

class AsyncPortkey:
    def __init__(self, api_key):
        self.openai = AsyncOpenAI(api_key)

    async def post(self, url: str, **kwargs):
        # Replace this with the appropriate OpenAI SDK method
        return await self.openai.method_name(**kwargs)

Please replace method_name with the actual method from the OpenAI SDK that you want to use.

  1. Test your changes: After you've made these changes, make sure to thoroughly test your SDK to ensure that it's still working as expected. This should include both unit tests and integration tests to make sure that the SDK is correctly interacting with the OpenAI API.

Remember, this is a high-level approach and the actual implementation might differ based on your specific needs and the structure of your SDK. If you need more specific guidance, please provide more details about your current implementation and the specific functionality you want to achieve with the OpenAI SDK.

For more information about the OpenAI SDK, you can refer to the OpenAI API documentation.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@csgulati09 csgulati09 changed the title Revamp SDK: Wrapper Revamp Python SDK: Wrapper Feb 23, 2024
@csgulati09 csgulati09 self-assigned this Feb 23, 2024
@csgulati09 csgulati09 mentioned this issue Feb 24, 2024
@VisargD VisargD linked a pull request Mar 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant