diff --git a/tests/openai.test.mjs b/tests/openai.test.mjs index d5f2d40..86c0fb8 100644 --- a/tests/openai.test.mjs +++ b/tests/openai.test.mjs @@ -17,6 +17,7 @@ describe('OpenAI Test', () => { const chatCompletion = await openai.chat.completions.create({ messages: [{role: 'user', content: 'What is LLM Monitoring?'}], model: 'gpt-3.5-turbo', + max_tokens: 1, }); expect(chatCompletion.object).to.equal('chat.completion'); @@ -27,7 +28,7 @@ describe('OpenAI Test', () => { const completion = await openai.completions.create({ model: 'gpt-3.5-turbo-instruct', prompt: 'What is LLM Observability?', - max_tokens: 7, + max_tokens: 1, }); expect(completion.object).to.equal('text_completion'); @@ -37,35 +38,37 @@ describe('OpenAI Test', () => { await DokuMetry.init({llm: openai, dokuUrl: process.env.DOKU_URL, apiKey: process.env.DOKU_TOKEN, environment: "dokumetry-testing", applicationName: "dokumetry-node-test", skipResp: false}); const embeddings = await openai.embeddings.create({ model: 'text-embedding-ada-002', - input: 'The quick brown fox jumped over the lazy dog', + input: 'LLM Observability', encoding_format: 'float', }); expect(embeddings.data[0].object).to.equal('embedding'); }).timeout(30000);; - it('should return a response with object as "fine_tuning.job"', async () => { - await DokuMetry.init({llm: openai, dokuUrl: process.env.DOKU_URL, apiKey: process.env.DOKU_TOKEN, environment: "dokumetry-testing", applicationName: "dokumetry-node-test", skipResp: false}); - try { - const fineTuningJob = await openai.fineTuning.jobs.create({ - training_file: 'file-m36cc45komO83VJKAY1qVgeP', - model: 'gpt-3.5-turbo', - }); + // it('should return a response with object as "fine_tuning.job"', async () => { + // await DokuMetry.init({llm: openai, dokuUrl: process.env.DOKU_URL, apiKey: process.env.DOKU_TOKEN, environment: "dokumetry-testing", applicationName: "dokumetry-node-test", skipResp: false}); + // try { + // const fineTuningJob = await openai.fineTuning.jobs.create({ + // training_file: '', + // model: 'gpt-3.5-turbo', + // }); - expect(fineTuningJob.object).to.equal('fine_tuning.job'); - } catch (error) { - // Check if it's a rate limit error - if (error.code == "daily_rate_limit_exceeded") { - console.error(`Daily Rate limit Reached`); - } - } - }).timeout(10000); + // expect(fineTuningJob.object).to.equal('fine_tuning.job'); + // } catch (error) { + // // Check if it's a rate limit error + // if (error.code == "daily_rate_limit_exceeded") { + // console.error(`Daily Rate limit Reached`); + // } + // } + // }).timeout(10000); it('should return a response with "created" field', async () => { await DokuMetry.init({llm: openai, dokuUrl: process.env.DOKU_URL, apiKey: process.env.DOKU_TOKEN, environment: "dokumetry-testing", applicationName: "dokumetry-node-test", skipResp: false}); const imageGeneration = await openai.images.generate({ model: 'dall-e-2', - prompt: 'Generate an image of a cat.', + prompt: 'LLM Observability dashboard', + size: "256x256", + n: 1 }); expect(imageGeneration.created).to.exist; @@ -75,6 +78,9 @@ describe('OpenAI Test', () => { await DokuMetry.init({llm: openai, dokuUrl: process.env.DOKU_URL, apiKey: process.env.DOKU_TOKEN, environment: "dokumetry-testing", applicationName: "dokumetry-node-test", skipResp: false}); const imageVariation = await openai.images.createVariation({ image: fs.createReadStream('tests/test-image-for-openai.png'), + size: "256x256", + model: 'dall-e-2', + n: 1 }); expect(imageVariation.created).to.exist; @@ -85,7 +91,7 @@ describe('OpenAI Test', () => { const audioSpeech = await openai.audio.speech.create({ model: 'tts-1', voice: 'alloy', - input: 'Today is a wonderful day to build something people love!', + input: 'LLM Observability', }); expect(audioSpeech.url).to.equal('https://api.openai.com/v1/audio/speech'); }).timeout(30000);