unbody

repository·main·Indexed 19 days ago

https://github.com/unbody-io/unbody

An open-source project designed as the 'Supabase of the AI era', now archived and evolved into the Adapt framework. Unbody provides tools for indexing data sources, managing projects via a CLI and Admin client, and performing vectorization, reranking, and GraphQL queries. It utilizes a stack including Docker, Weaviate, Temporal, and Nix for development.

Tokens
19.8K
Snippets
79
Records
88
Agent score
68%

What's inside unbody

  1. Monitor Indexing Progress via Temporal

    main
    You can monitor the status of your files being indexed by accessing the Temporal dashboard at http://localhost:8233/. Note that the dashboard requires manual refreshing to display the latest state.
  2. Run Unbody in development mode

    main

    To start developing, you need to run both the required infrastructure services and the application server.

    1. Start infrastructure services (e.g., databases, caches) using Docker Compose:
    docker compose up
    1. Start the development server using Yarn:
    yarn start:dev
    docker compose up
    yarn start:dev
  3. Install Unbody via Git and Yarn

    main

    To install the Unbody repository, clone it from GitHub and use yarn to install dependencies. Note that npm is not recommended as it may not install dependencies correctly.

    git clone https://github.com/unbody-io/unbody
    cd unbody
    yarn
  4. Configure Unbody Environment Variables

    main

    Set up your local environment by copying the example environment file to .env.local and configuring your required keys (such as your OpenAI API key).

    cp .env.example .env.local
    # Edit .env.local with your credentials
  5. Set up the Unbody development environment

    main

    Follow these steps to clone the repository and initialize your local development environment using Nix and Yarn.

    1. Clone the repository

    git clone https://github.com/unbody-io/opensource.git
    cd unbody

    2. Enable Nix flakes

    If you are using the Determinate Nix Installer, flakes are enabled by default. Otherwise, follow the NixOS Wiki Flakes guide.

    3. Enter the development shell

    Run the following command to enter a shell pre-configured with Node.js 22 (LTS), Yarn, and local node_modules/.bin in your PATH:

    nix develop

    4. Install dependencies

    Once inside the Nix shell, install the project dependencies:

    yarn install
    git clone https://github.com/unbody-io/opensource.git
    cd unbody
    nix develop
    yarn install
  6. Manage data source state with ProviderContextSourceData

    main

    When implementing a provider, you can define the structure of your source data using ProviderContextSourceData. This type encapsulates the identity and state of the data source within the plugin context.

    It consists of:

    • id: A unique identifier for the source.
    • state: The current internal state of the source (e.g., last sync timestamp, cursor).
    • entrypoint: The specific configuration or subset of data being targeted.
    • credentials: The authentication data required to access the source.
    export type ProviderContextSourceData<\n  E extends Record<string, any> = Record<string, any>, // Entrypoint\n  C extends Record<string, any> = Record<string, any>, // Credentials\n  S extends Record<string, any> = Record<string, any>, // State\n> = {\n  id: string\n  state: S\n  entrypoint: E\n  credentials: C\n}
  7. Configure img2vec-neural service

    main

    The img2vec-neural service uses the semitechnologies/img2vec-pytorch:resnet50 image. It can be configured via environment variables, such as disabling CUDA support.

    img2vec-neural:
      image: semitechnologies/img2vec-pytorch:resnet50
      environment:
        ENABLE_CUDA: '0'
  8. Configure Unbody plugins

    main

    The unbody.config.json file allows you to define a list of plugins to be used by the Unbody engine. Each plugin is defined as an object within the plugins array. While the current schema shown is minimal, this is where you would specify plugin configurations to extend Unbody's capabilities.

    {
      "plugins": [{}]
    }
  9. Configure Weaviate environment variables

    main

    When using the Weaviate service via Docker Compose, you can configure its behavior using several environment variables. Key settings include module enablement, authentication, and persistence paths.

    Note that ENABLE_MODULES is used to activate specific Unbody-related modules like generative-unbody, reranker-custom, and multi2vec-custom.

    weaviate:
      environment:
        - QUERY_DEFAULTS_LIMIT=25
        - AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true
        - PERSISTENCE_DATA_PATH=/var/lib/weaviate
        - CLUSTER_HOSTNAME=node1
        - ENABLE_MODULES=text2vec-huggingface,generative-unbody,img2vec-custom,reranker-custom,multi2vec-custom
        - CLUSTER_GOSSIP_BIND_PORT=7100