Skip to main content

Moss vector database adapter for cognee

Project description

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

Project details


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.1.1.tar.gz (5.9 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.1.1.tar.gz.

File metadata

File hashes

Hashes for cognee_community_vector_adapter_moss-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c196e2d96ac572d3c40c9ee4065383413197acd9238feb478d4fe42702d741e5
MD5 5819a5c130fcbc9963bc2733f0ab1122
BLAKE2b-256 c210e181ea9912fed4e3c1af386e1c3c19d53b320cc1a8f732fa62ef0960dffc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cognee_community_vector_adapter_moss-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a6295adfb70f3b1cb4245b1a5b0e70d7f8ffbfe9e8f9b2533f35f8e301d841ed
MD5 0935462499917dca9240927dc970156b
BLAKE2b-256 c76b2b8b42979b5275a43f3464b50f9709c7d72246b723c7c8f6f42b102c1032

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page