Skip to main content

VDBforGenAI

VDBforGenAI is a Python package for building vector databases of text for use in natural language processing applications.

Usage

To use VDBforGenAI, first install the package and its dependencies:

pip install git+https://github.com/JakubJDolezal/VDBforGenAI.git

Next, create an instance of the VectorDatabase class by passing in a list of strings, which represent the context you care about. Each string can contain multiple sentences.

Minimal example

You instantiate a database and then tell it where to load

from VDBforGenAI.VectorDatabase import VectorDatabase

vdb = VectorDatabase(splitting_choice="length")
vdb.load_all_in_directory('./ExampleFolder')

Once you have a VectorDatabase instance, you can use the get_context_from_entire_database method to retrieve the context that is most similar to a given input text.

context = vdb.get_context_from_entire_database('What does parma ham go well with?')

print(context)

This retrieves the most similar piece of text to "What does parma ham go well with?" from your indexed directory You can also specify which level and which directory on that level you wish to search

context_selection=vdb.get_index_and_context_from_selection('Who made this?', 2, 'SubfolderOfLies')

The directory level and value structure is saved in

print(vdb.dlv)

Dependencies

VDBforGenAI has the following dependencies:

        "faiss-cpu",
        "transformers",
        "torch",
        "numpy","PyPDF2",'docx','python-docx

Contributions are welcome! If you have any suggestions or issues, please create an issue or pull request on the GitHub repository. License

VDBforGenAI is licensed under the MIT License.

More Usage -

How to add new strings

Passing an encoder and tokenizer from Hugging Face's Transformers library:

from transformers import AutoTokenizer, AutoModel
from VDBforGenAI import VectorDatabase

[//]: # ( Initialize the tokenizer and encoder)
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
encoder = AutoModel.from_pretrained('bert-base-uncased')

[//]: # ( Initialize the VectorDatabase)
vdb = VectorDatabase( encoder=encoder, tokenizer=tokenizer)

Similarly, you can pass your own encoder as a torch model if you provide a tokenizer and the 0th output is the encoding.

Metadata

Release files for VDBforGenAI 0.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for VDBforGenAI 0.23
File Size Uploaded
VDBforGenAI-0.23.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for VDBforGenAI 0.23
File Interpreter ABI Platform
VDBforGenAI-0.23-py3-none-any.whl Python 3 none any Details

Total release size: 27.0 kB

Release files / VDBforGenAI-0.23.tar.gz

Download URL VDBforGenAI-0.23.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a0d937d7831d633418b42a14897ff2f3380e0675fb02cd4cf223adc75fcd0c52
BLAKE2b-256 checksum
How to use checksums
7034d6826848fd5dddd5c1596e2db93242a2f8727ef0edffc2c9a82f3192fba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release files / VDBforGenAI-0.23-py3-none-any.whl

Download URL VDBforGenAI-0.23-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fd0a8ef081542d46a3561531b1e1cfcc366d15924d384a80c5e247c856705da
BLAKE2b-256 checksum
How to use checksums
3b0928d8e86d17c6e0e74041007d89c52fdf5c9d8276d64ea79776f55619480d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release history Release notifications | RSS feed

This release

0.23 This release

2 release files

0.22

1 release file

0.21

1 release file

0.2

2 release files

0.1

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page