AgentGPT icon indicating copy to clipboard operation
AgentGPT copied to clipboard

how could I use Azure api-key?

Open jaxblack opened this issue 1 year ago • 11 comments

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

image

jaxblack avatar Apr 13 '23 08:04 jaxblack

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.

RepubIique avatar Apr 13 '23 09:04 RepubIique

I also want to use Azure api-key

cypggs avatar Apr 13 '23 09:04 cypggs

(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

cypggs avatar Apr 13 '23 09:04 cypggs

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

awtkns avatar Apr 13 '23 12:04 awtkns

Also need this feature, hope it will be supported soon

yuanman2016 avatar Apr 17 '23 00:04 yuanman2016

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

itsjobangrewal avatar Apr 17 '23 03:04 itsjobangrewal

We'd like this feature as well, please.

karshatmosera avatar Apr 17 '23 22:04 karshatmosera

me too

qianchen94 avatar Apr 19 '23 01:04 qianchen94

me too,please

jebouruama avatar Apr 21 '23 12:04 jebouruama

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

behinder85 avatar Apr 27 '23 15:04 behinder85

me too

ottodeng avatar Apr 28 '23 08:04 ottodeng

me too,please

GGGyanice avatar May 19 '23 08:05 GGGyanice

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?

securigy avatar Jun 06 '23 20:06 securigy

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 avatar Jul 28 '23 16:07 Zizico2

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 :)

awtkns avatar Jul 31 '23 01:07 awtkns

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.

Zizico2 avatar Jul 31 '23 02:07 Zizico2

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?

zenyanbo avatar Oct 22 '23 14:10 zenyanbo

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.

ssugar avatar Oct 27 '23 16:10 ssugar

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

h3nryza avatar Dec 25 '23 15:12 h3nryza