cancel
Showing results for 
Search instead for 
Did you mean: 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results for 
Search instead for 
Did you mean: 

AI_QUERY fails with o1-mini

jAAmes_bentley
New Contributor III

As of sometime between March 7th and March 12, the AI_QUERY function has become very temperamental with Azure OpenAI models.

Asking a basic question of our Mosaic AI o1-mini serving endpoint using AI_QUERY causes an error sometimes but not every time:

spark.sql("""
SELECT AI_QUERY(
        'o1-mini', 
        request => 'What is the capital of United Kingdom?',
        failOnError => false,
        modelParameters => named_struct('temperature', 1)
    )
 """).display()

Sometimes we get this:

"[REMOTE_FUNCTION_HTTP_FAILED_ERROR] The remote HTTP request failed with code 400, and error message 'HTTP request failed with status: {\"error_code\":\"BAD_REQUEST\",\"message\":\"{\\\\\"external_model_provider\\\\\":\\\\\"openai\\\\\",\\\\\"external_model_error\\\\\":{\\\\\"error\\\\\":{\\\\\"message\\\\\":\\\\\"Invalid prompt: your prompt was flagged as potentially violating our usage policy. Please try again with a different prompt: https://platform.openai.com/docs/guides/reasoning#advice-on-prompting\\\\\",\\\\\"type\\\\\":\\\\\"invalid_request_error\\\\\",\\\\\"param\\\\\":null,\\\\\"code\\\\\":\\\\\"invalid_prompt\\\\\"}}}\"}' SQLSTATE: 57012"

And other times an output as expected:

result: "The capital of the United Kingdom is **London**."
errorMessage: null

With the error suggesting the resource is not available:

jAAmes_bentley_0-1741797431261.png

We have also noticed a similar issue arise in the same past few days with embedding, but the error is different.

Running an OpenAI embedding model such as:

spark.sql("""
SELECT AI_QUERY(
        'text-embedding-ada-002',
        request => 'What is the capital of United Kingdom?',
        failOnError => false
    )
 """).display()

Now always yields:

[REMOTE_FUNCTION_HTTP_RESULT_UNEXPECTED_ERROR] Failed to evaluate the ai_query SQL function due to inability to process the unexpected remote HTTP response; the error message is 'Missing valid errors field in remote response.'. Check API documentation: https://docs.databricks.com/en/generative-ai/generative-ai.html. Please fix the problem indicated in the error message and retry the query again. SQLSTATE: 57012

 

It is worth noting that both of these models work fine through the machine learning playground.

Has anyone else experience this in the past few days? Might it be related to the March 2025 release of Azure Databricks?
Thanks everyone!

 

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group