Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
This is the Typescript implementation of ForumAI SDK
This SDK is available on npm
registry, so you can easily install it using npm
, yarn
or any other package manager
tool
npm install forumaisdk
cjs
const forumaisdk = require('forumaisdk');
const ModelMarket = forumaisdk.ModelMarket;
esm
import { ModelMarket } from 'forumaisdk';
There is two modes of using the SDK to interact with the ForumAI LLM node:
No response streaming
With this mode you will get response of your chat at once. Sample code looks like bellow
const privateKey = process.env.PRIVATE_KEY;
if (!privateKey) {
throw new Error('Private key is not provided via env PRIVATE_KEY');
}
const model = new ModelMarket.Mixtral8x7BModelMarketTestnet(privateKey);
const chat = [{ role: 'system', content: 'You are a helpful assistant!' }];
while (true) {
const prompt = await askQuestion('[INFO] Enter your prompt: ');
if (['q', 'quit', 'exit'].includes(prompt)) {
console.log('[INFO] Chat finished');
break;
}
chat.push({ role: 'user', content: prompt });
console.log('[INFO] Wait for response ...');
const resp = await model.generate(3000, chat);
console.log('[INFO] Response:\n', resp);
chat.push({ role: 'assistant', content: resp });
}
Full sample code you can found here simple-chat
Response streaming
With this mode you will get response of your chat in stream. Sample code looks like bellow
const privateKey = process.env.PRIVATE_KEY;
if (!privateKey) {
throw new Error('Private key is not provided via env PRIVATE_KEY');
}
const model = new ModelMarket.Mixtral8x7BModelMarketTestnet(privateKey);
const chat = [{ role: 'system', content: 'You are a helpful assistant!' }];
while (true) {
const prompt = await askQuestion('[INFO] Enter your prompt: ');
if (['q', 'quit', 'exit'].includes(prompt)) {
console.log('[INFO] Chat finished');
break;
}
chat.push({ role: 'user', content: prompt });
console.log('[INFO] Wait for response ...');
const [node_url, result_code] = await model.generateSelfRequesting(3000, chat);
let full_resp = '';
let done = false;
console.log('[INFO] Response:\n');
while (!done) {
const [resp, _done] = await model.getNextOutput(node_url, result_code, full_resp);
full_resp += resp;
done = _done;
logWithoutEndLine(resp);
await sleep(100);
}
logWithoutEndLine('\n');
chat.push({ role: 'assistant', content: full_resp });
}
Full sample code you can found here streamed-chat
FAQs
ForumAI NodeJS SDK
The npm package forumaisdk receives a total of 0 weekly downloads. As such, forumaisdk popularity was classified as not popular.
We found that forumaisdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.