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 SensoSenso 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 SearchFind answers instantly with our AI-powered search that understands context and intent.### Content GenerationCreate new content automatically based on your existing knowledge base.### Easy IntegrationSimple 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();
{ "query": "What are the key features of Senso?", "answer": "Senso has three key features: Smart Search for instant AI-powered answers, Content Generation for creating new content from existing knowledge, and Easy Integration with a simple REST API.", "results": [ { "content_id": "550e8400-e29b-41d4-a716-446655440000", "chunk_text": "### Smart Search\nFind answers instantly...", "score": 0.95 } ]}