Skip to content

joaomarcosrs/easy-document-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy Document Chat

Installation:

Clone the repository

git clone https://github.com/joaomarcosrs/easy-document-chat.git

After creating your virtual environment and activating it, install the requirements

pip install -r requirements.txt

Usage:

  • You must define the ollama embedding model, ollama model, chunk size, chunk overlap and k.
from documentChat import EmbeddingModel, PDFChat


files_path = 'path/to/directory/with/pdfs/'

query_text = '<question string about the document>'

embedding_model = EmbeddingModel(embedding='ollama')
embedding = embedding_model.embedding(model='<ollama embedding model>')

model = PDFChat(
    prompt=query_text,
    path=files_path,
    llm='ollama',
    model='<ollama model>',
    embedding=embedding,
)
model.run()

result = model.response(chunk_size=<int>, chunk_overlap=<int>, length_function=len, is_separator_regex=False, k=<int>)

print(result.get('response'))
print(result.get('sources'))

About

An easy way to build a document chat assistant using RAG (Retrieval-augmented generation)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages