OpenAI Azure OpenAI Service + OpenAI AI Assistant API


I am building some things and want to use my Azure OpenAI AI Assistant model. Microsoft pushed it in the last week.

Using the below, I could interact with the chat completions. Setting the correct headers for the REST request.

uri = “$(Endpoint)/openai/deployments/(DeploymentName)/chat/completions?api-version=($ApiVersion)”

I’m looking for docs/guidance how to do this for the new AI Assistant API on Microsoft Azure.

I’ve tried this uri and setting the key from my Azure instance in the headers request.

uri = “$(Endpoint)/openai/deployments/(DeploymentName)/assistants?api-version=($ApiVersion)”

Pointers to docs/examples on how to construct this would be great.

I have code that can hit the OpenAI REST endpoints no problem. Headers, keys, and correct url construction.

Thank you

Hey Doug,

Azure doesn’t currently offer assistants, they just give you the raw models.

It’s possible that they never will; they have (sorta) competing products (like microsoft copilot studio and azure AI bot services).

All that said, assistants don’t offer anything that langchain wouldn’t :thinking:

Has this become a place where folks like @Diet do their Ad campaigns?

I posted a legitimate question. @Diet you are incorrect, Azure now offers Assistants.

If anyone knows how I can construct the Url to the assistants endpoint in Azure OpenAI that would be great.

I am working from a language other than Python. I was able to get the older text completion full urls spun up to work with the models I deployed.

I’ve tried the below, not sure if it is correct. I’ve setup the headers, if there is an example would love to compare.

uri = “$(Endpoint)/openai/deployments/(DeploymentName)/assistants?api-version=($ApiVersion)”

Thank you

I absolutely stand corrected

Here’s the (currently partially broken) github repo of azure assistant examples: azureai-samples/scenarios/Assistants/assistants-api-in-a-box at main · Azure-Samples/azureai-samples · GitHub

Now I’m not sure what I’m advertising but I don’t really appreciate the insinuation :slight_smile: (unless it’s a compliment, considering self-advertisement would imply that I own microsoft :thinking: )

drama aside:

Anyways, the answer is somewhat stupid: they screwed up the url concatenation for assistants; there’s a double slash //

url = "{your resource}"

headers = {
    "Content-Type": "application/json",
    "api-key": f"{azure_openai_api_key}",
    "OpenAI-Beta": "assistants=v1"

as opposed to completions:

url = "https://{your resource}{your deployment}/chat/completions?api-version=2023-07-01-preview"

In the future, maybe stick to the question posted in the thread, rather than stating something that is wrong and then going on to recommend a tool no one asked about.

The Azure OAI is not partially broken. The retrieval tool is being implemented.
I don’t appreciate your editorializing.

Thanks for the // I will give it a shot.

That was a long way to a simple answer, which is all I was asking for.

Could’ve done without your wrong interpretations, conclusions and and simple recommendations for other tools. Tools I think most of us on this forum already know of and worked with.

I’m so sorry you feel like you’ve had a bad experience. :pensive:

It’s been noted and reported to the developer.


Thank you for the repository, that is helpful! Not sure if there is another thread for my question, if there is please direct me to it. With the OAI Assistant API, I can include a file in a message and then run the assistant on this message to do something with the file. Is this still the case with AOAI Assistants API or do you have to put all the files at the beginning when you create the assistant?

Thanks in advance for the help!