diff --git a/JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts b/JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts index d0465501..ed57eec8 100644 --- a/JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts +++ b/JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts @@ -67,14 +67,18 @@ export class OpenAI { private checkKeys(): void { if (!this.apiKey) { - console.error("API key is missing. Please provide a valid OpenAI API key. You can add it in .env file as OPENAI_API_KEY"); + console.error( + "API key is missing. Please provide a valid OpenAI API key. You can add it in .env file as OPENAI_API_KEY" + ); } if (!this.orgId) { - console.warn("Organization ID is missing. Please provide a valid OpenAI Organization ID. You can add it in .env file as OPENAI_ORG_ID"); + console.warn( + "Organization ID is missing. Please provide a valid OpenAI Organization ID. You can add it in .env file as OPENAI_ORG_ID" + ); } } - async chat (chatOptions: OpenAIChatOptions): Promise { + async chat(chatOptions: OpenAIChatOptions): Promise { const response = await axios .post( openAI_url, @@ -82,11 +86,11 @@ export class OpenAI { model: chatOptions.model || "gpt-3.5-turbo", messages: chatOptions.prompt ? [ - { - role: chatOptions.role || "user", - content: chatOptions.prompt, - }, - ] + { + role: chatOptions.role || "user", + content: chatOptions.prompt, + }, + ] : chatOptions.messages, max_tokens: chatOptions.max_tokens || 256, temperature: chatOptions.temperature || 0.7, @@ -125,11 +129,11 @@ export class OpenAI { model: chatOptions.model || "gpt-3.5-turbo", messages: chatOptions.prompt ? [ - { - role: chatOptions.role || "user", - content: chatOptions.prompt, - }, - ] + { + role: chatOptions.role || "user", + content: chatOptions.prompt, + }, + ] : chatOptions.messages, max_tokens: chatOptions.max_tokens || 1024, temperature: chatOptions.temperature || 0.7, @@ -160,7 +164,7 @@ export class OpenAI { return response[0].message; } - async generateEmbeddings({ input, model }: { input: string[], model: string }): Promise { + async generateEmbeddings({ input, model }: { input: string[]; model: string }): Promise { const response = await axios .post( "https://api.openai.com/v1/embeddings", diff --git a/package.json b/package.json index 1782f525..d3a26a0a 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,13 @@ "dependencies": { "@microsoft/eslint-formatter-sarif": "^3.1.0", "@playwright/test": "^1.46.0", - "@typescript-eslint/eslint-plugin": "^8.1.0", - "@typescript-eslint/parser": "^8.1.0", + "@typescript-eslint/eslint-plugin": "^8.8.0", + "@typescript-eslint/parser": "^8.8.0", "axios": "^1.7.3", - "eslint": "^8.57.0", + "eslint": "^8.57.1", "eslint-config-google": "^0.14.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.29.1", + "eslint-plugin-import": "^2.30.0", "eslint-plugin-prettier": "^5.2.1", "express": "^4.18.2", "prettier": "^3.3.3"