0.4.2 • Published 3 months ago

alith v0.4.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 months ago

Alith Node SDK

Installation

  • Install alith dependency
npm install alith
# Or use pnpm `pnpm install alith`
# Or use yarn `yarn install alith`
  • Install the json-schema dependency
npm i --save-dev @types/json-schema
# Or use pnpm `pnpm install --save-dev @types/json-schema`
# Or use yarn `yarn install --save-dev @types/json-schema`

Quick Start

  • Simple Agent
import { Agent } from "alith";

const agent = new Agent({
  name: "A dummy Agent",
  model: "gpt-4o-mini",
  preamble:
    "You are a calculator here to help the user perform arithmetic operations. Use the tools provided to answer the user question.",
});
console.log(agent.prompt("Calculate 10 - 3"));
  • Agent with Tools
import { Agent } from "alith";

const agent = new Agent({
  name: "A dummy Agent",
  model: "gpt-4o-mini",
  preamble:
    "You are a calculator here to help the user perform arithmetic operations. Use the tools provided to answer the user question.",
  tools: [
    {
      name: "subtract",
      description: "Subtract y from x (i.e.: x - y)",
      parameters: JSON.stringify({
        type: "object",
        properties: {
          x: {
            type: "number",
            description: "The number to substract from",
          },
          y: {
            type: "number",
            description: "The number to substract",
          },
        },
      }),
      handler: (x, y) => {
        return x - y;
      },
    },
  ],
});
console.log(agent.prompt("Calculate 10 - 3"));

Examples

See here for more examples.

Developing

  • Install node.js
  • Install cargo (for Rust code)

Install dependencies

npm install

Building

npm run build

Testing

npm test

Format

npm run format
0.4.1

3 months ago

0.4.2

3 months ago

0.4.0

3 months ago

0.3.0

4 months ago

0.2.5

4 months ago

0.2.1

4 months ago

0.2.4

4 months ago

0.2.0

5 months ago

0.1.0

5 months ago