diff --git a/package-lock.json b/package-lock.json index ce9d437..04591ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "stream": "^0.0.2" }, "devDependencies": { + "@anthropic-ai/sdk": "^0.17.1", "chai": "^5.0.3", "cohere-ai": "^7.7.3", "eslint": "^8.56.0", @@ -29,6 +30,23 @@ "node": ">=0.10.0" } }, + "node_modules/@anthropic-ai/sdk": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.17.1.tgz", + "integrity": "sha512-ke/JGfaa4sc1PB58L4B9hXI/BlJphXc696+cVX8Z8gQt51l++a9umZTN/7UymV8Dcat6KKYNQE8P8yeeyAldHg==", + "dev": true, + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "digest-fetch": "^1.3.0", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7", + "web-streams-polyfill": "^3.2.1" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", diff --git a/package.json b/package.json index ec4d620..ff7a116 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "stream": "^0.0.2" }, "devDependencies": { + "@anthropic-ai/sdk": "^0.17.1", "chai": "^5.0.3", "cohere-ai": "^7.7.3", "eslint": "^8.56.0", diff --git a/tests/anthropic.test.mjs b/tests/anthropic.test.mjs new file mode 100644 index 0000000..df83287 --- /dev/null +++ b/tests/anthropic.test.mjs @@ -0,0 +1,20 @@ +import Anthropic from '@anthropic-ai/sdk'; +import {expect} from 'chai'; +import DokuMetry from '../src/index.js'; + +describe('Anthropic Test', () => { + const anthropic = new Anthropic({ + apiKey: process.env.ANTHROPIC_API_TOKEN, + }); + + it('should return a response with type as "message"', async () => { + DokuMetry.init({llm: anthropic, dokuUrl: process.env.DOKU_URL, apiKey: process.env.DOKU_TOKEN, environment: "dokumetry-testing", applicationName: "dokumetry-node-test", skipResp: false}); + const message = await anthropic.messages.create({ + model: "claude-3-opus-20240229", + max_tokens: 1024, + messages: [{ role: "user", content: "Hello, Doku!" }], + }); + + expect(message.type).to.equal('message'); + }).timeout(10000); +}); \ No newline at end of file