Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

blaxel-templates/template-corporate-cortex

Repository files navigation

Blaxel Corporate Cortex Agent

Blaxel

License: MIT Node.js 20+ TypeScript LangChain Qdrant

A template implementation of a Corporate Knowledge Agent built using Blaxel SDK and LangChain. This agent serves as an expert AI assistant deeply embedded within your organization, providing accurate, contextually relevant, and actionable responses to internal inquiries regarding IT services, resources, and processes by leveraging a comprehensive knowledge base.

Corporate Cortex Agent

🎬 See It In Action

Watch Demo

Watch our quick demo to see how Corporate Cortex transforms your organization's knowledge into actionable insights!

πŸ“‘ Table of Contents

✨ Features

  • πŸ€– Enterprise knowledge management with advanced AI models
  • πŸ—„οΈ Integration with Qdrant vector database for knowledge storage
  • πŸ“š Contextual retrieval of relevant information from your knowledge base
  • πŸ” Intelligent categorization and organization of retrieved documents
  • πŸ“‹ Comprehensive understanding of your organization's:
    • IT Service Architecture
    • Ownership and Contact Information
    • Roles and Responsibilities
    • Established Processes
    • Operating Model
    • Enterprise Architecture Design Guidelines
  • 🎯 Sophisticated retrieval and response generation system
  • πŸ“„ Document chunking and embedding for optimal retrieval
  • πŸ”§ Customizable prompts and agent behavior

πŸš€ Quick Start

For those who want to get up and running quickly:

# Clone the repository
git clone https://github.com/blaxel-ai/template-corporate-cortex.git

# Navigate to the project directory
cd template-corporate-cortex

# Install dependencies
npm install

# Configure environment variables
cp .env-sample .env
# Edit .env with your Qdrant, OpenAI, and Exa API credentials

# Populate the knowledge base
npm run fill-knowledge-base

# Start the server
bl serve --hotreload

# In another terminal, test the agent
bl chat template-corporate-cortex --local

πŸ“‹ Prerequisites

  • Node.js: 20.0 or later
  • NPM: Node package manager
  • Qdrant Account: Sign up for a free account at Qdrant Cloud
  • Exa API Key: Visit Exa.ai and create an account for search capabilities
  • Blaxel Platform Setup: Complete Blaxel setup by following the quickstart guide
    • Blaxel CLI: Ensure you have the Blaxel CLI installed. If not, install it globally:
      curl -fsSL https://raw.githubusercontent.com/blaxel-ai/toolkit/main/install.sh | BINDIR=/usr/local/bin sudo -E sh
    • Blaxel login: Login to Blaxel platform
      bl login YOUR-WORKSPACE

πŸ’» Installation

Clone the repository and install dependencies:

git clone https://github.com/blaxel-ai/template-corporate-cortex.git
cd template-corporate-cortex
npm install

Configure environment variables:

cp .env-sample .env

Update the following values with your own credentials:

  • Qdrant configuration:
    • Create a new cluster and copy your QDRANT_URL
    • Generate an API key from your cluster settings for QDRANT_API_KEY
    • Choose a name for your collection (QDRANT_COLLECTION_NAME)
  • Exa API key:
    • Create an account and subscribe to a plan
    • Generate an API key from your dashboard for EXA_API_KEY
  • Embedding model configuration:
    • Set EMBEDDING_MODEL to your preferred embedding model (e.g., "embedding-model-openai")
    • Set EMBEDDING_MODEL_TYPE to the appropriate type (e.g., "openai")

Set up knowledge base:

  1. Place your organizational documents in the company-documents directory
  2. Run the knowledge base population script:
    npm run fill-knowledge-base

Verify installation:

npm run build

This command should complete without errors, confirming that TypeScript compilation and all dependencies are properly configured.

πŸ”§ Usage

Running Locally

Start the development server with hot reloading:

bl serve --hotreload

For production run:

bl serve

Note: The development server automatically restarts when you make changes to the source code.

Testing

You can test your corporate cortex agent locally:

# Using the Blaxel CLI chat interface
bl chat template-corporate-cortex --local

Example inquiries to test:

Can we buy tool XY for our department?
What is the process for requesting additional resources for project Z?
Who is responsible for managing our cloud infrastructure?
What is our incident management process?

You can also run it directly with specific input:

bl run agent template-corporate-cortex --local --data '{"input": "What is our IT service architecture?"}'

Deployment

When you are ready to deploy your agent:

bl deploy

This command uses your code and the configuration files under the .blaxel directory to deploy your corporate cortex agent on the Blaxel platform.

πŸ› οΈ Customization

To customize the agent for your organization:

  1. Replace sample documents in company-documents/ with your actual organizational documents
  2. Adjust prompts in src/prompt.ts to match your organization's tone and style
  3. Modify agent configuration in src/agent.ts to customize retrieval and response generation
  4. Update Blaxel configurations in .blaxel/ to change the agent's behavior: embedding and model used for instance
  5. Configure embedding settings to optimize for your document types and use cases

πŸ“ Project Structure

  • src/ - Source code directory
    • agent.ts - Main agent configuration and request handling
    • prompt.ts - System and user prompt templates
    • knowledgebase.ts - Knowledge base integration with Qdrant
    • embeddings.ts - Embedding model configuration
    • error.ts - Error handling utilities
    • functions/ - Custom functions for the agent
  • .blaxel/ - Blaxel configuration directory
    • agents/ - Agent configurations
    • functions/ - Function definitions
    • models/ - Model configurations
  • company-documents/ - Sample organizational documents
  • fillKnowledgeBase.ts - Script to populate the knowledge base
  • index.ts - Application entry point
  • package.json - Node.js package configuration with scripts and dependencies
  • tsconfig.json - TypeScript configuration
  • blaxel.toml - Blaxel deployment configuration
  • .env-sample - Environment variables template
  • LICENSE - MIT license file

❓ Troubleshooting

Common Issues

  1. Blaxel Platform Issues:

    • Ensure you're logged in to your workspace: bl login MY-WORKSPACE
    • Verify models are available: bl get models
    • Check that functions exist: bl get functions
  2. Knowledge Base Population Problems:

    • Ensure documents are placed in the company-documents directory
    • Check that all API keys are correctly configured in .env
    • Verify Qdrant cluster is accessible and running
    • Monitor the fill-knowledge-base script output for errors
  3. Qdrant Connection Issues:

    • Verify QDRANT_URL and QDRANT_API_KEY are correct
    • Check that your Qdrant cluster is active and accessible
    • Ensure the collection name matches your configuration
    • Test connection using Qdrant's web console
  4. Node.js and TypeScript Issues:

    • Make sure you have Node.js 20+
    • Try npm install to reinstall dependencies
    • Run npx tsc --noEmit to check for type errors
    • Clear npm cache: npm cache clean --force
  5. Embedding and Retrieval Issues:

    • Verify embedding model configuration in .env
    • Check that the specified model is available through Blaxel
    • Monitor embedding generation during knowledge base population
    • Ensure embedding dimensions match Qdrant collection configuration

For more help, please submit an issue on GitHub.

πŸ‘₯ Contributing

Contributions are welcome! Here's how you can contribute:

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/amazing-feature
  3. Commit your changes:
    git commit -m 'Add amazing feature'
  4. Push to the branch:
    git push origin feature/amazing-feature
  5. Submit a Pull Request

Please make sure to update tests as appropriate and follow the TypeScript code style of the project.

πŸ†˜ Support

If you need help with this template:

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

This repository is a template implementation of a Corporate Knowledge Agent using the Blaxel SDK and LangChain.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors