Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2025 01:49 PM - edited 06-23-2025 01:53 PM
As per the doc , one can execute an ai_query in python. But I am sot sure why I can't
Works in SQL
select 1 as colA, ai_query('databricks-llama-4-maverick', 'what is 2+2') as testBut not in spark
df = spark.sql("select 1 as colA")
df = df.selectExpr("""
ai_query('databricks-llama-4-maverick', 'what is 2+2') as result
""")
df.show()I am getting
AnalysisException: [UNRESOLVED_ROUTINE] Cannot resolve function `ai_query` on search path [`system`.`builtin`, `system`.`session`, `catalog`.`default`].; line 1 pos 0
I have also converted the ai_query to a sql udf but even then it does not work.
Labels:
- Labels:
-
GenAIGeneration AI
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 05:34 AM
Hello @smpa01,
I tried to reproduce this issue internally and it worked for me as expected in spark as well. I am sharing below screenshot for your reference:
I used DBR 15.4 LTS and serverless it worked on both