Skip to main content

chat2pdf

Python Pypi Docs LOC Downloads Downloads License Forks Issues Project Status DOI GitHub Repo stars GitHub repo size Donate

  • chat2pdf is Python package

Star this repo if you like it! ⭐️

Installation

  • Install chat2pdf from PyPI (recommended). chat2pdf is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • A new environment can be created as follows:
conda create -n env_chat2pdf python=3.12
conda activate env_chat2pdf
pip install chat2pdf            # normal install
pip install --upgrade chat2pdf # or update if needed
  • Alternatively, you can install from the GitHub source:
# Directly install from github source
pip install -e git://github.com/erdogant/chat2pdf.git@0.1.0#egg=master
pip install git+https://github.com/erdogant/chat2pdf#egg=master
pip install git+https://github.com/erdogant/chat2pdf

# By cloning
git clone https://github.com/erdogant/chat2pdf.git
cd chat2pdf
pip install -U -e .

Import chat2pdf package

from chat2pdf import chat2pdf

Example by using PDF files

# Import
from chat2pdf import chat2pdf
# Initialize
client = chat2pdf(model='Phi3')

# Check prompt
print(client.prompt)

client.pdf_read([r'C:\my_personal_pdf.pdf'])
print(client.context)

question = "Create a summary with at most 100 words"
client.question(question)

# print(client.response)
client.question('What was my first question?')

Example by adding alternatively context:

# Import
from chat2pdf import chat2pdf
# Initialize
client = chat2pdf()

# print the prompt text
print(client.prompt)

# Change prompt:
# client.prompt = "Use Dutch as language."

client.context = """
The Eiffel Tower is a wrought iron lattice tower on the Champ de Mars in Paris, France.
It is named after the engineer Gustave Eiffel, whose company designed and built the tower.
The tower is 324 meters (1,063 ft) tall, about the same height as an 81-story building, and the tallest structure in Paris.
The number of visitors on yearly basis is 10.000.
"""
print(client.context)

# question = "How many people visit the Eiffel Tower?"
# question = "How width is the Eiffel Tower?"
question = "How tall is the Eiffel Tower?"

# Template
print(client.template)

# Now ask the question
client.question(question)

# Reponse
# print(client.response)

Example by adding directly Context:

streamlit run chat2pdf.py

References

Citation

Please cite in your publications if this is useful for your research (see citation).

Maintainers

Contribute

  • All kinds of contributions are welcome!
  • If you wish to buy me a Coffee for this work, it is very appreciated :)

Licence

See LICENSE for details.

Release files for chat2pdf 1.0.0

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

Source distribution (sdist)

Source distribution for chat2pdf 1.0.0
File Size Uploaded
chat2pdf-1.0.0.tar.gz 9.6 kB Details

Built distribution (wheel)

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

Total release size: 19.8 kB

Release files / chat2pdf-1.0.0.tar.gz

Download URL chat2pdf-1.0.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
47755ee63fba1e2aceac0f3ac04e5fe19cbfe1661378fd90528733c9d9fcab39
BLAKE2b-256 checksum
How to use checksums
9c6a93a502099a479a3de8387cf60944f0759c0d35ec535512b93cf7fe595de8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / chat2pdf-1.0.0-py3-none-any.whl

Download URL chat2pdf-1.0.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9d5261afa3a1c0ef318aa56e963399e8472bc2c3998b79846bcd9c971a63298
BLAKE2b-256 checksum
How to use checksums
2f15b190966bffc2083cb9521c650064f5a0ee6aaae10c9d0b553f172e6d5af3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 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