Skip to content

Commit 87b8efd

Browse files
committed
cleanup
1 parent 43849c2 commit 87b8efd

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

src/databricks_ai_bridge/genie.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,14 @@ def __init__(
182182
self.genie = workspace_client.genie
183183
self.description = self.genie.get_space(space_id).description
184184

185-
# Initialize MCP client for communication with Genie backend
186185
server_url = f"{workspace_client.config.host}/api/2.0/mcp/genie/{space_id}"
187186
self._mcp_client = DatabricksMCPClient(server_url, workspace_client)
188187
self._tool_name = f"query_space_{space_id}"
189188

190-
# Keep headers for deprecated REST methods (backwards compatibility)
191189
self.headers = {
192190
"Accept": "application/json",
193191
"Content-Type": "application/json",
194192
}
195-
196193
self.truncate_results = truncate_results
197194
self.return_pandas = return_pandas
198195

@@ -224,11 +221,11 @@ def create_message(self, conversation_id, content):
224221
225222
.. deprecated::
226223
This method is deprecated and will be removed in a future release.
227-
Use :meth:`ask_question` with a conversation_id parameter instead.
224+
Use :meth:`ask_question` instead, which uses MCP protocol.
228225
"""
229226
warnings.warn(
230227
"create_message() is deprecated and will be removed in a future release. "
231-
"Use ask_question(question, conversation_id=...) instead.",
228+
"Use ask_question(question, conversation_id=...) instead, which uses MCP protocol.",
232229
DeprecationWarning,
233230
stacklevel=2,
234231
)
@@ -246,11 +243,11 @@ def poll_for_result(self, conversation_id, message_id):
246243
247244
.. deprecated::
248245
This method is deprecated and will be removed in a future release.
249-
Use :meth:`ask_question` instead, which handles polling automatically via MCP.
246+
Use :meth:`ask_question` instead, which uses MCP protocol.
250247
"""
251248
warnings.warn(
252249
"poll_for_result() is deprecated and will be removed in a future release. "
253-
"Use ask_question() instead, which handles polling automatically.",
250+
"Use ask_question() instead, which uses MCP protocol.",
254251
DeprecationWarning,
255252
stacklevel=2,
256253
)
@@ -405,7 +402,6 @@ def ask_question(self, question, conversation_id: Optional[str] = None):
405402
GenieResponse with result, query, description, and conversation_id
406403
"""
407404
try:
408-
# Try using the new MCP approach
409405
args = {"query": question}
410406
if conversation_id:
411407
args["conversation_id"] = conversation_id
@@ -449,13 +445,9 @@ def ask_question(self, question, conversation_id: Optional[str] = None):
449445
)
450446
else:
451447
result = content
452-
query_str = ""
453-
description = ""
454448

455449
except (json.JSONDecodeError, KeyError, TypeError, AttributeError):
456450
result = content
457-
query_str = ""
458-
description = ""
459451

460452
return GenieResponse(
461453
result=result,
@@ -472,7 +464,6 @@ def ask_question(self, question, conversation_id: Optional[str] = None):
472464
resp = self.start_conversation(question)
473465
else:
474466
resp = self.create_message(conversation_id, question)
475-
476467
genie_response = self.poll_for_result(resp["conversation_id"], resp["message_id"])
477468
if not genie_response.conversation_id:
478469
genie_response.conversation_id = resp["conversation_id"]

0 commit comments

Comments
 (0)