A Node.js client for Each. Each is a platform for deploying and combining machine learning models as APIs.
This library supports Each API and Each Flow API. You can use the same client to interact with both APIs.
npm install @eachlabs/aiflowCreate a new client with your API key
// CommonJS as default
const Each = require('@eachlabs/aiflow');
// ESM
import Each from '@eachlabs/aiflow';const each = new Each({
auth: process.env.EACH_API_KEY || 'YOUR_API_KEY'
});Each provides AI workflow engine to orchestrate multiple models and data sources. You can create a flow to chain multiple models and data sources together.
For more information, please refer to the Each Flow API documentation.
const flow = await each.flows.trigger("flowId", {
image: "https://example.com/image.jpg",
caption: false,
question: "",
temperature: 1,
});
// Returns the created flow execution IDconst flow = await each.flows.get("flowId");const flows = await each.flows.list();const flowExecution = await each.flows.getExecution("flowId", "executionId");const executions = await each.flows.getExecutions("flowId");const inputs = {
"image": "https://example.com/image.jpg",
"caption": false,
"question": "",
"temperature": 1
}
const prediction = await each.predictions.create({
model: 'blip-2'
version: '0.0.1',
input: inputs
});const prediction = await each.predictions.run({
model: "blip-2",
version: "0.0.1",
input: inputs,
});const prediction = await each.predictions.get("predictionId");const prediction = await each.predictions.cancel("predictionId");