Skip to content

Bot helping use Odyssey Creator by communicating with OpenAI GPT

Notifications You must be signed in to change notification settings

momentum-xyz/bot-creator-openai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Odyssey Creator OpenAI/GPT Assistant

This project utilizes Odyssey Momentum.xyz Bot SDK to create a bot that can be used to make changes in an Odyssey using natural language with OpenAI assistance.

Sample commands:

  • add a new sphere above the teapot
  • align all cubes in a single row with gap 5 between them
  • remove all spheres
  • rotate the teapot with 90 degrees horizontally

The commands are sent to GPT-4 model along with the list of objects in the world and actions supported by the bot. The model returns the JSON the list of actions to be performed.

It's possible to use the bot from the Web UI Client or from the command line.

Prerequisites

Nodejs

You need to have Node.js version 18 or 20 (or higher) installed on your machine.

Github npm package repository

For now the SDK packages are only hosted on Github npm package repository. To use this you need to authenticate. Read the Github documentation, create PAT and:

npm login --scope=@momentum-xyz --auth-type=legacy --registry=https://npm.pkg.github.com

Installation

Clone the project with git or download the latest version archive and unzip it. You can rename the default bot-creator-openai-develop to a different name.

In the console enter the project directory and install the dependencies:

cd bot-creator-openai-develop

npm install

Configuration

In order to make changes in Odyssey you want to connect as User (not guest).

You will also need to provide OpenAI API key. You can get it from OpenAI platform.

It can be done either on the client side or on the server side.

NOTE: The Bot needs a different user account from the one used in the Odyssey UI-client (or at least simultaneously). It's because only one connection for given user is allowed at the same time.

So, one way to accomplish this is:

  • Create a new Metamask account
  • Sign out of Odyssey and sign in again using the new account - switch to the new account in Metamask and make sure to Connect it to current site
  • Copy the address of the new account
  • Sign-out and switch back to your main account
  • In the Odyssey UI-client enable the Creator Mode, press Co-Creators and add the new account as a collaborator

Now you can use the new account to connect the Bot to your Odyssey.

Client side

It's possible to sign in using Metamask wallet in the UI. Once you open the the UI in the browser, you will be asked to sign in.

The UI will also ask for OpenAI API key if it's not configured on server.

Server side

It's also possible to configure everything on the server side.

In order to connect as User you need to provide the private key of the user account - you can retrive the account private key in MetaMask then set it as environment variable:

export BOT_SDK_PRIVATE_KEY=...

The OpenAI key can also be set as environment variable:

export OPENAI_API_KEY=...

Running

Run the bot:

npm start

Run the web:

npm run web

Open the web UI in the browser: http://localhost:4242

About

Bot helping use Odyssey Creator by communicating with OpenAI GPT

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published