Skip to content

coppeliaMLA/timeline_ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

timeline ai

About the project

This python package uses a large language model (currently OpenAI's gpt-3.5-turbo) to extract and then visualise (using the brilliant d3-milestones package) historical time lines from pdf documents.

Here are some example outputs:

As with all uses of LLMs there is the possibility of hallucinations and so it is crucial that the information is verifiable. You can do this by clicking on each event on the timeline. You will then be taken to the page of the pdf from which the event was extracted.

Installation

Install using pip either directly from github...

pip install timeline_ai@git+https://github.com/coppeliaMLA/timeline_ai

Or if you have cloned the repository simply run pip install . from the repository root.

Obtaining an Openai API Key

You will need an to run the package. Instructions for obtaining the key are here. Note the service is not free! Once you have the key you will need to add it to your environment variables. See this notebook for an example of how to do this in python.

Usage

A single line of code will generate the timeline.

import timeline_ai as ta

ta.build_timeline(pdf_file="byron_bio.pdf",
    output_file = "byron.html",
    timeline_title = "Byron's life and works",
    start_year = 1780,
    end_year = 1830)

The arguments to the function are as follows:

  • pdf_file (str): The path to the PDF file containing the timeline data.
  • output_file (str): The path to save the generated timeline diagram.
  • timeline_title (str): The title of the timeline.
  • start_year (int): The starting year of the timeline.
  • end_year (int): The ending year of the timeline.
  • useful_info (str, optional): Additional information to pass to the LLM prompt.

You can find a jupyter notebook for generating the above examples here

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages