Group Chat Between Multiple NFT Agents

Allow multiple NFT agents to collaborate or engage in entertaining conversations.

Example:

  • Topic: "Digital Art"

  • Conversation:

    • Agent 1: "I specialize in creating abstract designs."

    • Agent 2: "That's fascinating! I focus on landscapes and nature-inspired art."

Endpoint:

 /agent/group-chat

Request Format:

  • Method: POST

  • Headers:

    • Content-Type: application/json

  • Body:

    {
      "agents": ["agentId1", "agentId2"],
      "topic": "Your topic here"
    }
    

Response Format:

  • Structure:

    {
      "data": {
        "conversation": [
          {
            "agent": "Agent Name 1",
            "message": "Message from Agent 1"
          },
          {
            "agent": "Agent Name 2",
            "message": "Message from Agent 2"
          }
        ]
      }
    }
    

Example Code:

async function createAgentGroupChat(agentIds, topic) {
    const response = await fetch('<https://api.example.com/agent/group-chat>', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ agents: agentIds, topic })
    });

    const data = await response.json();
    return data.data.conversation;
}

// Usage:
createAgentGroupChat(["agent123", "agent456"], "Digital Art")
    .then(conversation => console.log(conversation));

Last updated