Skip to main content

Knowledge Sources

Learn how to connect and manage various knowledge sources in Gentic. This guide covers different types of knowledge sources, their configuration, and best practices for integration.

Types of Knowledge Sources

1. File Collections

File collections allow you to upload and manage multiple files as a knowledge source.

// Create a file collection
const fileCollection = await client.createKnowledgeSource({
name: 'Product Documentation',
type: 'file-collection',
files: [
{
path: 'product-specs.pdf',
content: '...'
},
{
path: 'user-guide.md',
content: '...'
}
]
});

Supported file types:

  • PDF documents
  • Markdown files
  • Text files
  • HTML files
  • Word documents
  • Excel spreadsheets

2. Knowledge Bases

Knowledge bases are structured collections of information.

// Create a knowledge base
const knowledgeBase = await client.createKnowledgeSource({
name: 'FAQ Database',
type: 'knowledge-base',
entries: [
{
question: 'How do I reset my password?',
answer: 'To reset your password...',
tags: ['authentication', 'account']
}
]
});

3. Knowledge Graphs

Knowledge graphs represent information as interconnected entities.

// Create a knowledge graph
const knowledgeGraph = await client.createKnowledgeSource({
name: 'Product Knowledge Graph',
type: 'knowledge-graph',
nodes: [
{
id: 'product-1',
type: 'product',
properties: {
name: 'Product A',
category: 'Software'
}
}
],
edges: [
{
source: 'product-1',
target: 'category-1',
type: 'belongs_to'
}
]
});

Managing Knowledge Sources

Updating Content

// Update file collection
await client.updateKnowledgeSource(fileCollectionId, {
files: [
{
path: 'new-document.pdf',
content: '...'
}
]
});

// Update knowledge base
await client.updateKnowledgeSource(knowledgeBaseId, {
entries: [
{
question: 'New FAQ',
answer: 'New answer',
tags: ['new']
}
]
});

// Update knowledge graph
await client.updateKnowledgeSource(knowledgeGraphId, {
nodes: [
{
id: 'new-node',
type: 'product',
properties: {
name: 'New Product'
}
}
]
});

Version Control

// Create a new version
const newVersion = await client.createKnowledgeSourceVersion(knowledgeSourceId);

// Rollback to previous version
await client.rollbackKnowledgeSource(knowledgeSourceId, versionId);

Knowledge Source Integration

Connecting to Agents

// Connect knowledge source to agent
await client.connectKnowledgeSource(agentId, knowledgeSourceId);

// Configure access settings
await client.updateKnowledgeSourceAccess(agentId, knowledgeSourceId, {
accessLevel: 'read',
priority: 1,
refreshInterval: '1h'
});

Search Configuration

// Configure search settings
await client.updateKnowledgeSource(knowledgeSourceId, {
searchSettings: {
embeddingModel: 'text-embedding-ada-002',
chunkSize: 1000,
chunkOverlap: 200,
indexType: 'vector'
}
});

Best Practices

  1. Organize Content: Structure your knowledge sources logically
  2. Regular Updates: Keep knowledge sources current and relevant
  3. Quality Control: Ensure accuracy and completeness of information
  4. Version Management: Use version control for important changes
  5. Access Control: Configure appropriate access levels for different agents

Integration Examples

Customer Support Knowledge Base

// Create a customer support knowledge base
const supportKB = await client.createKnowledgeSource({
name: 'Customer Support KB',
type: 'knowledge-base',
entries: [
{
question: 'How do I contact support?',
answer: 'You can reach our support team at...',
tags: ['support', 'contact']
}
]
});

// Connect to support agent
await client.connectKnowledgeSource(supportAgentId, supportKB.id);

Product Documentation Graph

// Create a product documentation graph
const productGraph = await client.createKnowledgeSource({
name: 'Product Documentation',
type: 'knowledge-graph',
nodes: [
{
id: 'feature-1',
type: 'feature',
properties: {
name: 'Feature A',
description: '...'
}
}
],
edges: [
{
source: 'feature-1',
target: 'product-1',
type: 'part_of'
}
]
});

Next Steps