Skip to content

OpenAIChatTarget is not compatible with new Azure OpenAI endpoints #1173

@pamelafox

Description

@pamelafox

The new GA version of Azure OpenAI does not use deployments in the URL (its just /openai/v1), and the latest version of official OpenAI() constructor accepts a callable for the api_key. Azure OpenAI also no longer has an API version.

Could OpenAIChatTarget be adjusted to work with the new Azure OpenAI endpoints?

I was hoping I could do this:

credential = azure.identity.DefaultAzureCredential()
token_provider = azure.identity.get_bearer_token_provider(
credential, "https://cognitiveservices.azure.com/.default"
)
attack_llm = OpenAIChatTarget(model_name=os.environ["AZURE_AI_CHAT_DEPLOYMENT"],
endpoint=os.environ["AZURE_AI_ENDPOINT"] + "openai/v1/",
api_key=token_provider)

I don't want to use the entra auth parameter as I want more control over the credential ideally (sometimes I use other credential classes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions