Generated from aind-library-template
Project description
Usage
Installation
Install a virtual environment with python 3.11 (install a python 3.11 that's compatible with your operating system). Check if download was successful by runninng
py -3.11 -m venv .venv
On Windows, activate the environment with
.venv\Scripts\Activate.ps1
Install the chatbot package.
pip install -e .
To develop the code, run
pip install -e .[dev]
Or simply,
pip install metadata-chatbot
High Level Overview
The project's main goal is to developing a chat bot that is able to ingest, analyze and query metadata. Metadata is accumulated in lieu with experiments and consists of information about the data description, subject, equipment and session. To maintain reproducibility standards, it is important for metadata to be documented well.
Model Overview
The current chat bot model uses Anthropic's Claude Sonnet 3 hosted on AWS' Bedrock service. Since the primary goal is to use natural language to query the database, the user will provide prompts about the metadata specifically. The framework is hosted on Langchain. Claude's system prompt has been configured to understand the metadata schema format and craft MongoDB queries based on the prompt. Given a natural language query about the metadata, the model will produce a MongoDB query, thought reasoning and answer. This method of answering follows chain of thought reasoning, where a complex task is broken up into manageable chunks, allowing logical thinking through of a problem.
The main framework used by the model is Retrieval Augmented Generation, a process in which the model consults an external database to generate information for the user's query. This process doesn't interfere with the model's training process, but rather allows the model to successfully query unseen data with few shot learning (examples of queries and answers) and tools (e.g. API access) to examine these databases.
Data Retrieval
Vector Embeddings
To improve retrieval accuracy and decrease hallucinations, we use vector embeddings to access relevant chunks of information found across the database. This process starts with accessing assets, and chunking each json file to chunks of around 8000 tokens (10 chunks per file)-- each chunk preserves the hierarchy found in json files. These chunks are converted to vector arrays of size 1024, through an embedding model (Amazon's Titan 2.0 Embedding). The user's query is converted to a vector and projected onto the latent space. The chunks that contain the most relevant information will be accessed through a cosine similarity search.
AIND-data-schema-access REST API
For queries that require accessing the entire database, like count based questions, information is accessed through an aggregation pipeline, provided by one of the constructed LLM agents, and the API connection.
Multi-Agent graph framework
A multi-agent workflow is created using Langgraph, allowing for parallel execution of tasks, like document retrieval from the vector index, and control over the the RAG process.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file metadata_chatbot-0.0.58.tar.gz
.
File metadata
- Download URL: metadata_chatbot-0.0.58.tar.gz
- Upload date:
- Size: 92.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9d1a029799cd58c8bb1cdf4d0f646aa610efd73bafddc3ac792ac0734e607c8 |
|
MD5 | 11d559a6504330931ad6039f165e006e |
|
BLAKE2b-256 | 8f8aaca41e83d2e133476d9fb200dbc64b3367ccf015eaff4e338c44447af840 |
File details
Details for the file metadata_chatbot-0.0.58-py3-none-any.whl
.
File metadata
- Download URL: metadata_chatbot-0.0.58-py3-none-any.whl
- Upload date:
- Size: 38.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e6cac5df8c96cdd35fb1901f076ea78b56c259b12a92a0e9d1529eb3e2a9ef6 |
|
MD5 | 5d1a15577b0da50f41859476a341087f |
|
BLAKE2b-256 | 37868b349680ba993a9074aae5c94bb43273b2570df913208fe82a50cdac38cd |