diff --git a/test-client/package.json b/test-client/package.json index af3fdf9..c1eda26 100644 --- a/test-client/package.json +++ b/test-client/package.json @@ -3,17 +3,17 @@ "version": "1.0.0", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "tsc", + "start": "node dist/index.js" }, - "author": "", - "license": "ISC", - "description": "", + "author": "David Papp ", + "license": "Apache-2.0", + "description": "Demo client for OpenShield", "dependencies": { - "https-proxy-agent": "^7.0.4", "openai": "4.53.0" }, "devDependencies": { - "@types/node": "^20.12.12", - "typescript": "^5.4.5" + "@types/node": "20.12.12", + "typescript": "5.4.5" } } diff --git a/test-client/src/index.ts b/test-client/src/index.ts index 3e73e99..2e73d93 100644 --- a/test-client/src/index.ts +++ b/test-client/src/index.ts @@ -1,23 +1,11 @@ import OpenAI from 'openai'; -import { HttpsProxyAgent } from 'https-proxy-agent'; const client = new OpenAI({ - // apiKey: '12345', baseURL: 'http://127.0.0.1:3005/openai/v1', - apiKey: process.env.TEST_API_KEY, + apiKey: process.env.OPENSHIELD_API_KEY, }); async function main() { - // const model = await client.models.retrieve('gpt-4'); - // console.log(model); - // const customModel = await client.models.retrieve('davinci:ft-persio-2023-03-06-11-44-36'); - // console.log(customModel); - // const list = await client.models.list(); - // - // for await (const model of list) { - // console.log(model); - // } - const completion = await client.chat.completions.create({ model: 'gpt-4', messages: [ @@ -28,4 +16,4 @@ async function main() { console.log(JSON.stringify(completion, null, 2)); } -main().then(r => console.log('done')); +main().then(() => console.log('done')); diff --git a/test-client/tsconfig.json b/test-client/tsconfig.json index 8b50d85..25240a4 100644 --- a/test-client/tsconfig.json +++ b/test-client/tsconfig.json @@ -1,10 +1,11 @@ { "compilerOptions": { - "noEmit": true, - "target": "es2021", + "target": "esnext", + "module": "esnext", "strict": true, + "outDir": "dist", "moduleResolution": "Bundler" }, "include": [ "src" ], - "exclude": [ "src/_shims" ] + "exclude": [ "node_modules" ] } \ No newline at end of file