@belarabyai/baseai
v1.0.2
Published
BaseAI SDK for TypeScript/JavaScript
Maintainers
Readme
BaseAI TypeScript/JavaScript SDK
TypeScript/JavaScript SDK for the BaseAI platform.
Installation
npm install @belarabyai/baseai📦 Published on npm: https://www.npmjs.com/package/@belarabyai/baseai
Or with yarn:
yarn add @belarabyai/baseaiQuick Start
import { BaseAI } from '@belarabyai/baseai';
import { BaseAITool } from '@belarabyai/baseai';
async function main() {
const apiKey = process.env.BASEAI_API_KEY;
if (!apiKey) {
throw new Error('Please set BASEAI_API_KEY environment variable');
}
const client = new BaseAI({
apiKey,
apiUrl: 'https://a2abase.ai/api',
});
const thread = await client.Thread.create();
const agent = await client.Agent.create({
name: 'My Assistant',
systemPrompt: 'You are a helpful AI assistant.',
mcpTools: [BaseAITool.WEB_SEARCH_TOOL],
});
const run = await agent.run('Hello, how are you?', thread);
const stream = await run.getStream();
for await (const chunk of stream) {
process.stdout.write(chunk);
}
}
main();Building
npm run buildExamples
Comprehensive examples are available in the example/ directory, demonstrating:
- Tool-Specific Examples: Each tool from
BaseAIToolenum with practical use cases - Common Use Cases: Real-world scenarios like research, content creation, automation, and more
See the examples README for a complete list of available examples.
To run an example:
export BASEAI_API_KEY="pk_xxx:sk_xxx"
npm run build
node dist/example/customer_support_triage.jsRunning Examples in Notebooks
Google Colab primarily supports Python, but you can use TypeScript in other notebook environments:
Option 1: Observable Notebooks
- Go to Observable
- Create a new notebook
- Install the SDK:
npm install @belarabyai/baseai - Copy example code from the
example/directory
Option 2: Jupyter Notebooks with JavaScript kernel
- Install:
npm install -g ijavascript - Install kernel:
jupyter kernelspec install --name javascript --user - Start Jupyter:
jupyter notebook - Create a new JavaScript notebook
- Copy example code from the
example/directory
Available Tools
The SDK provides access to various tools through the BaseAITool enum:
- File Management:
FILES_TOOL,UPLOAD_FILE_TOOL - Development:
SHELL_TOOL,WEB_DEV_TOOL,DEPLOY_TOOL,EXPOSE_TOOL - Image Tools:
VISION_TOOL,IMAGE_SEARCH_TOOL,IMAGE_EDIT_TOOL - Content Creation:
DOCS_TOOL,SHEETS_TOOL,PRESENTATION_TOOL,PRESENTATION_OUTLINE_TOOL,DESIGN_TOOL - Knowledge & Data:
KB_TOOL,DATA_PROVIDERS_TOOL - Search & Browser:
WEB_SEARCH_TOOL,BROWSER_TOOL
Documentation
- npm Package: https://www.npmjs.com/package/@belarabyai/baseai
- GitHub Repository: https://github.com/A2ABaseAI/sdks
- Full Documentation: See the repository for more examples and API reference.
💬 Support
Need help? Join our Discord community for support and discussions:
- Discord: https://discord.gg/qAncfHmYUm
