async function testAddDocument() { const response = await fetch('http://localhost:3000/api/embeddings', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ content: 'Next.js is a React framework for building web applications.', title: 'Next.js Introduction', metadata: { category: 'web development' } }) }) const result = await response.json() console.log('Document added:', result) } async function testSearch() { const response = await fetch('http://localhost:3000/api/search', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ query: 'What is Next.js?', match_threshold: 0.5, match_count: 3 }) }) const result = await response.json() console.log('Search results:', result) } // Run tests testAddDocument() .then(() => testSearch()) .catch(console.error)