@fp32ai/client
v0.8.0
Published
```js import { getClient, Api } from '@fp32ai/client'; import type { ApiSecurity } from '@fp32ai/client';
Downloads
1
Readme
TypeScript Client
import { getClient, Api } from '@fp32ai/client';
import type { ApiSecurity } from '@fp32ai/client';
// if no security options provided, expects environment variable `FP32AI_KEY` to be set
const api = getClient();
// same as
// const api = getClient({ bearer: process.env.FP32AI_KEY });
// do not provide `name` if you want name to be randomly generated
const { index } = await api.index.createIndex({ name: 'test', dims: 10 }).then(result => result.data);
const { vectors } = await api.vector.upsertVectors({ index: index.name, vectors: [{
vector: Array.from({ length: 10 }, (_, i) => i)
}]}).then(result => result.data);
// must delete vectors before deleting an index
await api.vector.deleteVectors({ index: index.name, vectors }).then(result => result.data);
await api.index.deleteIndex({ index: index.name }).then(result => result.data);
const { indexes } = await api.index.listIndexes({}).then(result => result.data);