const { test } = require('node:test');
const assert = require('node:assert/strict');

test('LiteLLM embedding discovery uses embedding metadata only', () => {
  const embeddings = require('../src/utils/embeddings');
  assert.equal(embeddings.isLiteLLMEmbeddingModel({ id: 'openai-text-embedding-3-large' }), false);
  assert.equal(embeddings.isLiteLLMEmbeddingModel({ id: 'mistral-codestral-embed' }), false);
  assert.equal(embeddings.isLiteLLMEmbeddingModel({ model_name: 'openai-text-embedding-3-large', model_info: { mode: 'embedding' } }), true);
  assert.equal(embeddings.isLiteLLMEmbeddingModel({ model_name: 'local-parakeet-v3', model_info: { mode: 'audio_transcription' } }), false);
});

test('LiteLLM embedding extraction includes metadata dimensions', () => {
  const embeddings = require('../src/utils/embeddings');
  assert.deepEqual(embeddings.getLiteLLMEmbeddingModels([
    { model_name: 'openai-text-embedding-3-large', model_info: { mode: 'embedding', output_vector_size: 3072 } },
    { model_name: 'openai-text-embedding-3-small', model_info: { mode: 'embedding', dimensions: '1536' } },
    { model_name: 'mistral-embed', model_info: { mode: 'embedding' } },
    { model_name: 'looks-like-embed' },
    { model_name: 'local-kokoro-tts', model_info: { mode: 'audio_speech' } }
  ]), [
    { id: 'openai-text-embedding-3-large', name: 'openai-text-embedding-3-large', dims: 3072 },
    { id: 'openai-text-embedding-3-small', name: 'openai-text-embedding-3-small', dims: 1536 },
    { id: 'mistral-embed', name: 'mistral-embed', dims: '?' }
  ]);
});
