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:
-
Create package structure:
nlweb-yourprovider/ ├── pyproject.toml ├── README.md └── nlweb_yourprovider/ ├── __init__.py └── your_client.py -
Implement VectorDBClientInterface:
from nlweb_core.retriever import VectorDBClientInterface class YourClient(VectorDBClientInterface): async def search(self, query, site, num_results, **kwargs): # Your implementation pass
-
Declare dependencies in
pyproject.toml:dependencies = [ "nlweb-core>=0.5.0", "your-provider-sdk>=1.0.0", ]
-
Publish to PyPI:
python -m build twine upload dist/*
License
MIT License - Copyright (c) 2025 Microsoft Corporation
Metadata
Release files for nlweb-elastic-vectordb 0.5.42
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nlweb_elastic_vectordb-0.5.42.tar.gz | 12.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nlweb_elastic_vectordb-0.5.42-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.2 kB
Release files / nlweb_elastic_vectordb-0.5.42.tar.gz
| Download URL | nlweb_elastic_vectordb-0.5.42.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2636ad54a947d2a047c569b9105488d4f1dd0c0864529be5374c606b5296c0b
|
|
BLAKE2b-256 checksum How to use checksums |
682c1f4513db0bac0bfad5f062693e81034915727b2a52502bcef2668c86e240
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / nlweb_elastic_vectordb-0.5.42-py3-none-any.whl
| Download URL | nlweb_elastic_vectordb-0.5.42-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23238ad4628af6f8bc5c6bc9a2f77cd9d31554e5ba10d05a815028f53a2c9aab
|
|
BLAKE2b-256 checksum How to use checksums |
ed2281c6e90cd32255f022878fbed0a3062fafec8601e4956daf9d5072d94ecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|