Package: prapti
Prapti: converse with LLMs directly in markdown filesHello! Welcome to Prapti. It's early, and we're just getting started. Please use GitHubDiscussionsfor general queries and suggestions, andIssuesfor bug reports. SeeCONTRIBUTING.mdfor code contributions.Prapti is a tool for prompting Large Language Models (LLMs) with an editable history. You work within amarkdownfile where you can edit your prompts and the LLM's responses. Press a hot-key to get the next response from the LLM. Once received, the response is automatically appended to the file.FeaturesWork in your favourite editorMarkdown files are the native conversation format (headings with special text delimit message boundaries)Easily edit the whole conversation history/context window, including previous LLM outputsInline configuration syntax: easily change LLM parameters and switch language models ("responders") with each round of the conversationDesigned to be extensible with plugins (responders, commands and processing hooks)Supports OpenAI, OpenAI-compatible local servers, Koboldcpp, GPT4All (experimental), or add your favourite LLM back-end by implementing a Responder pluginUsing prapti is an interactive experience, but you can get an idea of what it might be like by readingyour first prapti conversation.Installation and SetupPrapti requires Python 3.10 or newer.Installation involves the following required steps:Install theprapticommand line toolSet up your OpenAI API key (or configure a local LLM:see docs)Check that thepraptitool runs manually in your terminalSet up a keybinding to runpraptiin your editor1. Install theprapticommand line toolIn your terminal, run:pip install git+https://github.com/prapti-ai/prapti(orpip3orpy -3 -m pipdepending on your system).We recommend running prapti in a Python virtual environment such asvenv.2. Set up your OpenAI API key (or configure a local LLM)export OPENAI_API_KEY=your-key-goes-here(orsetx, depending on your system. There are other ways to manage your environment variables. For details see OpenAI'sBest Practices for API Key Safety).To select a non-default organisation, use theOPENAI_ORGANIZATIONenvironment variable.To use an alternate OpenAI API key and/or organization specifically with prapti you can setPRAPTI_OPENAI_API_KEYand/orPRAPTI_OPENAI_ORGANIZATION. If set, prapti will use these environment variables in preference toOPENAI_API_KEYandOPENAI_ORGANIZATION.Click here for local LLM configuration3. Check that thepraptitool runs manually in your terminalFirst, create a new markdown file with.mdextension. You can name it anything you like, for exampletest-chat.md.Edit the file so that the final lines consist of a user prompt. A user prompt is a message that you, as the user, write to the LLM. It should look like this:### @user:

Write your prompt here.Then runpraptiin the terminal to generate a new assistant response:prapti test-chat.mdAfter runningprapti, refresh or reload thetest-chat.mdfile. You should see that prapti has appended an assistant response to the file. With this test, you've confirmed that prapti works correctly in your terminal. The next step is to set up a convenient way to run prapti, such as a hot-key, for a smoother conversation flow with the LLM.4. Set up a keybinding to runpraptiin your text editorChoose a key combination (e.g.Ctrl-Enter) in your preferred text editor, and configure it to save the current file and runprapti. This keybinding should be set to function only when you're editing markdown files.Below are the instructions for VSCode. If you use another editor please contribute instructions.VSCodeNOTE: This key binding runspraptiin the active VSCode terminal window. So make sure you have the terminal open with theprapticommand available.First use theQuick Openmenu (Cmd-Shift-Pon Mac,Ctrl-Shift-Pon Windows) to run:Preferences: Open Keyboard Shortcuts (JSON)then add the following binding to the openedkeybindings.jsonfile.{"key":"ctrl+enter","command":"runCommands","args":{"commands":["workbench.action.files.save","cursorBottom",{"command":"workbench.action.terminal.sendSequence","args":{"text":"prapti ${file}\u000D"}},"cursorBottom",]},"when":"editorLangId == markdown"},Now, when editing your markdown file you should be able to hitCtrl-Enterto get a response from the LLM. You can watch the terminal window for progress. Be patient, GPT4 can take 30 seconds to generate a full response.Seeour documentationfor optional text editor setup to streamline your experience.LicenseThis project isMITlicensed.