Skip to main content

Lite usages of lancedb.

Project description

lnclite

PyPI Python License CI Docs

lnclite is a small async LanceDB document store for OpenAI-compatible embeddings. It gives you a compact API for creating a local vector database, adding documents, filtering by tags, and running semantic search.

Installation

pip install lnclite

For local development from this repository:

poetry install --all-groups

Quick Start

import asyncio

from openai import AsyncOpenAI
from openai_embeddings_model import ModelSettings

from lnclite import DocumentCreate, Lnclite, get_openai_embeddings_model


async def main():
    embeddings = get_openai_embeddings_model(
        openai_client=AsyncOpenAI(),
    )

    client = await Lnclite.new(
        lancedb_path="outputs/demo.lance",
        openai_embeddings_model=embeddings,
        model_settings=ModelSettings(dimensions=1536),
        name="Demo",
        description="Local demo documents",
    )

    await client.documents.batch_create(
        [
            DocumentCreate(
                content="A note about async Python clients.",
                tags=["type:note", "topic:python"],
            ),
            DocumentCreate(
                content="A note about vector search and indexing.",
                tags=["type:note", "topic:search"],
            ),
        ]
    )

    await client.create_index()

    results = await client.search(
        "How should I design vector search?",
        tags_any=["topic:search"],
    )

    for result in results.results:
        print(result.document.content)
        print(result.document.tags)
        print(result.distance)

    # Vectors are hidden in returned documents by default.
    results_with_vectors = await client.search(
        "How should I design vector search?",
        include_vector=True,
    )
    print(len(results_with_vectors.results[0].document.vector))


if __name__ == "__main__":
    asyncio.run(main())

Documentation

Full documentation is published at allen2c.github.io/lnclite.

Useful pages:

Examples

Runnable end-to-end examples live in examples/. They cover basic search, tag filtering, directory ingest, managing multiple stores, and an optional downloaded open-dataset demo.

License

MIT

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

lnclite-0.2.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

lnclite-0.2.1-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file lnclite-0.2.1.tar.gz.

File metadata

  • Download URL: lnclite-0.2.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.0 CPython/3.12.13 Darwin/25.3.0

File hashes

Hashes for lnclite-0.2.1.tar.gz
Algorithm Hash digest
SHA256 146c8a8da197c1af728f5d290c92251dd199de80fc6c1b96dc108da00a795a3f
MD5 bec0ea8cdcb8bd60530ae90e3a4c476b
BLAKE2b-256 e73d82a524b62a390447050f84c6a31345e806f4f0c00a005451d0104ce55cb4

See more details on using hashes here.

File details

Details for the file lnclite-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: lnclite-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.0 CPython/3.12.13 Darwin/25.3.0

File hashes

Hashes for lnclite-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f9324956c31fd22e6316e74c8e5bd6800c96e357f6c03fcd5a6cc78f002ce06
MD5 3dcf5d78027efa401cda22c5174fb76d
BLAKE2b-256 72e3bd7ad2b424360c62c4e5d89b90053ce14f9253beaf62380206b60029288f

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