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.0.tar.gz (15.8 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.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lnclite-0.2.0.tar.gz
  • Upload date:
  • Size: 15.8 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.0.tar.gz
Algorithm Hash digest
SHA256 3ebb279fd77dc717a51b0274b2fbaf2fda691d0ee1d6c0cebe88d4b11360294d
MD5 9aea81e1d029389312d0b3664ac9abbd
BLAKE2b-256 b83855c03b6016a42928bdc4a06b3fab901a699ba2f4cd220a7e41d912bc354f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lnclite-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 917a1528b89e43b2b1846feb89199f1f9c2676fcb4cfe0f646073bdc6eeb2e20
MD5 b217e9b2d2c95de3ae1e4c639a3ba4a9
BLAKE2b-256 8270106ca5eeafcefa813334d12dc19d08ea8312d8ba6c102ca4bee85fe4f137

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