diff --git a/package.json b/package.json index e3bfd8c..a070e38 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,7 @@ "test": "jest", "build": "bash ./build", "lint": "eslint --ext ts,js .", - "fix": "eslint --fix --ext ts,js .", - "start": "npm run build && npm pack && cd /Users/chandeep/Documents/Workspace/Portkey/Hands-On/revamp-Node && npm i /Users/chandeep/Documents/Workspace/Portkey/SDK/portkey-node-sdk/dist" + "fix": "eslint --fix --ext ts,js ." }, "imports": { "portkey-ai": ".", diff --git a/src/_types/portkeyConstructs.ts b/src/_types/portkeyConstructs.ts index c422f07..9bbe1d4 100644 --- a/src/_types/portkeyConstructs.ts +++ b/src/_types/portkeyConstructs.ts @@ -10,7 +10,7 @@ export interface Function { } export interface ModelParams { - model: string; + model?: string; suffix?: string; max_tokens?: number; temperature?: number; diff --git a/src/apis/embeddings.ts b/src/apis/embeddings.ts index cce7fe1..51cd0ae 100644 --- a/src/apis/embeddings.ts +++ b/src/apis/embeddings.ts @@ -7,11 +7,10 @@ import { overrideConfig } from "../utils"; import { createHeaders } from "./createHeaders"; export interface EmbeddingsBody extends ModelParams { - input: string | Array | Array | Array>; - model: (string & {}) | 'text-embedding-ada-002' | 'text-embedding-3-small' | 'text-embedding-3-large'; + input: string; + model?: string; dimensions?: number; - encoding_format?: 'float' | 'base64'; - user?: string; + encoding_format?: string; } export type EmbeddingsResponse = Record & APIResponseType diff --git a/tests/assistants/openai.test.ts b/tests/assistants/openai.test.ts index 52718fe..15de07c 100644 --- a/tests/assistants/openai.test.ts +++ b/tests/assistants/openai.test.ts @@ -4,7 +4,7 @@ import { Portkey } from 'portkey-ai'; config({ override: true }) const client = new Portkey({ apiKey: process.env["PORTKEY_API_KEY"] ?? "", - baseURL: "https://api.portkeydev.com/v1", + baseURL: "https://api.portkey.ai/v1", provider: "openai", virtualKey: process.env["OPENAI_VIRTUAL_KEY"] ?? "" }); diff --git a/tests/chat/anthropic.test.ts b/tests/chat/anthropic.test.ts index b8584dd..a52f629 100644 --- a/tests/chat/anthropic.test.ts +++ b/tests/chat/anthropic.test.ts @@ -4,7 +4,7 @@ import { Portkey } from 'portkey-ai'; config({ override: true }) const client = new Portkey({ apiKey: process.env["PORTKEY_API_KEY"] ?? "", - baseURL: "https://api.portkeydev.com/v1", + baseURL: "https://api.portkey.ai/v1", provider: "openai", virtualKey: process.env["ANTHROPIC_VIRTUAL_KEY"] ?? "" }); diff --git a/tests/chat/anyscale.test.ts b/tests/chat/anyscale.test.ts index 2883a3b..81ceb2f 100644 --- a/tests/chat/anyscale.test.ts +++ b/tests/chat/anyscale.test.ts @@ -4,7 +4,7 @@ import { Portkey } from 'portkey-ai'; config({ override: true }) const client = new Portkey({ apiKey: process.env["PORTKEY_API_KEY"] ?? "", - baseURL: "https://api.portkeydev.com/v1", + baseURL: "https://api.portkey.ai/v1", provider: "openai", virtualKey: process.env["ANYSCALE_VIRTUAL_KEY"] ?? "" }); diff --git a/tests/chat/openai.test.ts b/tests/chat/openai.test.ts index 7063ff2..f9f45d3 100644 --- a/tests/chat/openai.test.ts +++ b/tests/chat/openai.test.ts @@ -4,7 +4,7 @@ import { Portkey } from 'portkey-ai'; config({ override: true }) const client = new Portkey({ apiKey: process.env["PORTKEY_API_KEY"] ?? "", - baseURL: "https://api.portkeydev.com/v1", + baseURL: "https://api.portkey.ai/v1", provider: "openai", virtualKey: process.env["OPENAI_VIRTUAL_KEY"] ?? "" }); diff --git a/tests/completion/anthropic.test.ts b/tests/completion/anthropic.test.ts index b8584dd..a52f629 100644 --- a/tests/completion/anthropic.test.ts +++ b/tests/completion/anthropic.test.ts @@ -4,7 +4,7 @@ import { Portkey } from 'portkey-ai'; config({ override: true }) const client = new Portkey({ apiKey: process.env["PORTKEY_API_KEY"] ?? "", - baseURL: "https://api.portkeydev.com/v1", + baseURL: "https://api.portkey.ai/v1", provider: "openai", virtualKey: process.env["ANTHROPIC_VIRTUAL_KEY"] ?? "" }); diff --git a/tests/completion/anyscale.test.ts b/tests/completion/anyscale.test.ts index 2883a3b..81ceb2f 100644 --- a/tests/completion/anyscale.test.ts +++ b/tests/completion/anyscale.test.ts @@ -4,7 +4,7 @@ import { Portkey } from 'portkey-ai'; config({ override: true }) const client = new Portkey({ apiKey: process.env["PORTKEY_API_KEY"] ?? "", - baseURL: "https://api.portkeydev.com/v1", + baseURL: "https://api.portkey.ai/v1", provider: "openai", virtualKey: process.env["ANYSCALE_VIRTUAL_KEY"] ?? "" }); diff --git a/tests/completion/openai.test.ts b/tests/completion/openai.test.ts index d9e876b..09339b6 100644 --- a/tests/completion/openai.test.ts +++ b/tests/completion/openai.test.ts @@ -4,7 +4,7 @@ import { Portkey } from 'portkey-ai'; config({ override: true }) const client = new Portkey({ apiKey: process.env["PORTKEY_API_KEY"] ?? "", - baseURL: "https://api.portkeydev.com/v1", + baseURL: "https://api.portkey.ai/v1", provider: "openai", virtualKey: process.env["OPENAI_VIRTUAL_KEY"] ?? "" }); diff --git a/tests/images/openai.test.ts b/tests/images/openai.test.ts index 9c37a78..8edd376 100644 --- a/tests/images/openai.test.ts +++ b/tests/images/openai.test.ts @@ -6,7 +6,7 @@ import path from "path"; config({ override: true }); const client = new Portkey({ apiKey: process.env["PORTKEY_API_KEY"] ?? "", - baseURL: "https://api.portkeydev.com/v1", + baseURL: "https://api.portkey.ai/v1", provider: "openai", virtualKey: process.env["OPENAI_VIRTUAL_KEY"] ?? "" }); @@ -54,81 +54,4 @@ describe("Openai Images APIs", () => { expect(response.data.length).toBeGreaterThan(0); }, 120000); - - // test('model: gpt-4-1106-preview', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-4-1106-preview', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-4', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-4', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-4-0314', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-4-0314', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-4-32k', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-4-32k', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-4-32k-0314', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-4-32k-0314', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-4-0613', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-4-0613', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-3.5-turbo-0613', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-3.5-turbo-0613', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-3.5-turbo-0301', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-3.5-turbo-0301', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-3.5-turbo-1106', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-3.5-turbo-1106', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-3.5-turbo-16k', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-3.5-turbo-16k', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); - - // test('model: gpt-3.5-turbo', async () => { - // const completion = await client.chat.completions.create({ model: 'gpt-3.5-turbo', messages: [{ "role": "user", "content": "Say this is a test" }] }); - // expect(completion).toBeDefined(); - // expect(completion.choices).toBeDefined(); - // expect(completion.choices.length).toBeGreaterThan(0); - // }); });