"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const openai_1 = require("../../src/providers/openai");
const togetherai_1 = require("../../src/providers/togetherai");
jest.mock('../../src/providers/openai');
describe('createTogetherAiProvider', () => {
    beforeEach(() => {
        jest.clearAllMocks();
    });
    it('should create a chat completion provider when type is chat', () => {
        const provider = (0, togetherai_1.createTogetherAiProvider)('togetherai:chat:model-name');
        expect(provider).toBeInstanceOf(openai_1.OpenAiChatCompletionProvider);
        expect(openai_1.OpenAiChatCompletionProvider).toHaveBeenCalledWith('model-name', expect.any(Object));
    });
    it('should create a completion provider when type is completion', () => {
        const provider = (0, togetherai_1.createTogetherAiProvider)('togetherai:completion:model-name');
        expect(provider).toBeInstanceOf(openai_1.OpenAiCompletionProvider);
        expect(openai_1.OpenAiCompletionProvider).toHaveBeenCalledWith('model-name', expect.any(Object));
    });
    it('should create an embedding provider when type is embedding', () => {
        const provider = (0, togetherai_1.createTogetherAiProvider)('togetherai:embedding:model-name');
        expect(provider).toBeInstanceOf(openai_1.OpenAiEmbeddingProvider);
        expect(openai_1.OpenAiEmbeddingProvider).toHaveBeenCalledWith('model-name', expect.any(Object));
    });
    it('should create an embedding provider when type is embeddings', () => {
        const provider = (0, togetherai_1.createTogetherAiProvider)('togetherai:embeddings:model-name');
        expect(provider).toBeInstanceOf(openai_1.OpenAiEmbeddingProvider);
        expect(openai_1.OpenAiEmbeddingProvider).toHaveBeenCalledWith('model-name', expect.any(Object));
    });
    it('should default to chat completion provider when no type is specified', () => {
        const provider = (0, togetherai_1.createTogetherAiProvider)('togetherai:model-name');
        expect(provider).toBeInstanceOf(openai_1.OpenAiChatCompletionProvider);
        expect(openai_1.OpenAiChatCompletionProvider).toHaveBeenCalledWith('model-name', expect.any(Object));
    });
    it('should pass correct configuration to the provider', () => {
        const options = {
            id: 'custom-id',
        };
        (0, togetherai_1.createTogetherAiProvider)('togetherai:chat:model-name', options);
        expect(openai_1.OpenAiChatCompletionProvider).toHaveBeenCalledWith('model-name', expect.objectContaining({
            config: {
                apiBaseUrl: 'https://api.together.xyz/v1',
                apiKeyEnvar: 'TOGETHER_API_KEY',
            },
            id: 'custom-id',
        }));
    });
    it('should handle model names with colons', () => {
        (0, togetherai_1.createTogetherAiProvider)('togetherai:chat:org:model:name');
        expect(openai_1.OpenAiChatCompletionProvider).toHaveBeenCalledWith('org:model:name', expect.any(Object));
    });
});
//# sourceMappingURL=togetherai.test.js.map