https://promptfoo.dev/ logo
Using AzureOpenAI
# ❓|questions
l
Any easy way to replace the evaluator and the generator with AzureOpenAI instead of GPT-4o (the default)?
Copy code
from openai import AzureOpenAI
from azure.identity import EnvironmentCredential

def get_access_token():
    credential = EnvironmentCredential()
    access_token = credential.get_token("https://cognitiveservices.azure.com/.default")
    return access_token.token

client = AzureOpenAI(
    api_key=get_access_token(),
    api_version="<my api version>",
    azure_endpoint="<my endpoint>",
    )
I can use the code above to ping it, but not sure how to trancribe it for promptfoo. Also able to have it for DSPy using LiteLLM if that can be of any help. Thanks!
i
you should be able to override this using the
defaultTest
directive here: https://www.promptfoo.dev/docs/providers/azure/#model-graded-tests along with the
redteam.provider
directive here: https://www.promptfoo.dev/docs/providers/azure/#model-graded-tests
lmk if you have any questions - happy to work with you on the configuration