AzureOpenAIEmbedder throws "BadRequestError: Unsupported data type"

Hi Team,
I’m trying to use the ‘AzureOpenAIEmbedder’ from the ‘phi’ library to generate embeddings, but I encounter the following error:

openai.BadRequestError: Unsupported data type

Here’s the code snippet I’m using:
from phi.embedder.azure_openai import AzureOpenAIEmbedder

embeddings = AzureOpenAIEmbedder().get_embedding(“The quick brown fox jumps over the lazy dog.”)

print(f"Embeddings: {embeddings[:5]}“)
print(f"Dimensions: {len(embeddings)}”)

I’ve set up Azure OpenAI services correctly and ensured my API key and endpoint are configured. The input to ‘get_embedding’ is a simple string, so I’m not sure what’s causing this issue.

Hi @arushi
Thank you for reaching out and using Phidata! I’ve tagged the relevant engineers to assist you with your query. We aim to respond within 48 hours.
If this is urgent, please feel free to let us know, and we’ll do our best to prioritize it.
Thanks for your patience!

Hi Monali,
Thank you for your response. Yes, this is urgent. Could you please help prioritize it and assist as soon as possible? I’d really appreciate it.
Thanks!

Hi @arushi
Azure OpenAI has a very bad interface and error handling. It is very sensitive to the region you are deployed in and the URL you provide.

  1. Which region and which model do you have deployed?
  2. What is your AZURE_OPENAI_ENDPOINT variable set to?

It could make progress by tweaking this URL

Ok I could confirm it definitely works if I have a perfect deployment and the URL is right.

I think the issue comes with using the embedder and the model being used together. We are making changes to improve that developer experience. It will be released soon.

@arushi this might be because of the URL you have set at AZURE_OPENAI_ENDPOINT. Can you retry with a new URL?

@Dirk @manthanguptaa Thank you for your input and support! The issue has been resolved. I need to add a new URL to the embedding functionality.