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.
Watch our quick demo to see how Corporate Cortex transforms your organization's knowledge into actionable insights!
- Features
- Quick Start
- Prerequisites
- Installation
- Usage
- Project Structure
- Troubleshooting
- Contributing
- Support
- License
- π€ 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
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- 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
- Blaxel CLI: Ensure you have the Blaxel CLI installed. If not, install it globally:
Clone the repository and install dependencies:
git clone https://github.com/blaxel-ai/template-corporate-cortex.git
cd template-corporate-cortex
npm installConfigure environment variables:
cp .env-sample .envUpdate 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)
- Create a new cluster and copy your
- 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_MODELto your preferred embedding model (e.g., "embedding-model-openai") - Set
EMBEDDING_MODEL_TYPEto the appropriate type (e.g., "openai")
- Set
Set up knowledge base:
- Place your organizational documents in the
company-documentsdirectory - Run the knowledge base population script:
npm run fill-knowledge-base
Verify installation:
npm run buildThis command should complete without errors, confirming that TypeScript compilation and all dependencies are properly configured.
Start the development server with hot reloading:
bl serve --hotreloadFor production run:
bl serveNote: The development server automatically restarts when you make changes to the source code.
You can test your corporate cortex agent locally:
# Using the Blaxel CLI chat interface
bl chat template-corporate-cortex --localExample 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?"}'When you are ready to deploy your agent:
bl deployThis command uses your code and the configuration files under the .blaxel directory to deploy your corporate cortex agent on the Blaxel platform.
To customize the agent for your organization:
- Replace sample documents in
company-documents/with your actual organizational documents - Adjust prompts in
src/prompt.tsto match your organization's tone and style - Modify agent configuration in
src/agent.tsto customize retrieval and response generation - Update Blaxel configurations in
.blaxel/to change the agent's behavior: embedding and model used for instance - Configure embedding settings to optimize for your document types and use cases
- 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
-
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
- Ensure you're logged in to your workspace:
-
Knowledge Base Population Problems:
- Ensure documents are placed in the
company-documentsdirectory - 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
- Ensure documents are placed in the
-
Qdrant Connection Issues:
- Verify
QDRANT_URLandQDRANT_API_KEYare correct - Check that your Qdrant cluster is active and accessible
- Ensure the collection name matches your configuration
- Test connection using Qdrant's web console
- Verify
-
Node.js and TypeScript Issues:
- Make sure you have Node.js 20+
- Try
npm installto reinstall dependencies - Run
npx tsc --noEmitto check for type errors - Clear npm cache:
npm cache clean --force
-
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
- Verify embedding model configuration in
For more help, please submit an issue on GitHub.
Contributions are welcome! Here's how you can contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature
- Submit a Pull Request
Please make sure to update tests as appropriate and follow the TypeScript code style of the project.
If you need help with this template:
- Submit an issue for bug reports or feature requests
- Visit the Blaxel Documentation for platform guidance
- Check the LangChain Documentation for framework-specific help
- Check the Qdrant Documentation for vector database help
- Join our Discord Community for real-time assistance
This project is licensed under the MIT License. See the LICENSE file for more details.

