Search
Code168
"slug": "val-vibes", "link": "/blog/val-vibes", "description": "How to build semantic search with embeddings for Val Town within Val Town itself", "pubDate": "Tue, 18 Jun 2024 00:00:00 GMT", "author": "JP Posma", "slug": "val-vibes", "link": "/blog/val-vibes", "description": "How to build semantic search with embeddings for Val Town within Val Town itself", "pubDate": "Tue, 18 Jun 2024 00:00:00 GMT", "author": "JP Posma", "slug": "val-vibes", "link": "/blog/val-vibes", "description": "How to build semantic search with embeddings for Val Town within Val Town itself", "pubDate": "Tue, 18 Jun 2024 00:00:00 GMT", "author": "JP Posma", "slug": "val-vibes", "link": "/blog/val-vibes", "description": "How to build semantic search with embeddings for Val Town within Val Town itself", "pubDate": "Tue, 18 Jun 2024 00:00:00 GMT", "author": "JP Posma", * Initialize the embedding model */async function initEmbeddings(modelId = EMBEDDING_MODELS.fast) { if (embedder && embedder.model?.config?.name_or_path === modelId) { return embedder;async function processAllFeeds() { await initDatabase(); await initEmbeddings(); let totalProcessed = 0; "slug": "val-vibes", "link": "/blog/val-vibes", "description": "How to build semantic search with embeddings for Val Town within Val Town itself", "pubDate": "Tue, 18 Jun 2024 00:00:00 GMT", "author": "JP Posma", "link": "/blog/val-vibes", "description": "How to build semantic search with embeddings for Val Town within Val Town itself", "pubDate": "Tue, 18 Jun 2024 00:00:00 GMT", "author": "JP Posma",```async function calculateEmbeddings(text) { const url = `https://yawnxyz-ai.web.val.run/generate?embed=true&value=${encodeURIComponent(text)}`; return data; } catch (error) { console.error('Error calculating embeddings:', error); return null; } // Embedding endpoints async generateEmbedding(request: EmbeddingRequest): Promise<ApiResponse<EmbeddingResponse>> { return this.request<EmbeddingResponse>('/embeddings/generate', { method: 'POST', body: JSON.stringify(request), threshold?: number; }): Promise<ApiResponse<any>> { return this.request('/embeddings/search', { method: 'POST', body: JSON.stringify(query), } async embeddingsHealthCheck(): Promise<ApiResponse<any>> { return this.request('/embeddings/health'); }Users
No users found
No docs found