0.0.1 • Published 5 months ago

create-ai-stack v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

ai-stack

DOWNLOADS Node.js CLI Learn VSCode Sponsor Follow @MrAhmadAwais on Twitter

AI Stack for AI Engineers

AI Stack simplifies the creation and management of AI agents using the Langbase SDK.

📟

Install

npm install ai-stack
pnpm install ai-stack

⚙️

Usage

Full documentation is available at Langbase SDK. First, set up your environment variables by creating a .env file in your project root:

LANGBASE_API_KEY=your_api_key_here

Replace your_api_key_here with your actual Langbase API key.

Then, use the package in your project:

import {
createAgent,
runAgent,
createMemory,
uploadDocument,
retrieveMemory,
} from 'ai-stack';

const agentConfig = {
name: 'MyAgent',
description: 'An AI agent for processing data',
// Add other configuration details as needed
};

async function main() {
// Create an agent
const agent = await createAgent(agentConfig);

// Run the agent
const response = await runAgent(agent.name, [
	{ role: 'user', content: 'Your input here' },
]);
console.log('Agent response:', response);

// Create a memory
const memory = await createMemory({
	name: 'knowledge-base',
	description: 'A memory for storing documents',
});

// Upload a document to memory
await uploadDocument('knowledge-base', {
	contentType: 'application/pdf',
	documentName: 'example-doc.pdf',
	document: fs.readFileSync('path/to/document.pdf'),
	meta: {
	author: 'Author Name',
	url: 'https://example.com/document.pdf',
	},
});

// Retrieve information from memory
const results = await retrieveMemory('knowledge-base', 'Your query here');
console.log('Memory retrieval results:', results);
}

main();

📝

Changelog

❯ Read the changelog here →

KEY: 📦 NEW, 👌 IMPROVE, 🐛 FIX, 📖 DOC, 🚀 RELEASE, and 🤖 TEST

I use Emoji-log, you should try it and simplify your git commits.

📃

License & Conduct

🙌

Connect

0.0.1

5 months ago