Skip to main content

Cognee Community Vector Adapter - Moss

Use Moss as the vector database for Cognee.

Moss is a vector search service - indexes are built in the cloud and loaded locally for sub-10ms queries. No infrastructure to manage. Create an account, grab your credentials, and plug them in.

Prerequisites

  1. Create a Moss account at portal.usemoss.dev
  2. Create a project and copy your Project ID and Project Key
  3. An OpenAI API key (Cognee uses it for LLM and embeddings by default)

Installation

pip install cognee-community-vector-adapter-moss

Or install from source:

cd packages/vector/moss
pip install -e .

Configuration

Set environment variables:

export MOSS_PROJECT_ID="your-project-id"
export MOSS_PROJECT_KEY="your-project-key"
export LLM_API_KEY="your-openai-api-key"

Or create a .env file (see .env.example).

Usage

import asyncio
import os
from cognee_community_vector_adapter_moss import register  # noqa: F401
from cognee import add, cognify, config, search


async def main():
    config.set_vector_db_config(
        {
            "vector_db_provider": "moss",
            "vector_db_key": os.getenv("MOSS_PROJECT_KEY"),
            "vector_db_name": os.getenv("MOSS_PROJECT_ID"),
            "vector_dataset_database_handler": "moss",
        }
    )

    await add("Natural language processing is a subfield of computer science.")
    await cognify()

    results = await search(query_text="Tell me about NLP")
    for r in results:
        print(r)


asyncio.run(main())

How It Works

The adapter multiplexes all Cognee collections into a single Moss index (cognee-index-{timestamp}). This keeps usage within Moss's free tier (3 indexes). Each document is tagged with a _collection metadata field, and all searches filter by it.

  • Embeddings are computed by Cognee's embedding engine and passed to Moss via DocumentInfo(embedding=[...])
  • The index is loaded locally via load_index(auto_refresh=True) for fast sub-10ms queries
  • Async Moss jobs (create_index, add_docs) are polled to completion internally

Running Tests

MOSS_PROJECT_ID="..." MOSS_PROJECT_KEY="..." LLM_API_KEY="..." python tests/test_moss.py

Tests cover: vector search (text + vector), nodeset filtering, graph completion, chunks, summaries, and prune cleanup.

Resources

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cognee_community_vector_adapter_moss-0.2.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file cognee_community_vector_adapter_moss-0.2.0.tar.gz.

File metadata

File hashes

Hashes for cognee_community_vector_adapter_moss-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8d31273d8eed6eccb3e2c6cd6c9d350ed0d24331007d40c1b897915dca555dbf
MD5 e593fe65bc9d116984f4a5360bba3af2
BLAKE2b-256 509b888537b6923d76b2dc59638112dd5e8fecc57e2b7bb2c11bff0f43688b66

See more details on using hashes here.

File details

Details for the file cognee_community_vector_adapter_moss-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cognee_community_vector_adapter_moss-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30ee244a2cfd603055f83e6f0aa44f54dd7db86be2452fe55578e7c681782f0c
MD5 3e9aafd4bbc78f8947bb4c4f7de0406f
BLAKE2b-256 5dbd4c4b5a0b3f20fe67a824011c99d4253775d694dcc652dc651ce8d9f06bd1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page