microsoft / TaskWeaver

A code-first agent framework for seamlessly planning and executing data analytics tasks.
https://microsoft.github.io/TaskWeaver/
MIT License
5.37k stars 690 forks source link

Transitioning from OpenAI API Keys to Azure Managed Identity (MSI) – Issues with Taskweaver Expecting API Keys in Multiple Processes #408

Closed bsavocad closed 1 month ago

bsavocad commented 2 months ago

Hello,

I'm currently in the process of transitioning my application from using OpenAI API keys to Azure Managed Service Identity (MSI) for enhanced security and credential management. However, I'm encountering several issues with Taskweaver, mainly because it expects an API key in multiple processes.

Issues Encountered:

Questions:

What I've Tried So Far:

Additional Information:

Request:

Any assistance or guidance on how to overcome these issues would be greatly appreciated. If MSI integration isn't currently supported, are there any workarounds or plans to support this in the future?

Thank you for your help!

Jack-Q commented 2 months ago

We support using Entra authentication when using Azure OpenAI on Azure services. Maybe you can check the related instructions in this doc to configure access Azure OpenAI with managed identity.

bsavocad commented 2 months ago

unfortunately, i have not been able to solve this problem even though i followed the documentation to the letter. i keep getting errors like _ValueError: Config value llm.azure_ad.aad_client_secret_ is not found, when variables like these shouldn't be hardcoded but should auto-execute with DefaultAzureCredential by defining my managed_identity_client_id and my default_credential for my token_provider. have you heard of similar issues? it's quite frustrating!

Jack-Q commented 2 months ago

Please be sure the use the latest version of code from the repo. If the error still occurs, could you share your configuration and the detailed error message here?

bsavocad commented 1 month ago

The solution we found involves creating a function to generate the token and including it in the OpenAI.py file. This way, we are able to execute the token generation remotely without needing the presence of an API key. If you have any questions, feel free to reach out to us.