Skip to content

OpenAI Assistant Integration

AarickZook edited this page Feb 4, 2025 · 5 revisions

Introduction

  • This is information on how to integrate OpenAI with Unity.
  • PSU has provided Azure OpenAI resources for use with this project, but there is a required process to access the Azure resources. It's not the same as with a traditional OpenAI API key.
  • The branch published to the GitHub, openai-assistant-integration, adds a scene for an assistant interaction.
  • All that the game developers need to do is add a button in the game that loads the assistant scene.

Adding assistant integration into a Unity project

  • Attached to this page is a compressed file OpenAI-Integration-Resources. Download and extract all, then copy the files from the /Assets folder into the correct directories in the Unity project.
    • Copy over .dll files from and to /Assets/Plugins/.
    • Copy prefabs and their meta files to /Assets/Prefabs/.
    • Copy over Assistant_Interface.unity and meta file to /Assets/Scenes/.
    • Copy over /Scripts/OpenAI Integration/ to Assets/_Scripts/.
    • If you don't copy over the meta files, the relationships between prefabs, scene, and scripts won't work properly.
  • The only other thing that needs to be set up is the credentials for the Azure project. Create a folder in C:\Users\[username]\ called .openai.
  • Into the new folder .openai, add the auth.json file (also found in the compressed folder). Open the file in a text editor and fill in the arguments from your Azure project (currently empty strings).

OpenAI Integration Resources

OpenAI-Integration-Resources.zip

Clone this wiki locally