AI Stack for AI Engineers
AI Stack simplifies the creation and management of AI agents using the Langbase SDK.
npm install ai-stack
pnpm install ai-stack
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();
β― 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.
- MIT Β© Ahmad Awais
- Code of Conduct