workflowAI typed API client
Wrapper for workflowAI's OpenAPI specs, for node or browser
Install
npm install @workflowai/api
If using this library in a node project, you'll need to globally polyfill fetch
:
npm install node-fetch
import '@workflowai/api/fetch-polyfill'
Initialize API
import { initWorkflowAIApi } from '@workflowai/api'
const workflowAIApi = initWorkflowAIApi({
apiKey: '...',
apiUrl: '...',
use: [],
})
Call endpoints
const { data: list } = await workflowAIApi.models.list()
console.log(list.models[0].providers[0].name)
const { data: run } = await workflowaiApi.runs.annotate({
run_id: '1',
score: 1,
})
console.log(run.scores)