autogenhub / autogen

A programming framework for agentic AI. Discord: https://discord.gg/pAbnFJrkgZ
https://autogenhub.github.io/autogen/
Apache License 2.0
119 stars 22 forks source link

OpenAI API key format validation #44

Closed marklysze closed 1 month ago

marklysze commented 2 months ago

Why are these changes needed?

OpenAI's API key has changed in format recently and the validation function in OpenAI doesn't accurately validate the format.

OpenAI has not published the format of the key, so information gathered so far is that it can start with: sk- sk-proj- sk-None- sk-svcaat-

This is followed by segments of alphanumeric characters (including underscores) separated by dashes.

As the exact format is not defined, the regular expression in the validation function will be expanded to support keys:

The tests have been updated.

Related issue number

Closes #26

Checks

BlocUnited commented 1 month ago

I tested this PR within my use case, where I run Autogen using uvicorn. The API key validation warning issue was resolved, and everything works as expected now. Thanks for the fix!