Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2025 10:21 AM - edited 09-30-2025 10:25 AM
@shashankB There are no command like %assistant exists today to interact with Databricks Assistant. As @szymon_dybczak mentioned in the reply the exiting modes that you can interact with Assistant today.
Also there is no published Assistant‑specific REST API in the Databricks today. But you can built your own custom assistant in notebooks using Model Serving / Foundation Models endpoints.
Here are few examples.
1. Using Model Serving:
# Databricks notebook (Python)
from databricks.sdk import WorkspaceClient
# Get OpenAI-compatible client for your workspace serving endpoints
w = WorkspaceClient()
client = w.serving_endpoints.get_open_ai_client()
code_to_review = """[Put your code here]"""
prompt = f"""You are a senior Databricks reviewer.
Identify bugs, performance issues, and style problems in this code.
Return a short bullet list with actionable fixes, and a corrected snippet.
Code:{code_to_review}"""
system_msg = (
"You are a senior Databricks code reviewer. "
"Focus on correctness, Spark/Delta best practices, performance, security/secrets handling, "
"cluster/UC implications, and style. "
"Return Markdown with three sections: "
"1) Findings (bullets), 2) Proposed fixes (bullets), 3) Revised code (single fenced block)."
)
resp = client.chat.completions.create(
model="databricks-meta-llama-3-3-70b-instruct",
messages=[
{"role": "system", "content": system_msg},
{"role": "user", "content": prompt},
],
temperature=0.1,
max_tokens=900,
)
print(resp.choices[0].message.content)2. Use SQL AI functions:
%sql
SELECT ai_query(
"databricks-meta-llama-3-3-70b-instruct",
"Review this PySpark code for correctness and performance. " ||
"Suggest changes if needed:\n\n" ||
:code_text -- pass as SQL variable that holds the code text
) AS review;