Skip to content

Add UCVolumeTool for reading files from UC Volumes#323

Closed
jennsun wants to merge 4 commits intomainfrom
ucvolumetool
Closed

Add UCVolumeTool for reading files from UC Volumes#323
jennsun wants to merge 4 commits intomainfrom
ucvolumetool

Conversation

@jennsun
Copy link
Copy Markdown
Contributor

@jennsun jennsun commented Feb 11, 2026

support reading file from volume given volume name/path

mirroring what we currently do with vector search retriever tool: https://docs.databricks.com/aws/en/generative-ai/agent-framework/unstructured-retrieval-tools

See this notebook testing this uc volume tool and creating agent that can call tool reading from uc volumes: https://eng-ml-agent-platform.staging.cloud.databricks.com/editor/notebooks/3245073120416479?o=2850744067564480

example code snippet
langchain

from databricks_langchain import UCVolumeTool, ChatDatabricks

# Initialize the UC Volume tool.
vol_tool = UCVolumeTool(
    volume_name="catalog.schema.my_volume",
    tool_name="volume_reader",
    tool_description="Reads files from the project documents volume."
)

# Read a file from the volume locally for testing
vol_tool.invoke("reports/q4_summary.txt")

# Bind the volume tool to your LangChain LLM of choice
llm = ChatDatabricks(endpoint="databricks-claude-sonnet-4-5")
llm_with_tools = llm.bind_tools([vol_tool])

# Chat with your LLM to test the tool calling functionality
llm_with_tools.invoke("Read reports/q4_summary.txt and summarize it.")

openai:

import json
from databricks_openai import UCVolumeTool

# Initialize the UC Volume tool.
vol_tool = UCVolumeTool(
    volume_name="catalog.schema.my_volume",
    tool_name="volume_reader",
    tool_description="Reads files from the project documents volume."
)

# Read a file from the volume locally for testing
vol_tool.execute(file_path="reports/q4_summary.txt")

# Pass the tool to the OpenAI SDK
from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Read reports/q4_summary.txt and summarize it."}],
    tools=[vol_tool.tool],
)

@jennsun jennsun changed the title uc volume tool Add UCVolumeTool SDK for reading files from UC Volumes Mar 17, 2026
@jennsun jennsun changed the title Add UCVolumeTool SDK for reading files from UC Volumes Add UCVolumeTool for reading files from UC Volumes Mar 17, 2026
jennsun added 2 commits March 16, 2026 17:30
…e resource because it's not a resource type for mlflow
workspace_client: Optional[WorkspaceClient] = Field(
None,
description="Optional pre-configured WorkspaceClient for authentication.",
)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: unlike the vector search retriever tool which is a mlflow resource type

uc volumes are not and hence we will not add resource field here: https://www.mlflow.org/docs/latest/api_reference/_modules/mlflow/models/resources.html

@jennsun jennsun marked this pull request as ready for review March 17, 2026 00:38
@jennsun jennsun requested a review from bbqiu March 18, 2026 05:22
@jennsun
Copy link
Copy Markdown
Contributor Author

jennsun commented Mar 18, 2026

After some discussion we decided the best path forward here would be to add code snippet examples to read from UCVolume in our unstructured data docs instead of creating a separate local UCVolumeTool - we may want to move towards suggesting KA for uc volume search/retrieval in the long run. Created a separate emu pr to update docs with examples

@jennsun jennsun closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant