📜AI721

Make NFT's AI personality indexable and verifiable on the blockchain.

Introduction

What is AI721

AI721 introduces a standard that extends the AI capabilities of ERC721. It's used to index and describe the AI personality of an NFT, and verify if a specific AI personality belongs to a particular NFT.

AI721 will not make any break changes on ERC721. It can be merged with ERC721, or deployed as an independent contract and associated with an existing ERC721 contract.

Why we need AI721

LLMs enable everyone to create AI personalities with any prompts. You can create any kinds of characters with different personalities with some tools like character.ai. However, it's centralized, non-transparent, and unable to achieve consensus.

If we want to describe NFT's AI personalities on chain and access it without relying on any centralized 3rd parties, we need to define a standard to implement this process, ensuring that anyone can obtain the same AI personality through the same protocol.

AI721 is the key to make it happen.

How it works

What is AI personality of an NFT?

The AI Personality of an NFT is defined by three core components:

  • Base LLM: A collection-level base language model that can comprehend and generate human language text. It provides basic AI capabilities for your NFT.

  • Trait model: A collection-level function that inputs an NFT's traits and outputs a set of prompts, defining the NFT's independent personality that is only related to its traits, as an initial state.

  • Memory: A shared memory between you and your NFT, manifested as the contexts through conversation with the NFT AI.

    • Public Memory: A predefined memory that anyone can use it as their shared memory with NFT AI.

    • Private Memory: A user-level private memory that can be only read by the NFT owner.

In summary, unique AI personality = Bass LLM + Trait model + Memory.

How to index AI personalities on chain?

AI Metadata Standard

AI721 defines a new kind of JSON metadata to describe an AI personality. The metadata standard includes three important parameters to index the AI personality. This metadata is different from the one for ERC721, and can be stored on-chain or off-chain.

Trait Model Structure

A Trait model is described as a JSON structure.

Memory Structure

A memory is described as a JSON structure.

How to access the AI personality described in AI metadata?

  1. Call aiMetadataURI by tokenId of an AI721 contract, and pull the AI metadata of the NFT.

  2. Retrieve the base LLM by base_llm_uri and run as a service;

  3. Retrieve the trait model by trait_model_uri. Input the traits set of the NFT to the model to obtain a set of prompts, and then integrate these prompts into the base LLM you get in the previous step;

  4. (Optional) Retrieve one of the public memories from the public_memories_uri , and integrate it into the LLM you get in the previous step. This allows you to quickly create a predefined AI personality.

  5. Retrieve the private memory (if any) of the NFT owner from local or hosted storages, and integrate it into the LLM in the previous step.

After these steps, you'll get a unique and exclusive AI personality based on a customized LLM, and can be used as your NFT AI agent.

How to make AI personalities indexable on chain?

Base LLM

  1. Train and fine-tune your base LLM.

  2. Store it in off-chain storages, get the uri of the LLM file.

  3. Set base_llm_uri to the uri in the AI metadata.

Trait model

  1. Design a function that accepts a set of traits as input parameters and generates a corresponding set of prompts.

  2. Stored as a script in decentralized storages, and get the uri of the function file.

  3. Set trait_model_uri to the uri in the AI metadata.

Public Memory

  1. Create a directory in decentralized storages and set the public_memories_uri field to this path.

  2. Upload the public memories you made as different knowledge bases to this directory.

Private Memory

The private memory don't need to be indexed on chain. It can be stored in local or hosted storages like AWS S3, or encrypted and stored in decentralized storages, to protect users' privacy.

URI Format Supported

Implementing token URI of AI metadata

As what you have done for ERC721, you MUST implement tokenURI and return a URI where we can find the metadata.

Best Practice

You can deploy an AI721 contract inherit from ERC721 to issue NFT AI. In this way, you MUST directly add new AIMetadata fields to ERC721 metadata. The application layer will call tokenURI(uint256 _tokenId) to access the metadata of an NFT and its AI personality directly.

Merged Metadata Example

// Merge AIMetadata with ERC721 metadata 
{
  // ERC721 metadata fields
  "description": "Friendly OpenSea Creature that enjoys long swims in the ocean.", 
  "external_url": "https://openseacreatures.io/3", 
  "image": "https://storage.googleapis.com/opensea-prod.appspot.com/puffs/3.png", 
  "name": "Dave Starbelly",
  "attributes": [ 
    {
      "trait_type": "Base", 
      "value": "Starfish"
    }, 
    {
      "trait_type": "Eyes", 
      "value": "Big"
    }, 
    {
      "trait_type": "Mouth", 
      "value": "Surprised"
    }, 
  ],
  // AIMetadata fields
  "base_llm_uri":"api://gpt-4",
  "trait_model_uri":"ipfs://xxx",
  "public_memories_uri":"ipfs://xxx"
}

We recommend the application layer to firstly access AI metadata embedded in ERC721 contract to query AI personalities. If not found, then use AILinker to query.

Example

TBD.

Last updated