0.0.31 • Published 5 months ago

freestyle-sandboxes v0.0.31

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Freestyle Sandboxes SDK

SDK for Freestyle Sandboxes API

Installation

npm install freestyle-sandboxes

Usage

import { FreestyleSandboxes } from "freestyle-sandboxes";

const sandboxes = new FreestyleSandboxes({
  apiKey: "your-api-key",
});

sandboxes.executeScript(
  `export default () => {
  let set1 = [1, 2, 3, 4, 5];
  let set2 = [4, 5, 6, 7, 8];

  // find the sum of every value of each set multiplied by every value of the other set

  let sum = 0;
  for (let i = 0; i < set1.length; i++) {
    for (let j = 0; j < set2.length; j++) {
      sum += set1[i] * set2[j];
    }
  }

  return sum;
};`
);

AI SDK

The freestyle-sandboxes/ai package provides utilities to add Freestyle Sandboxes to your AI.

Usage

import { executeTool } from "freestyle-sandboxes/ai";
import { generateText } from "ai";

const codeExecutor = executeTool({
  apiKey: "your-api-key",
});

const { text, steps } = await generateText({
  model: yourModel,
  tools: {
    codeExecutor,
  },
  maxSteps: 2, // allow up to 5 steps
  prompt:
    "What is the sum of every number between 1 and 12 multiplied by itself?",
});
0.0.30

5 months ago

0.0.31

5 months ago

0.0.28

5 months ago

0.0.29

5 months ago

0.0.24

5 months ago

0.0.25

5 months ago

0.0.26

5 months ago

0.0.27

5 months ago

0.0.21

6 months ago

0.0.22

6 months ago

0.0.20

6 months ago

0.0.17

6 months ago

0.0.18

6 months ago

0.0.19

6 months ago

0.0.14

7 months ago

0.0.15

7 months ago

0.0.16

7 months ago

0.0.13

7 months ago

0.0.10

7 months ago

0.0.11

7 months ago

0.0.12

7 months ago

0.0.9

7 months ago

0.0.8

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.1-4

7 months ago

0.0.1-3

7 months ago

0.0.1-2

7 months ago

0.0.1-1

7 months ago

0.0.1

7 months ago