Skip to main content

Integrations

Gentic supports integration with various knowledge sources and external services. This section covers the available integrations and how to use them.

Knowledge Source Integrations

File Storage

AWS S3

const s3Source = await client.createKnowledgeSource({
name: 'S3 Documents',
type: 's3',
config: {
bucket: 'my-documents',
region: 'us-east-1',
accessKeyId: 'your-access-key',
secretAccessKey: 'your-secret-key'
}
});

Google Drive

const driveSource = await client.createKnowledgeSource({
name: 'Google Drive',
type: 'google-drive',
config: {
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
refreshToken: 'your-refresh-token'
}
});

Databases

PostgreSQL

const pgSource = await client.createKnowledgeSource({
name: 'PostgreSQL DB',
type: 'postgresql',
config: {
host: 'localhost',
port: 5432,
database: 'mydb',
user: 'user',
password: 'password'
}
});

MongoDB

const mongoSource = await client.createKnowledgeSource({
name: 'MongoDB',
type: 'mongodb',
config: {
uri: 'mongodb://localhost:27017',
database: 'mydb',
collection: 'mycollection'
}
});

APIs

REST APIs

const apiSource = await client.createKnowledgeSource({
name: 'REST API',
type: 'rest',
config: {
baseUrl: 'https://api.example.com',
headers: {
'Authorization': 'Bearer token'
}
}
});

GraphQL APIs

const graphqlSource = await client.createKnowledgeSource({
name: 'GraphQL API',
type: 'graphql',
config: {
endpoint: 'https://api.example.com/graphql',
headers: {
'Authorization': 'Bearer token'
}
}
});

Workflow Integrations

External Services

Slack

const slackWorkflow = await client.createWorkflow({
name: 'Slack Notification',
steps: [
{
type: 'slack',
config: {
token: 'your-slack-token',
channel: 'notifications'
},
message: 'New task completed: {{task_name}}'
}
]
});

Email

const emailWorkflow = await client.createWorkflow({
name: 'Email Notification',
steps: [
{
type: 'email',
config: {
smtp: {
host: 'smtp.example.com',
port: 587,
auth: {
user: 'user',
pass: 'password'
}
}
},
to: 'recipient@example.com',
subject: 'Task Update',
body: 'Task {{task_name}} has been completed'
}
]
});

Cloud Services

AWS Lambda

const lambdaWorkflow = await client.createWorkflow({
name: 'AWS Lambda',
steps: [
{
type: 'aws-lambda',
config: {
functionName: 'my-function',
region: 'us-east-1',
credentials: {
accessKeyId: 'your-access-key',
secretAccessKey: 'your-secret-key'
}
},
payload: {
task: '{{task_name}}'
}
}
]
});

Google Cloud Functions

const gcfWorkflow = await client.createWorkflow({
name: 'Google Cloud Function',
steps: [
{
type: 'google-cloud-function',
config: {
functionName: 'my-function',
projectId: 'my-project',
region: 'us-central1',
credentials: 'path-to-credentials.json'
},
data: {
task: '{{task_name}}'
}
}
]
});

Custom Integrations

Creating Custom Integrations

You can create custom integrations by implementing the appropriate interfaces:

interface CustomKnowledgeSource {
name: string;
type: string;
config: Record<string, any>;
fetchData(): Promise<any>;
}

interface CustomWorkflowStep {
type: string;
config: Record<string, any>;
execute(input: any): Promise<any>;
}

Example Custom Integration

class CustomAPISource implements CustomKnowledgeSource {
constructor(private config: { url: string; apiKey: string }) {}

async fetchData() {
const response = await fetch(this.config.url, {
headers: {
'Authorization': `Bearer ${this.config.apiKey}`
}
});
return response.json();
}
}

// Register the custom integration
client.registerCustomIntegration('custom-api', CustomAPISource);

Best Practices

  1. Secure Credentials: Use environment variables or secure storage for sensitive credentials
  2. Error Handling: Implement proper error handling for integration failures
  3. Rate Limiting: Respect API rate limits and implement retry logic
  4. Monitoring: Monitor integration performance and errors
  5. Testing: Test integrations thoroughly before deployment

Next Steps