0.0.14 • Published 9 months ago

xmllm v0.0.14

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

xmllm: XML-based Language Model Pipeline

xmllm is a tool for creating LLM-driven pipelines.

From me (the creator): I have found it useful in creating multi-'agent' LLM instantiations to solve more complex problems, where a single completion doesn't get the required results. LLMs suffer a lot from tunnel vision, so I've found it useful to break up tasks and do refinement/distillation loops to get to a final product. This library is my attempt at ~standardizing (for myself initially) this approach.

Features

  • Multi-step pipeline with native generator support (uses streamops)
  • Reliable XML-based schema with prompting, parsing and mapping included

Installation

npm install xmllm

Quick Start

E.g.

const xmllm = require('xmllm');

(async () => {
  const results = await xmllm(({ prompt }) => [
    prompt(
      'List three popular programming languages.',
      {
        language: [{
          name: String,
          type: String
        }]
      }
    )
  ]);

  console.log(results);
})();

This might output:

[
  {
    "language": [
      {
        "name": "Python",
        "type": "Interpreted"
      },
      {
        "name": "JavaScript",
        "type": "Interpreted"
      },
      {
        "name": "Java",
        "type": "Compiled"
      }
    ]
  }
]

Example

This example shows how to use xmllm for a multi-step analysis of a topic:

const xmllm = require('xmllm');

(async () => {
  const results = await xmllm(({ prompt }) => [
    function* () {
      yield "Artificial Intelligence";
    },
    prompt(
      topic => `Provide three subtopics for "${topic}" from different perspectives: scientific, social, and economic.`,
      {
        subtopic: [{
          perspective: String,
          title: String
        }]
      }
    ),
    prompt(
      (thing) => {
        const { subtopic: [{ perspective, title }] } = thing;
        return `Give a brief explanation of "${title}" from a ${perspective} perspective, and suggest one potential future development.`;
      },
      {
        explanation: String,
        future_development: String
      }
    )
  ]);

  console.log(results);
})();
0.0.10

10 months ago

0.0.11

10 months ago

0.0.12

10 months ago

0.0.13

10 months ago

0.0.14

9 months ago

0.0.3

11 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.2

11 months ago

0.0.1

11 months ago