const API_URL = 'https://sdk.senso.ai/api/v1';
const API_KEY = 'YOUR_API_KEY';
async function createFirstContent() {
try {
// Create your first content item
const contentResponse = await fetch(`${API_URL}/content/raw`, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Introduction to Senso',
summary: 'Learn about the Senso knowledge base platform',
text: `# Welcome to Senso
Senso is a powerful knowledge base platform that helps you:
- Organize and manage your content effectively
- Search through content using natural language
- Generate new content based on existing knowledge
- Build AI-powered applications with your data
## Key Features
### Smart Search
Find answers instantly with our AI-powered search that understands context and intent.
### Content Generation
Create new content automatically based on your existing knowledge base.
### Easy Integration
Simple REST API that works with any programming language or framework.`
})
});
const content = await contentResponse.json();
console.log('Content created successfully!');
console.log('Content ID:', content.id);
console.log('Processing status:', content.processing_status);
// Wait a moment for processing
await new Promise(resolve => setTimeout(resolve, 2000));
// Search for information
const searchResponse = await fetch(`${API_URL}/search`, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: 'What are the key features of Senso?',
max_results: 3
})
});
const searchResult = await searchResponse.json();
console.log('\nSearch Results:');
console.log('Answer:', searchResult.answer);
console.log('Sources used:', searchResult.results.length);
} catch (error) {
console.error('Error:', error);
}
}
createFirstContent();