UNPKG

@promptbook/javascript

Version:

Promptbook: Turn your company's scattered knowledge into AI ready books

565 lines (371 loc) โ€ข 32 kB
<!-- โš ๏ธ WARNING: This code has been generated so that any manual changes will be overwritten --> # โœจ Promptbook: AI Agents Turn your company's scattered knowledge into AI ready Books [![NPM Version of ![Promptbook logo - cube with letters P and B](./design/logo-h1.png) Promptbook](https://badge.fury.io/js/promptbook.svg)](https://www.npmjs.com/package/promptbook) [![Quality of package ![Promptbook logo - cube with letters P and B](./design/logo-h1.png) Promptbook](https://packagequality.com/shield/promptbook.svg)](https://packagequality.com/#?package=promptbook) [![Known Vulnerabilities](https://snyk.io/test/github/webgptorg/promptbook/badge.svg)](https://snyk.io/test/github/webgptorg/promptbook) [![๐Ÿงช Test Books](https://github.com/webgptorg/promptbook/actions/workflows/test-books.yml/badge.svg)](https://github.com/webgptorg/promptbook/actions/workflows/test-books.yml) [![๐Ÿงช Test build](https://github.com/webgptorg/promptbook/actions/workflows/test-build.yml/badge.svg)](https://github.com/webgptorg/promptbook/actions/workflows/test-build.yml) [![๐Ÿงช Lint](https://github.com/webgptorg/promptbook/actions/workflows/test-lint.yml/badge.svg)](https://github.com/webgptorg/promptbook/actions/workflows/test-lint.yml) [![๐Ÿงช Spell check](https://github.com/webgptorg/promptbook/actions/workflows/test-spell-check.yml/badge.svg)](https://github.com/webgptorg/promptbook/actions/workflows/test-spell-check.yml) [![๐Ÿงช Test types](https://github.com/webgptorg/promptbook/actions/workflows/test-types.yml/badge.svg)](https://github.com/webgptorg/promptbook/actions/workflows/test-types.yml) [![Issues](https://img.shields.io/github/issues/webgptorg/promptbook.svg?style=flat)](https://github.com/webgptorg/promptbook/issues) ## ๐ŸŒŸ New Features - ๐Ÿš€ **GPT-5 Support** - Now includes OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window - ๐Ÿ’ก VS Code support for `.book` files with syntax highlighting and IntelliSense - ๐Ÿณ Official Docker image (`hejny/promptbook`) for seamless containerized usage - ๐Ÿ”ฅ Native support for OpenAI `o3-mini`, GPT-4 and other leading LLMs - ๐Ÿ” DeepSeek integration for advanced knowledge search <blockquote style="color: #ff8811"> <b>โš  Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>. </blockquote> ## ๐Ÿ“ฆ Package `@promptbook/javascript` - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook). - This package `@promptbook/javascript` is one part of the promptbook ecosystem. To install this package, run: ```bash # Install entire promptbook ecosystem npm i ptbk # Install just this package to save space npm install @promptbook/javascript ``` JavaScript execution engine for Promptbook, providing secure JavaScript code execution within promptbook pipelines and script tasks. ## ๐ŸŽฏ Purpose and Motivation This package provides a secure JavaScript execution environment for Promptbook pipelines. It enables the execution of JavaScript code in `SCRIPT` tasks, allowing for complex data transformations, calculations, and logic within promptbook workflows while maintaining security and isolation. ## ๐Ÿ”ง High-Level Functionality The package provides JavaScript execution capabilities: - **Script Task Execution**: Execute JavaScript code within promptbook `SCRIPT` tasks - **Variable Extraction**: Analyze JavaScript code to extract variable dependencies - **Postprocessing Functions**: Built-in JavaScript functions for common postprocessing tasks - **Secure Execution**: Safe execution environment with proper isolation - **Multiple Execution Modes**: Support for different JavaScript execution strategies ## โœจ Key Features - ๐Ÿ”’ **Secure Execution** - Safe JavaScript execution with proper sandboxing - ๐Ÿ“ **Script Tasks** - Execute JavaScript code within promptbook pipelines - ๐Ÿ”ง **Variable Analysis** - Extract variable dependencies from JavaScript code - ๐Ÿ“Š **Postprocessing Functions** - Built-in functions for common data transformations - โšก **Multiple Execution Modes** - Different execution strategies for various use cases - ๐Ÿ›ก๏ธ **Error Handling** - Comprehensive error handling for script execution - ๐ŸŽฏ **Pipeline Integration** - Seamless integration with promptbook execution flow ## ๐Ÿ“ฆ Exported Entities ### Version Information - `BOOK_LANGUAGE_VERSION` - Current book language version - `PROMPTBOOK_ENGINE_VERSION` - Current engine version ### Execution Tools - `JavascriptEvalExecutionTools` - JavaScript execution tools using eval - `JavascriptExecutionTools` - Standard JavaScript execution tools ### Postprocessing - `POSTPROCESSING_FUNCTIONS` - Built-in postprocessing functions for JavaScript ### Utilities - `extractVariablesFromJavascript` - Extract variable dependencies from JavaScript code > ๐Ÿ’ก This package provides JavaScript execution for promptbook applications. For the core functionality, see [@promptbook/core](#-packages) or install all packages with `npm i ptbk` --- Rest of the documentation is common for **entire promptbook ecosystem**: ## ๐Ÿ“– The Book Whitepaper For most business applications nowadays, the biggest challenge isn't about the raw capabilities of AI models. Large language models like GPT-5 or Claude-4.1 are extremely capable. The main challenge is to narrow it down, constrain it, set the proper **context, rules, knowledge, and personality**. There are a lot of tools which can do exactly this. On one side, there are no-code platforms which can launch your agent in seconds. On the other side, there are heavy frameworks like Langchain or Semantic Kernel, which can give you deep control. Promptbook takes the best from both worlds. You are defining your AI behavior by simple **books**, which are very explicit. They are automatically enforced, but they are very easy to understand, very easy to write, and very reliable and portable. <img alt="Paul Smith & Associรฉs Book" src="https://promptbook.studio/embed/book-preview.png?book=Paul%20Smith%20%26%20Associ%C3%A9s%0A%20%20%20%20%20%20%7C%20PERSONA%20You%20are%20a%20company%20lawyer.%0A%20%20%20%20%20%20%7C%20Your%20job%20is%20to%20provide%20legal%20advice%20and%20support%20to%20the%20company%20and%20its%20employees.%0A%20%20%20%20%20%20%7C%20You%20are%20knowledgeable%2C%20professional%2C%20and%20detail-oriented.&width=800&height=450&nonce=0" /> <div style="page-break-after: always;"></div> ### Aspects of great AI agent We have created a language called **Book**, which allows you to write AI agents in their native language and create your own AI persona. Book provides a guide to define all the traits and commitments. You can look at it as prompting (or writing a system message), but decorated by **commitments**. #### `Persona` commitment Personas define the character of your AI persona, its role, and how it should interact with users. It sets the tone and style of communication. <img alt="Paul Smith & Associรฉs Book" src="https://promptbook.studio/embed/book-preview.png?book=Paul%20Smith%20%26%20Associ%C3%A9s%0A%20%20%20%20%20%20%7C%20PERSONA%20You%20are%20a%20company%20lawyer.%0A%20%20%20%20%20%20%7C%20Your%20job%20is%20to%20provide%20legal%20advice%20and%20support%20to%20the%20company%20and%20its%20employees.%0A%20%20%20%20%20%20%7C%20You%20are%20knowledgeable%2C%20professional%2C%20and%20detail-oriented.&width=800&height=450&nonce=0" /> #### `Knowledge` commitment Knowledge Commitment allows you to provide specific information, facts, or context that the AI should be aware of when responding. This can include domain-specific knowledge, company policies, or any other relevant information. Promptbook Engine will automatically enforce this knowledge during interactions. When the knowledge is short enough, it will be included in the prompt. When it is too long, it will be stored in vector databases and RAG retrieved when needed. But you don't need to care about it. <img alt="Paul Smith & Associรฉs Book" src="https://promptbook.studio/embed/book-preview.png?book=Paul%20Smith%20%26%20Associ%C3%A9s%0A%20%20%20%20%20%20%7C%20PERSONA%20You%20are%20a%20company%20lawyer.%0A%20%20%20%20%20%20%7C%20Your%20job%20is%20to%20provide%20legal%20advice%20and%20support%20to%20the%20company%20and%20its%20employees.%0A%20%20%20%20%20%20%7C%20You%20are%20knowledgeable%2C%20professional%2C%20and%20detail-oriented.%0A%20%20%20%20%20%20%7C%20KNOWLEDGE%20%20https%3A%2F%2Fcompany.com%2Fcompany-policies.pdf%0A%20%20%20%20%20%20%7C%20KNOWLEDGE%20https%3A%2F%2Fcompany.com%2Finternal-documents%2Femployee-handbook.docx&width=800&height=450&nonce=0" /> #### `Rule` commitment Rules will enforce specific behaviors or constraints on the AI's responses. This can include ethical guidelines, communication styles, or any other rules you want the AI to follow. Depending on rule strictness, Promptbook will either propagate it to the prompt or use other techniques, like adversary agent, to enforce it. <img alt="Paul Smith & Associรฉs Book" src="https://promptbook.studio/embed/book-preview.png?book=Paul%20Smith%20%26%20Associ%C3%A9s%0A%20%20%20%20%20%20%7C%20PERSONA%20You%20are%20a%20company%20lawyer.%0A%20%20%20%20%20%20%7C%20Your%20job%20is%20to%20provide%20legal%20advice%20and%20support%20to%20the%20company%20and%20its%20employees.%0A%20%20%20%20%20%20%7C%20You%20are%20knowledgeable%2C%20professional%2C%20and%20detail-oriented.%0A%20%20%20%20%20%20%7C%20RULE%20Always%20ensure%20compliance%20with%20laws%20and%20regulations.%0A%20%20%20%20%20%20%7C%20RULE%20Never%20provide%20legal%20advice%20outside%20your%20area%20of%20expertise.%0A%20%20%20%20%20%20%7C%20RULE%20Never%20provide%20legal%20advice%20about%20criminal%20law.%0A%20%20%20%20%20%20%7C%20KNOWLEDGE%20%20https%3A%2F%2Fcompany.com%2Fcompany-policies.pdf%0A%20%20%20%20%20%20%7C%20KNOWLEDGE%20https%3A%2F%2Fcompany.com%2Finternal-documents%2Femployee-handbook.docx&width=800&height=450&nonce=0" /> #### `Action` commitment Action Commitment allows you to define specific actions that the AI can take during interactions. This can include things like posting on a social media platform, sending emails, creating calendar events, or interacting with your internal systems. <img alt="Paul Smith & Associรฉs Book" src="https://promptbook.studio/embed/book-preview.png?book=Paul%20Smith%20%26%20Associ%C3%A9s%0A%20%20%20%20%20%20%7C%20PERSONA%20You%20are%20a%20company%20lawyer.%0A%20%20%20%20%20%20%7C%20Your%20job%20is%20to%20provide%20legal%20advice%20and%20support%20to%20the%20company%20and%20its%20employees.%0A%20%20%20%20%20%20%7C%20You%20are%20knowledgeable%2C%20professional%2C%20and%20detail-oriented.%0A%20%20%20%20%20%20%7C%20RULE%20Always%20ensure%20compliance%20with%20laws%20and%20regulations.%0A%20%20%20%20%20%20%7C%20RULE%20Never%20provide%20legal%20advice%20outside%20your%20area%20of%20expertise.%0A%20%20%20%20%20%20%7C%20RULE%20Never%20provide%20legal%20advice%20about%20criminal%20law.%0A%20%20%20%20%20%20%7C%20KNOWLEDGE%20%20https%3A%2F%2Fcompany.com%2Fcompany-policies.pdf%0A%20%20%20%20%20%20%7C%20KNOWLEDGE%20https%3A%2F%2Fcompany.com%2Finternal-documents%2Femployee-handbook.docx%0A%20%20%20%20%20%20%7C%20ACTION%20When%20a%20user%20asks%20about%20an%20issue%20that%20could%20be%20treated%20as%20a%20crime%2C%20notify%20legal%40company.com.&width=800&height=450&nonce=0" /> [Read more about the language](./BLUEPRINT.md) <div style="page-break-after: always;"></div> ### Where to use your AI agent in book Books can be useful in various applications and scenarios. Here are some examples: #### Chat apps: Create your own chat shopping assistant and place it in your eShop. You will be able to answer customer questions, help them find products, and provide personalized recommendations. Everything is tightly controlled by the book you have written. #### Reply Agent: Create your own AI agent, which will look at your emails and reply to them. It can even create drafts for you to review before sending. #### Coding Agent: Do you love Vibecoding, but the AI code is not always aligned with your coding style and architecture, rules, security, etc.? Create your own coding agent to help enforce your specific coding standards and practices. This can be integrated to almost any Vibecoding platform, like GitHub Copilot, Amazon CodeWhisperer, Cursor, Cline, Kilocode, Roocode,... They will work the same as you are used to, but with your specific rules written in book. #### Internal Expertise Do you have an app written in TypeScript, Python, C#, Java, or any other language, and you are integrating the AI. You can avoid struggle with choosing the best model, its settings like temperature, max tokens, etc., by writing a book agent and using it as your AI expertise. Doesn't matter if you do automations, data analysis, customer support, sentiment analysis, classification, or any other task. Your AI agent will be tailored to your specific needs and requirements. Even works in no-code platforms! <div style="page-break-after: always;"></div> ### How to create your AI agent in book Now you want to use it. There are several ways how to write your first book: #### From scratch with help from Paul We have written ai asistant in book who can help you with writing your first book. #### Your AI twin Copy your own behavior, personality, and knowledge into book and create your AI twin. It can help you with your work, personal life, or any other task. #### AI persona workpool Or you can pick from our library of pre-written books for various roles and tasks. You can find books for customer support, coding, marketing, sales, HR, legal, and many other roles. ## ๐Ÿš€ Get started Take a look at the simple starter kit with books integrated into the **Hello World** sample applications: - [Hello Book](https://github.com/webgptorg/hello-world) - [Hello Book in Node.js](https://github.com/webgptorg/hello-world-node-js) - [Hello Book in Next.js](https://github.com/webgptorg/hello-world-next-js) ## ๐Ÿ’œ The Promptbook Project Promptbook project is ecosystem of multiple projects and tools, following is a list of most important pieces of the project: <table> <thead> <tr> <th>Project</th> <th>About</th> </tr> </thead> <tbody> <tr> <td><a href="https://github.com/webgptorg/book">Book language</a></td> <td> Book is a human-understandable markup language for writing AI applications such as chatbots, knowledge bases, agents, avarars, translators, automations and more. <hr> There is also <a href="https://github.com/webgptorg/book-extension">a plugin for VSCode</a> to support <code>.book</code> file extension </td> </tr> <tr> <td><a href="https://github.com/webgptorg/promptbook">Promptbook Engine</a></td> <td> Promptbook engine can run applications written in Book language. It is released as <a href="https://www.npmjs.com/package/@promptbook/core#-packages-for-developers">multiple NPM packages</a> and <a href="https://hub.docker.com/r/hejny/promptbook">Docker HUB</a> </td> </tr> <tr> <td><a href="https://promptbook.studio">Promptbook Studio</a></td> <td> Promptbook.studio is a web-based editor and runner for book applications. It is still in the experimental MVP stage. </td> </tr> </tbody> </table> Hello world examples: - [Hello world](https://github.com/webgptorg/hello-world) - [Hello world in Node.js](https://github.com/webgptorg/hello-world-node-js) - [Hello world in Next.js](https://github.com/webgptorg/hello-world-next-js) ### ๐ŸŒ Community & Social Media Join our growing community of developers and users: <table> <thead> <tr> <th>Platform</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a href="https://discord.gg/x3QWNaa89N">๐Ÿ’ฌ Discord</a></td> <td>Join our active developer community for discussions and support</td> </tr> <tr> <td><a href="https://github.com/webgptorg/promptbook/discussions">๐Ÿ—ฃ๏ธ GitHub Discussions</a></td> <td>Technical discussions, feature requests, and community Q&A</td> </tr> <tr> <td><a href="https://linkedin.com/company/promptbook">๐Ÿ‘” LinkedIn</a></td> <td>Professional updates and industry insights</td> </tr> <tr> <td><a href="https://www.facebook.com/61560776453536">๐Ÿ“ฑ Facebook</a></td> <td>General announcements and community engagement</td> </tr> <tr> <td><a href="https://ptbk.io">๐Ÿ”— ptbk.io</a></td> <td>Official landing page with project information</td> </tr> </tbody> </table> ### ๐Ÿ–ผ๏ธ Product & Brand Channels #### Promptbook.studio <table> <tbody> <tr> <td><a href="https://www.instagram.com/promptbook.studio/">๐Ÿ“ธ Instagram @promptbook.studio</a></td> <td>Visual updates, UI showcases, and design inspiration</td> </tr> </tbody> </table> ## ๐Ÿ“š Documentation See detailed guides and API reference in the [docs](https://github.com/webgptorg/promptbook/discussions/categories/concepts) or [online](https://discord.gg/x3QWNaa89N). ## ๐Ÿ”’ Security For information on reporting security vulnerabilities, see our [Security Policy](./SECURITY.md). ## ๐Ÿ“ฆ Packages _(for developers)_ This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook). You can install all of them at once: ```bash npm i ptbk ``` Or you can install them separately: > โญ Marked packages are worth to try first - โญ **[ptbk](https://www.npmjs.com/package/ptbk)** - Bundle of all packages, when you want to install everything and you don't care about the size - **[promptbook](https://www.npmjs.com/package/promptbook)** - Same as `ptbk` - โญ๐Ÿง™โ€โ™‚๏ธ **[@promptbook/wizard](https://www.npmjs.com/package/@promptbook/wizard)** - Wizard to just run the books in node without any struggle - **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks - **[@promptbook/node](https://www.npmjs.com/package/@promptbook/node)** - Core of the library for Node.js environment - **[@promptbook/browser](https://www.npmjs.com/package/@promptbook/browser)** - Core of the library for browser environment - โญ **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs - **[@promptbook/markdown-utils](https://www.npmjs.com/package/@promptbook/markdown-utils)** - Utility functions used for processing markdown - _(Not finished)_ **[@promptbook/wizard](https://www.npmjs.com/package/@promptbook/wizard)** - Wizard for creating+running promptbooks in single line - **[@promptbook/javascript](https://www.npmjs.com/package/@promptbook/javascript)** - Execution tools for javascript inside promptbooks - **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK - **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK - **[@promptbook/vercel](https://www.npmjs.com/package/@promptbook/vercel)** - Adapter for Vercel functionalities - **[@promptbook/google](https://www.npmjs.com/package/@promptbook/google)** - Integration with Google's Gemini API - **[@promptbook/deepseek](https://www.npmjs.com/package/@promptbook/deepseek)** - Integration with [DeepSeek API](https://www.deepseek.com/) - **[@promptbook/ollama](https://www.npmjs.com/package/@promptbook/ollama)** - Integration with [Ollama](https://ollama.com/) API - **[@promptbook/azure-openai](https://www.npmjs.com/package/@promptbook/azure-openai)** - Execution tools for Azure OpenAI API - **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens - **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks - **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks - **[@promptbook/pdf](https://www.npmjs.com/package/@promptbook/pdf)** - Read knowledge from `.pdf` documents - **[@promptbook/documents](https://www.npmjs.com/package/@promptbook/markitdown)** - Integration of [Markitdown by Microsoft](https://github.com/microsoft/markitdown) - **[@promptbook/documents](https://www.npmjs.com/package/@promptbook/documents)** - Read knowledge from documents like `.docx`, `.odt`,โ€ฆ - **[@promptbook/legacy-documents](https://www.npmjs.com/package/@promptbook/legacy-documents)** - Read knowledge from legacy documents like `.doc`, `.rtf`,โ€ฆ - **[@promptbook/website-crawler](https://www.npmjs.com/package/@promptbook/website-crawler)** - Crawl knowledge from the web - **[@promptbook/editable](https://www.npmjs.com/package/@promptbook/editable)** - Editable book as native javascript object with imperative object API - **[@promptbook/templates](https://www.npmjs.com/package/@promptbook/templates)** - Useful templates and examples of books which can be used as a starting point - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library - **[@promptbook/color](https://www.npmjs.com/package/@promptbook/color)** - Color manipulation library - โญ **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks - ๐Ÿ‹ **[Docker image](https://hub.docker.com/r/hejny/promptbook/)** - Promptbook server ## ๐Ÿ“š Dictionary The following glossary is used to clarify certain concepts: ### General LLM / AI terms - **Prompt drift** is a phenomenon where the AI model starts to generate outputs that are not aligned with the original prompt. This can happen due to the model's training data, the prompt's wording, or the model's architecture. - [**Pipeline, workflow scenario or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.](https://github.com/webgptorg/promptbook/discussions/88) - **Fine-tuning** is a process where a pre-trained AI model is further trained on a specific dataset to improve its performance on a specific task. - **Zero-shot learning** is a machine learning paradigm where a model is trained to perform a task without any labeled examples. Instead, the model is provided with a description of the task and is expected to generate the correct output. - **Few-shot learning** is a machine learning paradigm where a model is trained to perform a task with only a few labeled examples. This is in contrast to traditional machine learning, where models are trained on large datasets. - **Meta-learning** is a machine learning paradigm where a model is trained on a variety of tasks and is able to learn new tasks with minimal additional training. This is achieved by learning a set of meta-parameters that can be quickly adapted to new tasks. - **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models. - **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately. _Note: This section is not a complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_ ### ๐Ÿ’ฏ Core concepts - [๐Ÿ“š Collection of pipelines](https://github.com/webgptorg/promptbook/discussions/65) - [๐Ÿ“ฏ Pipeline](https://github.com/webgptorg/promptbook/discussions/64) - [๐Ÿ™‡โ€โ™‚๏ธ Tasks and pipeline sections](https://github.com/webgptorg/promptbook/discussions/88) - [๐Ÿคผ Personas](https://github.com/webgptorg/promptbook/discussions/22) - [โญ• Parameters](https://github.com/webgptorg/promptbook/discussions/83) - [๐Ÿš€ Pipeline execution](https://github.com/webgptorg/promptbook/discussions/84) - [๐Ÿงช Expectations](https://github.com/webgptorg/promptbook/discussions/30) - Define what outputs should look like and how they're validated - [โœ‚๏ธ Postprocessing](https://github.com/webgptorg/promptbook/discussions/31) - How outputs are refined after generation - [๐Ÿ”ฃ Words not tokens](https://github.com/webgptorg/promptbook/discussions/29) - The human-friendly way to think about text generation - [โ˜ฏ Separation of concerns](https://github.com/webgptorg/promptbook/discussions/32) - How Book language organizes different aspects of AI workflows ### Advanced concepts <table> <tr> <th>Data & Knowledge Management</th> <th>Pipeline Control</th> </tr> <tr> <td> <ul> <li><a href="https://github.com/webgptorg/promptbook/discussions/41">๐Ÿ“š Knowledge (RAG)</a> - Retrieve and use external information</li> <li><a href="https://github.com/webgptorg/promptbook/discussions/54">๐Ÿ“ฝ Media handling</a> - Working with images, audio, video, spreadsheets</li> <li><a href="https://github.com/webgptorg/promptbook/discussions/40">๐Ÿ”ด Anomaly detection</a> - Identifying unusual patterns or outputs</li> </ul> </td> <td> <ul> <li><a href="https://github.com/webgptorg/promptbook/discussions/89">๐ŸŒ Remote server</a> - Executing workflows on remote infrastructure</li> <li><a href="https://github.com/webgptorg/promptbook/discussions/66">๐Ÿƒ Jokers (conditions)</a> - Adding conditional logic to workflows</li> <li><a href="https://github.com/webgptorg/promptbook/discussions/35">๐Ÿ”ณ Metaprompting</a> - Creating prompts that generate other prompts</li> </ul> </td> </tr> <tr> <th>Language & Output Control</th> <th>Advanced Generation</th> </tr> <tr> <td> <ul> <li><a href="https://github.com/webgptorg/promptbook/discussions/53">๐ŸŒ Linguistically typed languages</a> - Type systems for natural language</li> <li><a href="https://github.com/webgptorg/promptbook/discussions/42">๐ŸŒ Auto-Translations</a> - Automatic multilingual support</li> <li><a href="https://github.com/webgptorg/promptbook/discussions/39">๐Ÿ‘ฎ Agent adversary expectations</a> - Safety and control mechanisms</li> </ul> </td> <td> <ul> <li><a href="https://github.com/webgptorg/promptbook/discussions/37">๐Ÿ”™ Expectation-aware generation</a> - Outputs that meet defined criteria</li> <li><a href="https://github.com/webgptorg/promptbook/discussions/33">โณ Just-in-time fine-tuning</a> - Dynamic model adaptation</li> </ul> </td> </tr> </table> <p align="center"><a href="https://github.com/webgptorg/promptbook/discussions/categories/concepts">๐Ÿ” View more concepts</a></p> ## ๐Ÿš‚ Promptbook Engine ![Schema of Promptbook Engine](./documents/promptbook-engine.svg) ## โž•โž– When to use Promptbook? ### โž• When to use - When you are writing app that generates complex things via LLM - like **websites, articles, presentations, code, stories, songs**,... - When you want to **separate code from text prompts** - When you want to describe **complex prompt pipelines** and don't want to do it in the code - When you want to **orchestrate multiple prompts** together - When you want to **reuse** parts of prompts in multiple places - When you want to **version** your prompts and **test multiple versions** - When you want to **log** the execution of prompts and backtrace the issues [See more](https://github.com/webgptorg/promptbook/discussions/111) ### โž– When not to use - When you have already implemented single simple prompt and it works fine for your job - When [OpenAI Assistant (GPTs)](https://help.openai.com/en/articles/8673914-gpts-vs-assistants) is enough for you - When you need streaming _(this may be implemented in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/102))_. - When you need to use something other than JavaScript or TypeScript _(other languages are on the way, [see the discussion](https://github.com/webgptorg/promptbook/discussions/101))_ - When your main focus is on something other than text - like images, audio, video, spreadsheets _(other media types may be added in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/103))_ - When you need to use recursion _([see the discussion](https://github.com/webgptorg/promptbook/discussions/38))_ [See more](https://github.com/webgptorg/promptbook/discussions/112) ## ๐Ÿœ Known issues - [๐Ÿคธโ€โ™‚๏ธ Iterations not working yet](https://github.com/webgptorg/promptbook/discussions/55) - [โคต๏ธ Imports not working yet](https://github.com/webgptorg/promptbook/discussions/34) ## ๐Ÿงผ Intentionally not implemented features - [โžฟ No recursion](https://github.com/webgptorg/promptbook/discussions/38) - [๐Ÿณ There are no types, just strings](https://github.com/webgptorg/promptbook/discussions/52) ## โ” FAQ If you have a question [start a discussion](https://github.com/webgptorg/promptbook/discussions/), [open an issue](https://github.com/webgptorg/promptbook/issues) or [write me an email](https://www.pavolhejny.com/contact). - [โ” Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?](https://github.com/webgptorg/promptbook/discussions/114) - [โ” How is it different from the OpenAI`s GPTs?](https://github.com/webgptorg/promptbook/discussions/118) - [โ” How is it different from the Langchain?](https://github.com/webgptorg/promptbook/discussions/115) - [โ” How is it different from the DSPy?](https://github.com/webgptorg/promptbook/discussions/117) - [โ” How is it different from _anything_?](https://github.com/webgptorg/promptbook/discussions?discussions_q=is%3Aopen+label%3A%22Promptbook+vs%22) - [โ” Is Promptbook using RAG _(Retrieval-Augmented Generation)_?](https://github.com/webgptorg/promptbook/discussions/123) - [โ” Is Promptbook using function calling?](https://github.com/webgptorg/promptbook/discussions/124) ## ๐Ÿ“… Changelog See [CHANGELOG.md](./CHANGELOG.md) ## ๐Ÿ“œ License This project is licensed under [BUSL 1.1](./LICENSE.md). ## ๐Ÿค Contributing We welcome contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines. You can also โญ star the project, [follow us on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).We are open to [pull requests, feedback, and suggestions](./CONTRIBUTING.md). ## ๐Ÿ†˜ Support & Community Need help with Book language? We're here for you! - ๐Ÿ’ฌ [Join our Discord community](https://discord.gg/x3QWNaa89N) for real-time support - ๐Ÿ“ [Browse our GitHub discussions](https://github.com/webgptorg/promptbook/discussions) for FAQs and community knowledge - ๐Ÿ› [Report issues](https://github.com/webgptorg/book/issues) for bugs or feature requests - ๐Ÿ“š Visit [ptbk.io](https://ptbk.io) for more resources and documentation - ๐Ÿ“ง Contact us directly through the channels listed in our [signpost](./SIGNPOST.md) We welcome contributions and feedback to make Book language better for everyone!