0.0.31 • Published 6 months ago
freestyle-sandboxes v0.0.31
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
6 months ago
0.0.31
6 months ago
0.0.28
6 months ago
0.0.29
6 months ago
0.0.24
6 months ago
0.0.25
6 months ago
0.0.26
6 months ago
0.0.27
6 months ago
0.0.21
7 months ago
0.0.22
7 months ago
0.0.20
7 months ago
0.0.17
7 months ago
0.0.18
7 months ago
0.0.19
7 months ago
0.0.14
7 months ago
0.0.15
7 months ago
0.0.16
7 months ago
0.0.13
8 months ago
0.0.10
8 months ago
0.0.11
8 months ago
0.0.12
8 months ago
0.0.9
8 months ago
0.0.8
8 months ago
0.0.7
8 months ago
0.0.6
8 months ago
0.0.5
8 months ago
0.0.4
8 months ago
0.0.3
8 months ago
0.0.1-4
8 months ago
0.0.1-3
8 months ago
0.0.1-2
8 months ago
0.0.1-1
8 months ago
0.0.1
8 months ago