Skip to main content

Elasticsearch provider for NLWeb - third-party vector database provider

Project description

nlweb-elastic-vectordb

Elasticsearch provider for NLWeb.

Overview

This package provides Elasticsearch vector database support for NLWeb, demonstrating how to create third-party provider packages.

Installation

pip install nlweb-core nlweb-elastic-vectordb

For LLM and embedding, you'll also need a model provider:

pip install nlweb-azure-models

Or use the bundle packages:

pip install nlweb-core nlweb-retrieval nlweb-models

Configuration

Create config.yaml:

retrieval:
  provider: elasticsearch
  import_path: nlweb_elastic_vectordb.elasticsearch_client
  class_name: ElasticsearchClient
  api_endpoint_env: ELASTICSEARCH_ENDPOINT
  api_key_env: ELASTICSEARCH_API_KEY
  index_name: my-index

Authentication

Set environment variables:

export ELASTICSEARCH_ENDPOINT=https://your-cluster.elasticsearch.com
export ELASTICSEARCH_API_KEY=your_api_key_here

Usage

import nlweb_core

# Initialize
nlweb_core.init(config_path="./config.yaml")

# Search
from nlweb_core import retriever

results = await retriever.search(
    query="example query",
    site="example.com",
    num_results=10
)

Features

  • Vector similarity search with Elasticsearch
  • KNN search with filtering
  • Configurable index names
  • API key authentication
  • Compatible with NLWeb Protocol v0.5

Creating Your Own Provider Package

Use this package as a template:

  1. Create package structure:

    nlweb-yourprovider/
    ├── pyproject.toml
    ├── README.md
    └── nlweb_yourprovider/
        ├── __init__.py
        └── your_client.py
    
  2. Implement VectorDBClientInterface:

    from nlweb_core.retriever import VectorDBClientInterface
    
    class YourClient(VectorDBClientInterface):
        async def search(self, query, site, num_results, **kwargs):
            # Your implementation
            pass
    
  3. Declare dependencies in pyproject.toml:

    dependencies = [
        "nlweb-core>=0.5.0",
        "your-provider-sdk>=1.0.0",
    ]
    
  4. Publish to PyPI:

    python -m build
    twine upload dist/*
    

License

MIT License - Copyright (c) 2025 Microsoft Corporation

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

nlweb_elastic_vectordb-0.5.5.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

nlweb_elastic_vectordb-0.5.5-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file nlweb_elastic_vectordb-0.5.5.tar.gz.

File metadata

  • Download URL: nlweb_elastic_vectordb-0.5.5.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for nlweb_elastic_vectordb-0.5.5.tar.gz
Algorithm Hash digest
SHA256 7e51fb3d18a4b2ad09aa78cb73ce948737a99b47e5b0eaa05d7ae8ca95f927ab
MD5 b720cd123315326a4d3bf7a8e6771625
BLAKE2b-256 6f4859ff221064fccfe795c65a76dd9694d8e2e728463cbfaa1e00dac9373e3e

See more details on using hashes here.

File details

Details for the file nlweb_elastic_vectordb-0.5.5-py3-none-any.whl.

File metadata

File hashes

Hashes for nlweb_elastic_vectordb-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3f8d6a36b73742b0f96126fc8433e35197685276941efd1cce58f38f32d76184
MD5 f50195dba358d3a6b5078fd8cec3266a
BLAKE2b-256 0be3ead890c7e13075a6741d1d2df9d23f4f8909d67aa7515e00d81964f63799

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