0.0.31 • Published 11 months ago
freestyle-sandboxes v0.0.31
Freestyle Sandboxes SDK
SDK for Freestyle Sandboxes API
Installation
npm install freestyle-sandboxesUsage
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
11 months ago
0.0.31
11 months ago
0.0.28
11 months ago
0.0.29
11 months ago
0.0.24
11 months ago
0.0.25
11 months ago
0.0.26
11 months ago
0.0.27
11 months ago
0.0.21
12 months ago
0.0.22
12 months ago
0.0.20
12 months ago
0.0.17
12 months ago
0.0.18
12 months ago
0.0.19
12 months ago
0.0.14
1 year ago
0.0.15
1 year ago
0.0.16
1 year ago
0.0.13
1 year ago
0.0.10
1 year ago
0.0.11
1 year ago
0.0.12
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.3
1 year ago
0.0.1-4
1 year ago
0.0.1-3
1 year ago
0.0.1-2
1 year ago
0.0.1-1
1 year ago
0.0.1
1 year ago