0.2.0 • Published 9 months ago

@asterai/client v0.2.0

Weekly downloads
-
License
BUSL-1.1
Repository
github
Last release
9 months ago

@asterai/client

TypeScript/JavaScript client for asterai

Have a look at the asterai documentation here.

Examples

Query an agent and obtain a full text response back

import { AsteraiAgent } from "@asterai/client";

const agent = new AsteraiAgent({
  appId: ASTERAI_APP_ID,
  queryKey: ASTERAI_PUBLIC_QUERY_KEY,
});

const response = await agent.query({
  query: "how's the weather like in NY?"
});

console.log(await response.text());

Query an agent and obtain a response back token by token

import { AsteraiAgent } from "@asterai/client";

const agent = new AsteraiAgent({
  appId: ASTERAI_APP_ID,
  queryKey: ASTERAI_PUBLIC_QUERY_KEY,
});

const response = await agent.query({
  query: "how's the weather like in NY?"
});

let llmResponse = "";
response.onToken(token => {
  llmResponse += token;
});

response.onEnd(() => {
  // The full response has been received.
  console.log(llmResponse);
});
0.1.2

11 months ago

0.2.0

9 months ago

0.1.4

10 months ago

0.1.3

11 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.1

12 months ago

0.1.0

12 months ago