To create a virtual environment, go to the root of your project and run
python -m venv venv
It will create a virtual environment called venv
.\venv\Scripts\activate
| from pyairtable import Api | |
| import os | |
| # Replace these with your Airtable API key and Base ID | |
| AIRTABLE_API_KEY = 'YOUR_API_KEY_HERE' | |
| AIRTABLE_BASE_ID = 'YOUR_AIRTABLE_BASE_ID_HERE' | |
| TABLE_ID = 'YOUR_TABLE_ID_HERE' | |
| # Initialize the Airtable table | |
| api = Api(AIRTABLE_API_KEY) |
This is a prompt I built before finding out about LangChain. I didn't know how to pass documentation I found on a website as context to the LLM, so I first attempted to pass it as pure html. Because a web page's HTML in the modern web can often be a bit bloated, I couldn't pass it directly as context because some pages easily exceeded the size of even the largest context window I could find in any available chat model.
Second step? Attempt to convert these to markdown through conventional means. I tried using html2markdown, markdownify, and pandoc, but I wasn't satisfied with any of the results. So I came up with a solution:
The world's most expensive HTML to markdown utility: leverage LLMs and pass it a task to GPT-4 turbo.
messages=[
{"role": "system", "content": "The user provides HTML content in chunks. Convert only the new chunk to Markdown. The previous messages are provided as context to maintain consistency."},
{"role": "user", "cont
| <svg version="1.1" viewBox="0.0 0.0 453.54330708661416 453.54330708661416" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l453.5433 0l0 453.5433l-453.5433 0l0 -453.5433z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l453.5433 0l0 453.5433l-453.5433 0z" fill-rule="evenodd"/><defs><linearGradient id="p.1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-18.673353567329045 0.0 0.0 -18.673353567329045 0.0 0.0)" spreadMethod="pad" x1="-16.930974601174086" y1="-21.48081253688126" x2="-16.931042683506206" y2="-2.8074589696763304"><stop offset="0.0" stop-color="#ffffff"/><stop offset="1.0" stop-color="#ede2ac"/></linearGradient></defs><path fill="url(#p.1)" d="m316.15808 401.11783l-268.1575 0l0 -348.69315l268.1575 0z" fill-rule="evenodd"/><path stroke="#dd3300" stroke-width="12.0" stroke-miterlimit="8.0" stroke-dasha |