Skip to content

Commit

Permalink
Automatically applying Prettier changes
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 1, 2024
1 parent 72adb66 commit a6305ca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
32 changes: 18 additions & 14 deletions JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,30 @@ 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<OpenAIChatReturnOptions> {
async chat(chatOptions: OpenAIChatOptions): Promise<OpenAIChatReturnOptions> {
const response = await axios
.post(
openAI_url,
{
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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -160,7 +164,7 @@ export class OpenAI {
return response[0].message;
}

async generateEmbeddings({ input, model }: { input: string[], model: string }): Promise<any> {
async generateEmbeddings({ input, model }: { input: string[]; model: string }): Promise<any> {
const response = await axios
.post(
"https://api.openai.com/v1/embeddings",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a6305ca

Please sign in to comment.