Overview
The@databite/ai
package provides intelligent connector generation capabilities that automatically create connectors from API documentation using advanced AI models. It includes documentation crawling, AI analysis, and code generation features.
Installation
Features
Intelligent Documentation Crawling
- Multi-page Crawling: Automatically discover and crawl related documentation pages
- Content Extraction: Clean HTML to Markdown conversion for better AI processing
- Link Discovery: Follow internal documentation links to build comprehensive understanding
- Configurable Depth: Control how deep the crawler goes into documentation
AI-Powered Analysis
- API Structure Recognition: Automatically identify authentication methods, endpoints, and data schemas
- Action Generation: Extract CRUD operations and transform them into connector actions
- Sync Detection: Identify list/fetch operations for data synchronization
- Schema Inference: Generate Zod schemas for input/output validation
- Authentication Flow: Create appropriate authentication flows (OAuth2, API Key, Basic Auth)
Code Generation
- Complete Connector Files: Generate full connector implementations
- Type-Safe Schemas: Create Zod schemas for all configurations and data structures
- Action Implementations: Generate action handlers with proper error handling
- Sync Implementations: Create sync handlers for data synchronization
- Documentation: Auto-generate README files with usage examples
Quick Start
CLI Usage
Programmatic Usage
API Reference
Core Functions
generateConnector(options: GeneratorOptions)
Main function to generate a connector from documentation.
crawlDocumentation(startUrl: string, maxDepth?: number)
Crawl documentation from a starting URL.
analyzeDocumentation(docs: DocumentationCrawlResult, options: AnalyzerOptions)
Analyze crawled documentation using AI.
Generated Connector Structure
The AI generator creates a complete connector with the following structure:AI Provider Configuration
OpenAI
Anthropic
Google AI
CLI Commands
Generate Connector
Examples
Advanced Usage
Custom AI Models
Crawling Configuration
Selective Generation
Generated Code Examples
Connector Definition
Generated Action
Testing Generated Connectors
Manual Testing
Automated Testing
Troubleshooting
Common Issues
Crawling Failures
Crawling Failures
Increase timeout and retry, or reduce crawl depth if the documentation is
complex.
AI Analysis Errors
AI Analysis Errors
Try different AI providers or models if analysis fails.
Generated Code Issues
Generated Code Issues
Review and manually fix generated code - the AI generates working templates
that may need customization.
Debug Mode
Best Practices
1. Choose the Right AI Provider
2. Optimize Crawling Depth
3. Review and Customize Generated Code
4. Test Thoroughly
Related Packages
- @databite/build - Core connector builder SDK
- @databite/flow - Flow engine for authentication workflows
- @databite/types - Shared TypeScript types
- @databite/connectors - Pre-built connector library