OthersideAI / self-operating-computer

A framework to enable multimodal models to operate a computer.
https://www.hyperwriteai.com/self-operating-computer
MIT License
8.21k stars 1.09k forks source link

[FEATURE] Azure open AI support #179

Open sashankh opened 3 months ago

sashankh commented 3 months ago

Is your feature request related to a problem? Please describe.

Does this work with Azure Open AI today? We can add that support.

Describe the solution you'd like

Works with Azure Open AI

Describe alternatives you've considered

Additional context

faddy19 commented 3 months ago

The code to add support for Azure OpenAI to the Self-Operating Computer framework would depend on the specific implementation of the Azure OpenAI API. However, here is a general outline of the steps that would be involved:

Create a new model class: This class would be responsible for interacting with the Azure OpenAI API. It would need to have methods for sending requests and receiving responses.

Update the code that interacts with the API: The existing code that interacts with the OpenAI API would need to be updated to use the new model class. This would likely involve changes to the get_next_action() function and the operate() function. Test your changes: Once you have made the changes, you would need to test them to ensure that they work as expected. Here is a possible implementation of the new model class:

class AzureOpenAIModel: def init(self, api_key): self.api_key = api_key

def send_request(self, prompt):
    # Code to send a request to the Azure OpenAI API
    pass

def receive_response(self):
    # Code to receive a response from the Azure OpenAI API
    pass

Once you have created the new model class, you would need to update the get_next_action() function to use it. For example:

async def get_next_action(model, messages, objective, session_id): if model == "azure-openai":

Create an instance of the AzureOpenAIModel class

    azure_openai_model = AzureOpenAIModel(api_key="YOUR_API_KEY")

    # Send a request to the Azure OpenAI API
    response = azure_openai_model.send_request(prompt="YOUR_PROMPT")

    # Receive a response from the Azure OpenAI API
    content = azure_openai_model.receive_response()

    # Process the response and return the next action
    return content, None
faddy19 commented 3 months ago

This should solve the problem