Skip to main content
Glama
test-embedding-service.js1.5 kB
#!/usr/bin/env node // Тест EmbeddingService import dotenv from 'dotenv'; import { EmbeddingService } from '../dist/rag/embedding-service.js'; // Загружаем .env файл dotenv.config(); async function testEmbeddingService() { console.log('🧪 Тестирование EmbeddingService...\n'); try { const embeddingService = new EmbeddingService(); // Тест 1: Проверка подключения console.log('🔌 Тест 1: Проверка подключения к OpenAI...'); const isConnected = await embeddingService.testConnection(); console.log('Результат testConnection:', isConnected); if (isConnected) { // Тест 2: Генерация эмбеддинга console.log('\n🧠 Тест 2: Генерация эмбеддинга...'); const testText = 'Hello, world!'; const embedding = await embeddingService.generateEmbedding(testText); console.log('✅ Эмбеддинг сгенерирован успешно!'); console.log(` Размер: ${embedding.embedding.length} измерений`); console.log(` Токенов: ${embedding.tokenCount}`); } else { console.log('❌ Нет подключения к OpenAI API'); } } catch (error) { console.error('❌ Ошибка в тесте EmbeddingService:', error.message); console.error('Детали:', error); } } testEmbeddingService().catch(console.error);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Galiusbro/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server