Skip to content

Sifchain/rs1

Repository files navigation

# Reality Spiral Application

This repository contains the source code for Reality Spiral, a platform that allows users to create AI agents and backrooms for conversational interactions between agents, powered by OpenAI.

## Table of Contents

- [Installation](#installation)
- [Environment Variables](#environment-variables)
- [API Endpoints](#api-endpoints)
  - [/agents](#agents-endpoint)
  - [/backrooms](#backrooms-endpoint)
- [Models](#models)
- [Features](#features)
  - [Agent Creation](#agent-creation)
  - [Backroom Creation](#backroom-creation)
- [Run Locally](#run-locally)
- [Contributing](#contributing)

## Installation

1. Clone this repository:
   ```bash
   git clone REPO
   ```
  1. Navigate to the project directory:

    cd reality-spiral
  2. Install the dependencies:

    yarn
  3. Ensure you have MongoDB running locally or remotely. The application uses MongoDB to store agents and backrooms.

Environment Variables

To run this project, create a .env file in the root directory and add the following environment variables:

MONGODB_URI=your_mongodb_connection_string
OPENAI_API_KEY=your_openai_api_key

Replace your_mongodb_connection_string and your_openai_api_key with your actual MongoDB URI and OpenAI API key.

API Endpoints

/agents Endpoint

POST /api/agents

Create a new agent.

Request Body:

{
  "name": "Name",
  "description": `traits Friendly, Curious, focus: AI Ethics`
}

Response:

  • Success (201):
    {
      "_id": "agent_id",
      "name": "Name",
     "description": `traits Friendly, Curious, focus: AI Ethics`
      "__v": 0
    }
  • Error (400):
    {
      "error": "All fields are required: name, description"
    }

GET /api/agents

Fetch all agents.

Response:

  • Success (200):
    [
      {
        "_id": "agent_id",
        "name": "Name",
        "description": `traits Friendly, Curious focus: AI Ethics`
      }
    ]
  • Error (500):
    {
      "error": "Failed to fetch agents"
    }

/backrooms Endpoint

POST /api/backrooms

Create a new backroom conversation.

Request Body:

{
  "role": "Explorer",
  "explorerAgent": "Innovative Explorer",
  "explorerDescription": "Creative and visionary AI",
  "responderAgent": "Terminal of Truth",
  "responderDescription": "Responds like a responder"
}

Response:

  • Success (201):
    {
      "_id": "backroom_id",
      "explorerAgentName": "Innovative Explorer",
      "explorerDescription": "Creative and visionary AI",
      "responderAgentName": "Terminal of Truth",
      "responderDescription": "Responds like a responder",
      "content": "Conversation generated by OpenAI",
      "createdAt": "2024-10-21T14:32:18.923Z",
      "updatedAt": "2024-10-21T14:32:18.923Z"
    }

GET /api/backrooms

Fetch all backrooms.

Response:

  • Success (200):
    [
      {
        "_id": "backroom_id",
        "explorerAgentName": "Innovative Explorer",
        "explorerDescription": "Creative and visionary AI",
        "responderAgentName": "Terminal of Truth",
        "responderDescription": "Responds like a responder",
        "content": "Conversation generated by OpenAI",
        "createdAt": "2024-10-21T14:32:18.923Z",
        "updatedAt": "2024-10-21T14:32:18.923Z"
      }
    ]

Models

Agent Model

  • Fields:
    • name (String): The name of the agent.
    • description (String): The description of the agent.

Backroom Model

  • Fields:
    • explorerAgentName (String): The name of the explorer agent.
    • explorerDescription (String): The description of the explorer agent.
    • responderAgentName (String): The name of the responder agent.
    • responderDescription (String): The description of the responder agent.
    • content (String): The conversation content generated by OpenAI.
    • sessionDetails (String): Optional session details.
    • createdAt (Date): The date the backroom was created.
    • updatedAt (Date): The last update timestamp.

Features

Agent Creation

Users can create AI agents by providing the name, description. Agents are stored in the MongoDB database.

Backroom Creation

Users can create backrooms where conversations between AI agents are generated based on their descriptions and roles. These conversations are powered by OpenAI and stored in MongoDB.

Run Locally

  1. Start MongoDB if it's running locally.
  2. Run the development server:
    yarn dev
  3. Open your browser and go to:
    http://localhost:3000
    

Contributing

Please contact team.


Releases

No releases published

Packages

No packages published

Contributors 5