This article explains how you can use Unity Catalog with OpenAI to build faster and safer AI workflows.
If you’re building AI applications with OpenAI, you’ve probably noticed how tricky it can be to keep track of all your data, models, and functions. They’re often spread across different storage locations, with different rules for access and security.
Unity Catalog gives you one place to manage all of your data and AI assets. You can access, update, and delete assets from a single location and easily control who has access. With Unity Catalog, OpenAI models can securely call your custom functions and access trusted data, without lots of manual code rewrites. You can build smarter, more reliable AI agents that are easier to maintain and scale.
Let’s take a look at how this works.

Why should I use OpenAI with Unity Catalog?
Using Unity Catalog with OpenAI gives you:
- Central Access: All your data, models, and AI functions are in one place. OpenAI can access everything it needs without moving or duplicating data. Users don’t need to remember complex paths.
- Secure Access Control: Unity Catalog guarantees that only authorized users and systems can access your data and AI functions. You set the rules once, and they apply everywhere.
- Cross-Platform Flexibility: Define your AI tools once and use them across other platforms like LangChain, LlamaIndex, and many more. This is great for benchmarking performance or building multi-platform pipelines.
How to use OpenAI with Unity Catalog
Let’s demonstrate how you can use OpenAI with Unity Catalog with a hands-on coding example. Take a look at this Jupyter Notebook on Github to run the code yourself.
Here’s what we’ll do:
- Define a Python function and register it to Unity Catalog
- Retrieve the function from Unity Catalog
- Use the function in an OpenAI application

Install Unity Catalog AI and OpenAI
To get started using OpenAI with Unity Catalog you will need to:
- Have Python 3.10+ installed on your machine
- Clone the Unity Catalog repository (Java 17+ required)
- Install the
unitycatalog-ai
library - Install OpenAI and the Unity Catalog OpenAI extension
Follow the Unity Catalog Quickstart to clone the repository. Then launch a local Unity Catalog server using:
In a separate Python session, install the necessary Python libraries from PyPi:
Make sure to set your OpenAI API Key as an environment variable so you can access the OpenAI API:
Then set the following variables to complete configuration. Make sure to create the CATALOG
and SCHEMA
before running this code. See the Unity Catalog documentation for instructions.
Define a Function
Let’s define our function. We will build an AI agent that is able to answer complex physics questions about the impact of interstellar objects striking Earth.
First we will build the Python function to define the equation. Our function will:
- Take the object’s mass, velocity and composition as input
- Match the composition with a dictionary of energy transmission coefficients
- Calculate the amount of energy upon impact with Earth
This is the function:
There are some important criteria to keep in mind when defining your function:
- All arguments and the return of the function should be properly typed.
- The docstring should follow Google-style guidelines and include descriptions for the function, each argument, and the return of the function. These are required for proper interpretation of the function and output by the LLM.
- Import statements for any packages not in the core Python library should be defined within the function body.
Register Function to Unity Catalog
Great work. Now let’s add this function to Unity Catalog, specifying the catalog and schema it should be stored in:
Now you’re all set to use this function in OpenAI. You can confirm that the function has been logged to Unity Catalog by running the following CLI command in a terminal:
Create a Toolkit
Next, we need to create a Unity Catalog Toolkit that stores our function. The Toolkit becomes especially helpful when you’re calling multiple functions from a single Agent. For now we’ll just use the one function we’ve defined above. Run the code below in a Python shell or Jupyter notebook.
You can extract the tools from the toolkit to confirm everything is in order:
Use Function in OpenAI Application
Now you can call the function from any OpenAI application.
Start by importing the OpenAI library into your Python session:
Then define your initial system prompt and ask your question:
We then construct our OpenAI application using the chat
module and supply the Unity Catalog toolkit with our predefined functions using the tools
keyword:
You can print the response in your Python shell:
This message contains the response but is not yet human-readable.
We’ll use a Unity Catalog utilities tool to post-process the response into a readable result:
Now let’s take a look at the message contents:
Excellent work! Your OpenAI application has successfully leveraged a function stored in Unity Catalog to give the user the correct answer.
Using OpenAI Functions on Other Platforms
Unity Catalog lets you easily use functions across multiple AI platforms. This saves a lot of time and manual rewrites when you’re comparing performance between GenAI tools. It also makes it simpler to transport work over to another platform because of compliance or other factors.
For example, you can also use function stored with Unity Catalog AI in:
- LangChain
- LlamaIndex
- Anthropic
- LiteLLM
- CrewAI
- AutoGen
- Gemini
Take a look at the official documentation for a complete list of supported platforms.
Better AI Workflows with Unity Catalog and OpenAI
Using Unity Catalog with OpenAI helps you keep all your AI tools, models, and data in one place. You get built-in access control, so your work stays secure. The integration also works across different GenAI platforms, so you don’t need to start from scratch when switching tools. You can store and call functions from OpenAI in just a few steps and without the need for time-consuming code rewrites. This makes it easier to test ideas, compare models, and grow your project without extra work.