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: 

Genie Agent SDK visualization

haaland
Databricks Partner

The documentation says you can send in an optional enable_visualization boolean when starting a conversation or sending a message to the agent:

start_conversation_and_wait(space_id: str, content: str [, enable_visualization: Optional[bool], timeout: datetime.timedelta = 0:20:00])

create_message_and_wait(space_id: str, conversation_id: str, content: str [, enable_visualization: Optional[bool], timeout: datetime.timedelta = 0:20:00]) 

ref: https://databricks-sdk-py.readthedocs.io/en/stable/workspace/dashboards/genie.html

But I get error message when I try to send in this argument:

Example call: 

response = w.genie.start_conversation_and_wait(
space_id=agent_id,
content="some natural language question",
enable_visualization = True,
timeout=timedelta(minutes=2),
)

Error message:
TypeError: GenieAPI.start_conversation_and_wait() got an unexpected keyword argument 'enable_visualization'

Is the enable_visualization option no longer available?

 

 

4 REPLIES 4

Gecofer
Contributor III

Hi @haaland

The TypeError indicates that the databricks-sdk version loaded by your Python environment does not expose that parameter, even though it appears in the current stable documentation. I would first compare the installed version and runtime signature:

import inspect
import databricks.sdk

print(databricks.sdk.__version__)
print(inspect.signature(w.genie.start_conversation_and_wait))

Then upgrade the SDK and restart the Python process:

%pip install --upgrade databricks-sdk
dbutils.library.restartPython()

If enable_visualization still does not appear in the signature after upgrading, the published documentation may be ahead of the currently released package or the option may not yet be available in that API surface. In that case, please share the installed SDK version so it can be verified against the release notes.

haaland
Databricks Partner

Hi!

The sdk version is 0.141.0.

The signature is
(space_id: 'str', content: 'str', timeout=datetime.timedelta(seconds=1200)) -> 'GenieMessage'

i.e. still missing enable_visualization.

ivanvyd
New Contributor III

@haaland please try restarting the python process and check databricks.sdk.__file__ as well as the version / signature. That should rule out a stale import or another SDK installation being loaded.

I agree with @Gecofer . And if it still resolves to 0.141.0 from the expected path with that old signature, this looks worth raising as an packaging discrepancy.

haaland
Databricks Partner

Hi! 
Not sure what I did to fix it, but now  it accepts the enable_visualization argument. 

Signature now prints out as:

(space_id: 'str', content: 'str', *, enable_visualization: 'Optional[bool]' = None, timeout=datetime.timedelta(seconds=1200)) -> 'GenieMessage'