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