reworkd / AgentGPT

🤖 Assemble, configure, and deploy autonomous AI Agents in your browser.
https://agentgpt.reworkd.ai
GNU General Public License v3.0
31.83k stars 9.25k forks source link

✨ Enable the use of an Azure api-key #77

Closed jaxblack closed 1 year ago

jaxblack commented 1 year ago

Azure api-key is different from openai api-key. And it should be used.

image

RepubIique commented 1 year ago

If I am not wrong from reading this https://msandbu.org/openai-vs-azure-openai/

Azure OpenAI API key is a specific type of API key that allows you to access OpenAI's GPT-3 language model through the Azure Cognitive Services. This means that you can use the Azure portal to create and manage your Azure OpenAI API key, and you will be billed by Microsoft Azure for any usage of the API.

On the other hand, the OpenAI API key is a general API key that allows you to access all of the OpenAI APIs, including GPT-3, through the OpenAI API platform. This means that you can create and manage your OpenAI API key through the OpenAI website, and you will be billed directly by OpenAI for any usage of the API.

In summary, the main difference between the two API keys is the platform they are associated with and the billing method used for their usage. Azure OpenAI API key is associated with Azure Cognitive Services and is billed by Microsoft Azure, while OpenAI API key is associated with the OpenAI platform and is billed by OpenAI.

cypggs commented 1 year ago

I also want to use Azure api-key

cypggs commented 1 year ago

(auto-gpt) ➜ Auto-GPT git:(master) ✗ grep -nFR USE_AZURE * README.md:102:- If you want to use GPT on an Azure instance, set USE_AZURE to True and provide the OPENAI_AZURE_API_BASE, OPENAI_AZURE_API_VERSION and OPENAI_AZURE_DEPLOYMENT_ID values as explained here: https://pypi.org/project/openai/ in the Microsoft Azure Endpoints section. Additionally you need separate deployments for both embeddings and chat. Add their ID values to OPENAI_AZURE_CHAT_DEPLOYMENT_ID and OPENAI_AZURE_EMBEDDINGS_DEPLOYMENT_ID respectively scripts/config.py:47: self.use_azure = os.getenv("USE_AZURE") == 'True' Binary file scripts/pycache/config.cpython-38.pyc matches

awtkns commented 1 year ago

Hi all this is definitely a something we want to support. I can support by helping to review any prs for this 😊

yuanman2016 commented 1 year ago

Also need this feature, hope it will be supported soon

itsjobangrewal commented 1 year ago

Hi all this is definitely a something we want to support. I can support by helping to review any prs for this 😊

me too pls, waiting for next release

karshatmosera commented 1 year ago

We'd like this feature as well, please.

qianchen94 commented 1 year ago

me too

jebouruama commented 1 year ago

me too,please

behinder85 commented 1 year ago

How is it going so far? I am already very excited about it

ottodeng commented 1 year ago

me too

GGGyanice commented 1 year ago

me too,please

securigy commented 1 year ago

I am digging into Azure Semantic Kernel and its examples... and most of them reference the following:

Env.Var("AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME"), Env.Var("AZURE_OPENAI_EMBEDDINGS_ENDPOINT"), Env.Var("AZURE_OPENAI_EMBEDDINGS_KEY"))

I had not idea that Embeddings require separate set of Name/Endpoint/Key... How do I get them?

Zizico2 commented 1 year ago

I have this working internally, at my current employer, with hardcoded api_keys and model_names, deployment_ids, etc.. We're just testing it out. We broke OpenAI to get Azure OpenAI working as easily as possible. Plus we still don't have access to 3.5-16k so summaries are broken.

I might, eventually, tidy it up and submit a PR. But it is not even close to a priority currently :/. I'm more than happy to provide any help if someone is implementing this and gets stuck.

awtkns commented 1 year ago

hey this was fixed in #1165

In settings.py you can now enable azure

    # Azure OpenAI
    azure_openai_api_version: str = "2023-06-01-preview"
    azure_openai_api_key: str = ""
    azure_openai_api_base: str = ""
    azure_openai_deployment_name: str = ""

Note that agentgpt uses function calling which is not supported by azure as of yet so it will fall back to openai in some cases :)

Zizico2 commented 1 year ago

Note that agentgpt uses function calling which is not supported by azure as of yet so it will fall back to openai in some cases :)

I did manage to get it working, including functions. Versions 0613 support functions (source).

I think Microsoft is rolling them out slowly. What I didn't manage to get working properly were the summaries because I don't have access to the 16k model. Idk if there's any solution there.

zenyanbo commented 1 year ago

hey this was fixed in #1165

In settings.py you can now enable azure

    # Azure OpenAI
    azure_openai_api_version: str = "2023-06-01-preview"
    azure_openai_api_key: str = ""
    azure_openai_api_base: str = ""
    azure_openai_deployment_name: str = ""

Note that agentgpt uses function calling which is not supported by azure as of yet so it will fall back to openai in some cases :)

hellow, even though I added those options as well.

    azure_openai_api_version: str = "2023-06-01-preview"
    azure_openai_api_key: str = "<my key>"
    azure_openai_api_base: str = "https://<my domain>.openai.azure.com/"
    azure_openai_deployment_name: str = "gpt4"

However, it always says: Authentication error: Ensure a valid API key is being used. The next interface also only has the gpt3.5 gpt-3.5-16k gpt-4 option in the settings. It seems agentgpt is still using the openai api. What should I do?

ssugar commented 1 year ago

I have this working internally, at my current employer, with hardcoded api_keys and model_names, deployment_ids, etc.. We're just testing it out. We broke OpenAI to get Azure OpenAI working as easily as possible. Plus we still don't have access to 3.5-16k so summaries are broken.

I might, eventually, tidy it up and submit a PR. But it is not even close to a priority currently :/. I'm more than happy to provide any help if someone is implementing this and gets stuck.

@Zizico2 How did you get this working? I've been trying to set the env variables in /next/.env and also tried changing settings via /platform/reworkd_platform/settings.py, but haven't had any luck.

h3nryza commented 10 months ago

I have this working internally, at my current employer, with hardcoded api_keys and model_names, deployment_ids, etc.. We're just testing it out. We broke OpenAI to get Azure OpenAI working as easily as possible. Plus we still don't have access to 3.5-16k so summaries are broken. I might, eventually, tidy it up and submit a PR. But it is not even close to a priority currently :/. I'm more than happy to provide any help if someone is implementing this and gets stuck.

@Zizico2 How did you get this working? I've been trying to set the env variables in /next/.env and also tried changing settings via /platform/reworkd_platform/settings.py, but haven't had any luck.

I see that they deprecated the functions calling and added it under the tools API: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling?tabs=python.

@awtkns maybe something to add to a new or existing feature?

image