0.1.2 • Published 8 months ago

@puzzlet/promptdx v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Overview

PromptDX is a declarative, extensible, and composable approach for developing LLM prompts using Markdown and JSX.

PromptDX is designed to enhance the developer experience for applications built with large language models (LLMs). It allows you to open a PromptDX file and clearly see the exact input being sent to the LLM, while still providing the flexibility to abstract away necessary details.

PromptDX is built on top of the templating language, TemplateDX, and inspired by MDX.

Getting Started

Below is a basic example to help you get started with PromptDX:

---
name: basic-prompt
metadata:
  model:
    name: gpt-4o-mini
test_settings:
  props:
    num: 3
---
import Instructions from './instructions.mdx';

<System>
  You are a math expert
  <Instructions outputType="latex" />
</System>

<User>
  What's 2 + {props.num}?
</User>

Features

PromptDX supports:

  1. Markdown
  2. Components
  3. Custom models
  4. Custom filters
  5. Custom JSX tags
  6. Loops and Conditional

Read our docs to learn more.

Running PromptDX

You can run PromptDX using one of the following methods:

1. VSCode Extension

Install our VSCode extension to streamline your development process.

Download the VSCode Extension

2. Webpack Loader

Integrate PromptDX with your webpack workflow using our loader.

PromptDX Webpack Loader

3. Node.js

Run PromptDX directly in your Node.js environment. Below is a sample implementation:

import { bundle } from "@puzzlet/templatedx";
import { runInference } from "@puzzlet/promptdx";

const getMdxFile: ContentLoader = async (path: string) => {
  const input = fs.readFileSync(path, 'utf-8');
  return input;
}

const run = async (path: string) => {
  const mdx = await getMdxFile(path);
  const bundled = await bundle(mdx, `${basePathToMdxFile}`, getMdxFile);
  const props = { name: "Emily" };
  const result = await runInference(bundled, myProps);
}

Contributing

We welcome contributions! Please check out our contribution guidelines for more information.

Community

Join our community to collaborate, ask questions, and stay updated:

License

This project is licensed under the MIT License.

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.4

8 months ago