chatbot
Wrapper around LangChain functions, specifying:
-
A two-step chunk lookup process: title search followed by content search
-
Use of HuggingFace to obtain a local embeddings model
-
Use of NVIDIA or Bedrock for a remote LLM (Llama/Claude)
-
Use of Qdrant (server, memory or disk) as a vector store
-
A LangGraph as follows:
And adding:
-
Support for a meta-graph of document relationships to aid retrieval
-
Support for keywords in addition to titles for chunk lookup
Getting started
Configuration
Within a .env.development file (.env for production), specify values for the following, according to the stated constraints:
| Variable | Description | Required | Default |
|---|---|---|---|
| MAX_RETRIES | Number of times to retry the chat API if it is not responsive | Yes | 3 |
| QDRANT_PATH | On-disk or remote location to persist vector store collections | No | - |
| EMBEDDINGS_MODEL_NAME | Model used to vectorise documents in the vector store | Yes | sentence-transformers/all-mpnet-base-v2 |
| LLM_MODEL_NAME | Name of the model. Models starting with <provider>. are assumed to be hosted on Bedrock (AWS). Others are assumed to be hosted by NVIDIA. |
Yes | eu.anthropic.claude-haiku-4-5-20251001-v1:0 (AWS Bedrock) |
| NVIDIA_API_KEY | Key for NVIDIA-hosted models | Yes (if using an NVIDIA model) | - |
| AWS_REGION | Region for Bedrock-hosted models | Yes (if using a Bedrock model) | eu-west-2 |
| LLM__EXPLANATION_OF_TERMS | Optional explanatory text to help the LLM interpret retrieved information (e.g., term definitions, context notes). Injected into the system prompt for retrieval tasks. | No | - |
Recommended models
| Model | Provider | ID |
|---|---|---|
| Llama 3.1 8B instruct (default) | NVIDIA | meta/llama-3.1-8b-instruct |
| Claude 4.5 Haiku | AWS Bedrock | eu.anthropic.claude-haiku-4-5-20251001-v1:0 |
Local installation
Add the following to the pyproject.toml of a consuming project in the monorepo:
[tool.uv.sources]
chatbot = { path = "../path/to/lib", editable = true }
[dependency-groups]
dev = [
"chatbot",
...
]
Usage
from chatbot.knowledge_based import KnowledgeBase
from chatbot.chatbot import Chatbot
KnowledgeBase().load_web_documents(documents, classes)
Chatbot().retrieve_and_generate(message)
Testing
-
Install dependencies
uv sync -
Run tests:
uv run pytest tests
License
This project uses the CC BY-NC-ND 4.0 license (see LICENSE).
Metadata
Release files for londonaicentre-chatbot 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| londonaicentre_chatbot-1.1.0.tar.gz | 30.3 kB | Without provenance | Details for londonaicentre_chatbot-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| londonaicentre_chatbot-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for londonaicentre_chatbot-1.1.0-py3-none-any.whl |
Total release size: 51.8 kB
Release files / londonaicentre_chatbot-1.1.0.tar.gz
| Download URL | londonaicentre_chatbot-1.1.0.tar.gz |
|---|---|
| Size | 30.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30f2cc6d5261074e6614d31169a33cc40612c1b9d360c5bffae802e24006d65b
|
|
BLAKE2b-256 checksum How to use checksums |
6a3fc7cb785e85fe20e89ce24e97e18da5ba726d3fbae16d0475a11b75d00a0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / londonaicentre_chatbot-1.1.0-py3-none-any.whl
| Download URL | londonaicentre_chatbot-1.1.0-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e6e9904345bf9ef10607f1f55f489eae04fa2b1938d3ea34e1ce8eb375befe9
|
|
BLAKE2b-256 checksum How to use checksums |
73a2371849a25c022a7e996f48bd211e6f8594069f8a2c15b891618a8249ec21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for londonaicentre-chatbot 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.