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.0.tar.gz (5.6 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.0.tar.gz.

File metadata

File hashes

Hashes for cognee_community_vector_adapter_moss-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae9a079937ea8d904bdf3624c96ef5d374cb5f81a0a6af8405bd06c960a71f3f
MD5 8cfed63ad3773521b0ce8dce5774758a
BLAKE2b-256 dc479896006f6990dcc6a77be8a3f73d30b5720f94679b0d4b0e05f87e5ad2f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cognee_community_vector_adapter_moss-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bbf2a1a5d80378c353f99611a71c471a77d75470ece61103325a01db76f1092
MD5 a2e4a522c7bd9778c8fd7f92c2d7fdd1
BLAKE2b-256 c178aa6a92fa8a3e407c134e2c9456e54469aedad7a4a98043fb5f849efb440e

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