Ask My PDF
The quick-start guide illustrates how to write a GenAIScript that takes input from a pdf file.
- Place your PDF document in a directory visible in VS Code Explorer
- Use the
> GenAIScript: Create new script...
command in the command palette to create a new script. - Define and name the pdf file as an input:
const src = def("PDFSOURCE", env.files, { endsWith: ".pdf" })
- Replace the text
"TELL THE LLM WHAT TO DO..."
with what you want it to do with your pdf file. Use the name in the def to refer to the file.$`You are a helpful assistant.Summarize the content of ${src} and critique the document.` - Right click on the pdf document in VS Code Explorer. Select Run GenAIScript. Select the script you just wrote.
- Output will be displayed in a new document tab.
Example: Lorem Ipsum
In this example, we will extract text from a pdf that describes the history of Lorem Ipsem.
const src = def("PDFSOURCE", env.files, { endsWith: ".pdf" })$`You are a helpful assistant.Summarize the content of ${src} and critique the document.
- Only one paragraph. Keep it short.`
👤 user
PDFSOURCE:```pdf file="src/samples/loremipsum.pdf"Lorem Ipsum"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipiscivelit...""There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain..."
What is Lorem Ipsum?Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has beenthe industry's standard dummy text ever since the 1500s, when an unknown printer took a galleyof type and scrambled it to make a type specimen book. It has survived not only five centuries, butalso the leap into electronic typesetting, remaining essentially unchanged. It was popularised inthe 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and morerecently with desktop publishing software like Aldus PageMaker including versions of LoremIpsum.Why do we use it?It is a long established fact that a reader will be distracted by the readable content of a page whenlooking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distributionof letters, as opposed to using 'Content here, content here', making it look like readable English.Many desktop publishing packages and web page editors now use Lorem Ipsum as their defaultmodel text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Variousversions have evolved over the years, sometimes by accident, sometimes on purpose (injectedhumour and the like).
Where does it come from?Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classicalLatin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professorat Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words,consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classicalliterature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, writtenin 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. Thefirst line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for thoseinterested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero arealso reproduced in their exact original form, accompanied by English versions from the 1914translation by H. Rackham.
Where can I get some?There are many variations of passages of Lorem Ipsum available, but the majority have sufferedalteration in some form, by injected humour, or randomised words which don't look even slightlybelievable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn'tanything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internettend to repeat predefined chunks as necessary, making this the first true generator on the Internet.
-------- Page Break --------
It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures,to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore alwaysfree from repetition, injected humour, or non-characteristic words etc.```
You are a helpful assistant.Summarize the content of PDFSOURCE and critique the document.
- Only one paragraph. Keep it short.
🤖 assistant
The PDF "Lorem Ipsum" provides information about the origins and usage of the standard dummy text in the printing and typesetting industry. It explains the purpose of using Lorem Ipsum, its historical roots, and variations. However, it lacks visual aids or examples to enhance the understanding of the text distribution concept.