Langchain: Query the complete 3D Slicer documentation, script repository and FAQ (PDF and HTML) with OpenAI LLM

rbumm
Tue, 04 Apr 2023 12:55:42 +0000
Support

This test implementation enables reading the complete 3D Slicer documentation, including the script repository, from a PDF file, and making it available for queries in an OpenAI LLM using Langchain.
The functionality is similar to ChatGPT, but the source is simply this single PDF document.

You’ll need to make a copy of the 3D Slicer readthedocs documentation as PDF (or modify the code to scrape it directly) and place it in one of your Google drive folders. In addition, you will need to add your OpenAI secret key to make this functional. It works great.

My highly intelligent prompt engineering includes

prompts = [
          'What is 3D Slicer?',
          'Is 3D Slicer FDA-approved?',
          'Who is Ron Kirkinis?',
          'Who is Andras Lasso?',
          'Who is Steve Pieper?',
          'Who created 3D Slicer?',
          'What are the main use-cases for 3D Slicer?',
          'Does 3D Slicer support AI?',
          'What is an extension?',

          'How can I clone a node? Please provide Python code.',

          'please summarize this document',
          'please summarize chapters 1-12 of this document',
          'please summarize chapter 1 of this document',
          'please summarize chapter 2 of this document',
          'please summarize chapter 3 of this document',
          'please summarize chapter 4 of this document',
          'please summarize chapter 5 of this document',
          'please summarize chapter 6 of this document',
          'please summarize chapter 7 of this document',
          'please summarize chapter 8 of this document',
          'please summarize chapter 9 of this document',
          'please summarize chapter 10 of this document',
          'please summarize chapter 11 of this document',
          'please summarize chapter 12 of this document',

           ]

Here is the Colab notebook, please make your copies for testing.

colab.research.google.com

Google Colaboratory

10 posts - 2 participants

Read full topic