Create database schemas for storing and managing knowledge data in AI applications. Use GibsonAI's natural language database management to set up structured data storage for documents, metadata, and knowledge bases.
How it works
GibsonAI provides database schema creation capabilities for AI knowledge management systems. While it doesn't provide vector storage or embeddings, it can create structured databases to store document metadata, knowledge base information, and other structured data that supports AI applications.
MCP Server Integration
Connect to AI tools through MCP server integration
Database Management
Explore database management features
Connect Your App
Connect your AI application to GibsonAI
Key Features
Document Metadata Storage
- Document Information: Store document titles, descriptions, and metadata
- Content Organization: Organize documents by categories and topics
- Version Tracking: Track document versions and updates
- Access Control: Manage document access and permissions
Knowledge Base Management
- Structured Data: Store knowledge base information in structured format
- Relationships: Define relationships between knowledge entities
- Search Metadata: Store metadata to support search functionality
- Content References: Maintain references to external content
AI Application Support
- Natural Language Queries: Query knowledge data using natural language
- REST APIs: Auto-generated APIs for knowledge data access
- Integration Support: Easy integration with AI applications
- Flexible Schema: Adapt schema to different knowledge management needs
Implementation Examples
Creating Knowledge Base Schema
# Using Gibson CLI to create knowledge base schema
# Create document management tables
# gibson modify documents "Create documents table with id, title, description, content_type, file_path, category, created_at, updated_at"
# gibson modify document_metadata "Create document_metadata table with id, document_id, metadata_key, metadata_value"
# gibson modify categories "Create categories table with id, name, description, parent_id"
# gibson modify tags "Create tags table with id, name, description, color"
# gibson modify document_tags "Create document_tags table with id, document_id, tag_id"
# Generate models and deploy
# gibson code models
# gibson merge
Document Management System
import requests
from datetime import datetime
class DocumentManager:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = "https://api.gibsonai.com/v1/-"
self.headers = {"Authorization": f"Bearer {api_key}"}
def create_document(self, title, description, content_type, file_path, category_id):
"""Create a new document record"""
document_data = {
"title": title,
"description": description,
"content_type": content_type,
"file_path": file_path,
"category": category_id,
"created_at": datetime.now().isoformat(),
"updated_at": datetime.now().isoformat()
}
response = requests.post(
f"{self.base_url}/documents",
json=document_data,
headers=self.headers
)
if response.status_code == 201:
document = response.json()
print(f"Document created: {title}")
return document
else:
print(f"Failed to create document: {response.status_code}")
return None
def add_document_metadata(self, document_id, metadata_key, metadata_value):
"""Add metadata to a document"""
metadata_data = {
"document_id": document_id,
"metadata_key": metadata_key,
"metadata_value": metadata_value
}
response = requests.post(
f"{self.base_url}/document-metadata",
json=metadata_data,
headers=self.headers
)
if response.status_code == 201:
print(f"Metadata added: {metadata_key} = {metadata_value}")
return response.json()
else:
print(f"Failed to add metadata: {response.status_code}")
return None
def tag_document(self, document_id, tag_id):
"""Tag a document"""
tag_data = {
"document_id": document_id,
"tag_id": tag_id
}
response = requests.post(
f"{self.base_url}/document-tags",
json=tag_data,
headers=self.headers
)
if response.status_code == 201:
print(f"Document tagged successfully")
return response.json()
else:
print(f"Failed to tag document: {response.status_code}")
return None
def search_documents(self, query):
"""Search documents using natural language"""
search_request = {
"query": query
}
response = requests.post(
f"{self.base_url}/query",
json=search_request,
headers=self.headers
)
if response.status_code == 200:
results = response.json()
print(f"Found {len(results)} documents")
return results
else:
print(f"Search failed: {response.status_code}")
return None
Knowledge Base Schema for AI Applications
# Create comprehensive knowledge base schema
# gibson modify knowledge_items "Create knowledge_items table with id, title, content_summary, source_type, source_reference, topic, created_at"
# gibson modify knowledge_relationships "Create knowledge_relationships table with id, source_item_id, target_item_id, relationship_type, strength"
# gibson modify topics "Create topics table with id, name, description, parent_topic_id"
# gibson modify content_sources "Create content_sources table with id, name, type, url, last_updated, status"
# gibson modify search_metadata "Create search_metadata table with id, knowledge_item_id, keywords, summary, relevance_score"
# Generate models and deploy
# gibson code models
# gibson merge
AI Application Integration
class AIKnowledgeManager:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = "https://api.gibsonai.com/v1/-"
self.headers = {"Authorization": f"Bearer {api_key}"}
def store_knowledge_item(self, title, content_summary, source_type, source_reference, topic):
"""Store a knowledge item"""
knowledge_data = {
"title": title,
"content_summary": content_summary,
"source_type": source_type,
"source_reference": source_reference,
"topic": topic,
"created_at": datetime.now().isoformat()
}
response = requests.post(
f"{self.base_url}/knowledge-items",
json=knowledge_data,
headers=self.headers
)
if response.status_code == 201:
knowledge_item = response.json()
print(f"Knowledge item stored: {title}")
return knowledge_item
else:
print(f"Failed to store knowledge item: {response.status_code}")
return None
def create_knowledge_relationship(self, source_item_id, target_item_id, relationship_type, strength=1.0):
"""Create relationship between knowledge items"""
relationship_data = {
"source_item_id": source_item_id,
"target_item_id": target_item_id,
"relationship_type": relationship_type,
"strength": strength
}
response = requests.post(
f"{self.base_url}/knowledge-relationships",
json=relationship_data,
headers=self.headers
)
if response.status_code == 201:
print(f"Relationship created: {relationship_type}")
return response.json()
else:
print(f"Failed to create relationship: {response.status_code}")
return None
def add_search_metadata(self, knowledge_item_id, keywords, summary, relevance_score):
"""Add search metadata to knowledge item"""
metadata_data = {
"knowledge_item_id": knowledge_item_id,
"keywords": keywords,
"summary": summary,
"relevance_score": relevance_score
}
response = requests.post(
f"{self.base_url}/search-metadata",
json=metadata_data,
headers=self.headers
)
if response.status_code == 201:
print("Search metadata added")
return response.json()
else:
print(f"Failed to add search metadata: {response.status_code}")
return None
def query_knowledge_base(self, query):
"""Query knowledge base using natural language"""
query_request = {
"query": query
}
response = requests.post(
f"{self.base_url}/query",
json=query_request,
headers=self.headers
)
if response.status_code == 200:
results = response.json()
print(f"Found {len(results)} knowledge items")
return results
else:
print(f"Query failed: {response.status_code}")
return None
Content Management Schema
# Create content management schema for AI applications
# gibson modify content_items "Create content_items table with id, title, content_type, content_length, language, created_at, updated_at"
# gibson modify content_sections "Create content_sections table with id, content_item_id, section_title, section_order, content_preview"
# gibson modify content_references "Create content_references table with id, content_item_id, reference_type, reference_target, reference_context"
# gibson modify content_analytics "Create content_analytics table with id, content_item_id, view_count, search_count, relevance_score, last_accessed"
# Generate models and deploy
# gibson code models
# gibson merge
Query and Analytics
class KnowledgeAnalytics:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = "https://api.gibsonai.com/v1/-"
self.headers = {"Authorization": f"Bearer {api_key}"}
def get_popular_topics(self):
"""Get most popular topics"""
query_request = {
"query": "Show the most popular topics based on knowledge item count and search frequency"
}
response = requests.post(
f"{self.base_url}/query",
json=query_request,
headers=self.headers
)
if response.status_code == 200:
results = response.json()
print("Popular topics:")
for result in results:
print(f" {result}")
return results
else:
print(f"Query failed: {response.status_code}")
return None
def analyze_content_performance(self):
"""Analyze content performance"""
query_request = {
"query": "Show content performance metrics including view counts, search frequency, and relevance scores"
}
response = requests.post(
f"{self.base_url}/query",
json=query_request,
headers=self.headers
)
if response.status_code == 200:
results = response.json()
print("Content performance analysis:")
for result in results:
print(f" {result}")
return results
else:
print(f"Query failed: {response.status_code}")
return None
def find_related_content(self, knowledge_item_id):
"""Find related content based on relationships"""
query_request = {
"query": f"Find all content items related to knowledge item {knowledge_item_id} through relationships"
}
response = requests.post(
f"{self.base_url}/query",
json=query_request,
headers=self.headers
)
if response.status_code == 200:
results = response.json()
print(f"Found {len(results)} related content items")
return results
else:
print(f"Query failed: {response.status_code}")
return None
def get_content_gaps(self):
"""Identify content gaps in knowledge base"""
query_request = {
"query": "Identify topics with low content coverage or missing relationships"
}
response = requests.post(
f"{self.base_url}/query",
json=query_request,
headers=self.headers
)
if response.status_code == 200:
results = response.json()
print("Content gaps identified:")
for result in results:
print(f" {result}")
return results
else:
print(f"Query failed: {response.status_code}")
return None
Use Cases
Document Management
Perfect for:
- Storing document metadata and information
- Organizing documents by categories and topics
- Tracking document versions and changes
- Managing document access and permissions
Knowledge Base Systems
Enable:
- Structured storage of knowledge information
- Relationship mapping between knowledge items
- Search metadata for improved discoverability
- Content analytics and performance tracking
AI Application Support
Support:
- Data storage for AI-powered applications
- Structured metadata for AI processing
- Integration with external AI services
- Analytics and reporting capabilities
Content Analytics
Allow:
- Tracking content performance and usage
- Identifying popular topics and trends
- Finding content gaps and opportunities
- Measuring content effectiveness
Benefits for AI Applications
Structured Data Management
- Organized Storage: Well-structured storage for knowledge data
- Relationship Mapping: Define relationships between data entities
- Flexible Schema: Adapt to different knowledge management needs
- Natural Language Queries: Query data using natural language
Easy Integration
- REST APIs: Auto-generated APIs for easy integration
- MCP Server: Connect AI tools through MCP server
- Python Models: Generated models for easy development
- Documentation: Comprehensive API documentation
Scalable Architecture
- Performance: Optimized for knowledge management workloads
- Flexibility: Easy to modify schema as needs evolve
- Analytics: Built-in analytics and reporting capabilities
- Search Support: Metadata storage to support search functionality
Important Limitations
What GibsonAI Does NOT Provide
- Vector Storage: No built-in vector database or embeddings storage
- Similarity Search: No semantic similarity search capabilities
- Text Processing: No automatic text processing or chunking
- Embedding Generation: No automatic embedding generation
External Integration Required
For complete RAG implementations, you'll need:
- Vector Database: Use external vector databases like Pinecone, Weaviate, or Chroma
- Embedding Services: Use OpenAI, Hugging Face, or other embedding services
- Text Processing: Implement text chunking and processing separately
- Search Logic: Implement semantic search logic in your application
Best Practices
Schema Design
- Clear Structure: Design clear, logical database structure
- Appropriate Relationships: Define meaningful relationships between entities
- Metadata Storage: Store relevant metadata for search and analytics
- Performance Optimization: Consider query performance in schema design
Data Management
- Quality Control: Maintain high-quality data for better AI performance
- Consistent Formats: Use consistent data formats across the system
- Regular Updates: Keep data current and relevant
- Backup Strategy: Implement proper backup and recovery procedures
Integration Strategy
- External Services: Plan integration with external AI services
- API Design: Design APIs that work well with AI applications
- Error Handling: Implement robust error handling
- Performance Monitoring: Monitor system performance and usage
Getting Started
- Design Schema: Plan your knowledge management database structure
- Create Database: Use Gibson CLI to create your database schema
- Generate Models: Create Python models for integration
- Test Integration: Test with sample data and queries
- Deploy: Deploy your knowledge management system
Gibson CLI Commands
# Create knowledge management schema
gibson modify table_name "description of knowledge table"
gibson code models
gibson merge
# Generate models for integration
gibson code models
gibson code schemas
Sample Schema Examples
Basic Document Management
# Simple document management schema
document_tables = {
"documents": "Create documents table with id, title, content_type, file_path, created_at",
"categories": "Create categories table with id, name, description",
"tags": "Create tags table with id, name, color",
"document_tags": "Create document_tags table with id, document_id, tag_id"
}
Knowledge Base with Relationships
# Knowledge base with relationships
knowledge_tables = {
"knowledge_items": "Create knowledge_items table with id, title, summary, topic, created_at",
"relationships": "Create relationships table with id, source_id, target_id, type, strength",
"topics": "Create topics table with id, name, description, parent_id",
"search_metadata": "Create search_metadata table with id, item_id, keywords, relevance_score"
}
Ready to create database schemas for your AI knowledge management system? Get started with GibsonAI.