This repository contains a web application to interact with the Crustdata API via an AI assistant. The assistant is designed to help users understand and utilize the Crustdata Discovery and Enrichment API efficiently.
-
Crustdata API Integration:
- Explains API endpoints and functionality
- Constructs properly formatted requests
- Handles error scenarios gracefully
-
Vector Store Integration:
- Automatically uploads documentation during assistant creation
- Maintains searchable knowledge base
- Enables quick information retrieval
-
Python Code Execution:
- Custom Python executor environment included
- Ability to run and test API calls
- Secure execution environment
-
Dynamic Knowledge Base Management:
- Upload new documentation via chat interface
- Modify existing knowledge base content
- Real-time updates to vector store
-
Secure Hosting:
- Runs on port
8000 - Implements secure authentication
- Role-based access control
- Runs on port
-
Slack Bot Integration:
- Seamless workspace integration
- Channel-specific responses
- User access control
git clone https://github.com/Nikhi-l/CrustDataCopilot
cd CrustDataCopilotpip install -r requirements.txtRun the creation script:
python create-assistant.pyThis script performs the following:
- Uploads all files from
knowledge_basedirectory to vector store - Generates necessary IDs for the assistant
- Updates the
.envfile automatically - Configures initial settings
Start the application:
chainlit run app.py -wThe application will be accessible at http://localhost:8000
The application uses config.json for managing access control:
{
"users": [
{
"username": "crust",
"password": "admin",
"role": "admin"
},
{
"username": "testuser",
"password": "testpass",
"role": "user"
}
],
"allowed_users": [
"[email protected]",
"[email protected]"
],
"allowed_channels": [
"C08810KS9PA"
]
}-
Local Authentication
- Users array defines UI login credentials
- Roles can be "admin" or "user"
- Admins have additional privileges (e.g., knowledge base modification)
-
Slack Authentication
- Allowed users list controls Slack access
- Channel restrictions prevent unauthorized usage
- Email-based user identification
Install the required package:
pip install slack_bolt- Visit Slack API Dashboard
- Create new application
- Configure bot permissions
- Obtain security credentials:
- Slack Bot Token
- Slack Signing Secret
Add to .env file:
SLACK_BOT_TOKEN=your-slack-bot-token
SLACK_SIGNING_SECRET=your-slack-signing-secretUpdate your Slack app manifest with:
display_information:
name: { APP_NAME }
features:
bot_user:
display_name: { APP_NAME }
always_online: false
oauth_config:
scopes:
user:
- im:history
- channels:history
bot:
- app_mentions:read
- channels:read
- chat:write
- files:read
- files:write
- im:history
- im:read
- im:write
- users:read
- users:read.email
- channels:history
- groups:history
settings:
event_subscriptions:
request_url: https://{APP_HOST }/slack/events
bot_events:
- app_home_opened
- app_mention
- message.im
interactivity:
is_enabled: true
request_url: https://{ APP_HOST }/slack/events
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: falseTo enable DMs:
- Go to App Home in Slack settings
- Enable "Allow users to send Slash commands and messages"
-
Literal.ai Integration
- Register at Literal.ai
- Generate API key
- Add to
.env:LITERAL_API_KEY=your-literal-api-key
-
Monitoring Features
- Real-time conversation tracking
- Performance metrics dashboard
- API usage statistics
- Error monitoring
- Data export capabilities
-
Data Persistence
- Automatic conversation storage
- Historical data access
- Analytics capabilities
- Initial setup uploads all
knowledge_basedocuments - Use chat interface for updates
- Admin privileges required for modifications
- API endpoint explanations
- Request construction assistance
- Error debugging
- Feature exploration:
- Company data enrichment
- LinkedIn search
- Credit usage monitoring
- Security Notice: Environment can make external API calls
- Restricted access recommended
- Use for testing and debugging
Required .env variables:
OPENAI_API_KEY=your-openai-key
OPENAI_ASSISTANT_ID=auto-generated
OPENAI_VECTOR_STORE_ID=auto-generated
LITERAL_API_KEY=your-literal-key
SLACK_BOT_TOKEN=your-slack-token
SLACK_SIGNING_SECRET=your-slack-secret