TypeScript/JavaScript client for asterai
Have a look at the asterai documentation here.
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());
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);
});