usdchat is a conversational bot that lets you interact with USD Stage using natural language. Powered by OpenAI large language models, this AI assistant can answer you basic USD queries as well as a plugin to your favorite USD authoring toolsets. π
β¨ Watch these YouTube videos to see π€ usdchat in Action! β¨
Actually, a lot π€£ It's a fun and experimental project and not meant to be taken seriously, yet.
This is a work in progress, and we're just getting started. But here's what it can do right now:
Imagine having a chat with GPT models that actually get OpenUSD and computer graphics. Ever been stuck wondering, "What's the deal with namespaces in USD?" π€·ββοΈ Wonder no more!
Take it up a notch with our plugin designed to live inside your go-to USD authoring tools, starting with usdview.
Not just a pretty chat interface! The usdview_chat
plugin also runs Python code generated by GPT in a separate thread. You get to see the results right in the chat window, decked out in green!
Let's face it, even GPT isn't perfect. Our inbuilt error handling kicks in, sending the hiccup back to the GPT model for a smarter response. This is low-key genius for generating more reliable USD code. π§
Any failed Python code execution is flagged and displayed in red π¨, because we believe in second chances.
After MAX_ATTEMPTS
, it'll tap out and show the error message.
Your chat history isn't just stored; it's used for context in future conversations. It's like your chatbot learns from you! π€
One of the exciting extensions in usdchat is its integration with ChromaDB for handling vector embeddings of USD stage files. This feature enriches the understanding of the scene by our large language models.
Vector embeddings are a way to convert textual or other forms of data into vectors of real numbers which can then be processed efficiently. This method is fundamental in various Natural Language Processing tasks. In the realm of usdchat, vector embeddings grant a deeper insight into the composition of the USD stage, allowing the large language models to fathom the scene from the inside out. For a deeper dive into vector embeddings, check out this explanation.
ChromaDB is an open-source vector database that facilitates the storage and management of vector embeddings. It's not only loved by the community but also utilized in notable projects like Microsoft's Autogen. Have a peek at ChromaDB to delve into its capabilities.
usdchat employs ChromaDB to locally store the vector embeddings of USD stage files. The process initiates by resolving the USD stage to uncover all dependencies. It then converts any binary files to ASCII, compressing the long lines of text in our usdGeoms. These processed files are now ripe for embedding into the vector database.
This approach to embeddings in usdchat is off the beaten path. By creating, querying, deleting, updating, and resetting the ChromaDB collections, managing different embeddings becomes a breeze. This is especially pivotal in the new Retrieval Augmented Generation (RAG) mode where collections are at the heart of managing various embeddings. Check out more on ChromaDB collections.
With the help of ChromaDB, usdchat now has a firmer grasp of the scene's structure and content. The Python code runner agent, coupled with the vector embeddings, forms a more rounded understanding, analyzing the scene from both outside and inside.
git clone https://github.com/siva-nagendra/usdchat
pip install -r requirements.txt
python main.py
usdview
. Check how to get it here.export PYTHONPATH=$PYTHONPATH:/path/to/usdchat:/path/to/usdchat/plugins
export PXR_PLUGINPATH_NAME=$PXR_PLUGINPATH_NAME:/path/to/usdchat/plugins/usdview_chat
export OPENAI_API_KEY=<your openai api key>
usdview
and watch π€ usdchat
come to life. πtiktoken
(The token counter π)The journey doesn't stop here. The goal is to continue refining, testing, and expanding the capabilities of usdchat, with vector embeddings and ChromaDB being a significant stride in that direction.
Got code? Send in a Pull Request! Let's make this even more awesome together. π€π€
MIT License, because we like to share. Check out the LICENSE for deets.
Crafted with β€οΈ by Siva. Slide into my DMs anytime! π©