Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ran the deno fmt command with default conf #37

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const openAI = new OpenAI(Deno.env.get("YOUR_API_KEY")!);

const transcription = await openAI.createTranscription({
model: "whisper-1",
file: '/path/to/your/audio/file.mp3',
file: "/path/to/your/audio/file.mp3",
});

console.log(transcription);
Expand Down
16 changes: 8 additions & 8 deletions examples/chatCompletionFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const openAI = new OpenAI(Deno.env.get("YOUR_API_KEY")!);
const chatCompletion = await openAI.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [
{"role": "user", "content": "What is the weather like in Boston?"}
{ "role": "user", "content": "What is the weather like in Boston?" },
],
function_call: { name: "get_current_weather" },
functions: [
Expand All @@ -17,17 +17,17 @@ const chatCompletion = await openAI.createChatCompletion({
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
"description": "The city and state, e.g. San Francisco, CA",
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
"enum": ["celsius", "fahrenheit"],
},
},
"required": ["location"]
}
}
]
"required": ["location"],
},
},
],
});

console.log(chatCompletion);
2 changes: 1 addition & 1 deletion src/deps.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { TextDelimiterStream } from "https://deno.land/std@0.204.0/streams/mod.ts";
export { basename } from "https://deno.land/std@0.204.0/path/mod.ts";
export { basename } from "https://deno.land/std@0.204.0/path/mod.ts";
20 changes: 10 additions & 10 deletions src/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class OpenAI {

// null coalesce content to empty string as discussed in PR #17
resp?.choices?.forEach(
(choice) => (choice.message.content = choice.message.content ?? "")
(choice) => (choice.message.content = choice.message.content ?? ""),
);
return resp;
}
Expand Down Expand Up @@ -222,7 +222,7 @@ export class OpenAI {
logit_bias: options.logitBias,
user: options.user,
functions: options.functions,
function_call: options.function_call
function_call: options.function_call,
}),
},
);
Expand Down Expand Up @@ -285,11 +285,11 @@ export class OpenAI {
formData.append("image", options.image as unknown as Blob);
}

if (options.n) { formData.append("n", options.n); }
if (options.mask) { formData.append("mask", options.mask); }
if (options.prompt) { formData.append("prompt", options.prompt); }
if (options.size) { formData.append("size", options.size); }
if (options.user) { formData.append("user", options.user); }
if (options.n) formData.append("n", options.n);
if (options.mask) formData.append("mask", options.mask);
if (options.prompt) formData.append("prompt", options.prompt);
if (options.size) formData.append("size", options.size);
if (options.user) formData.append("user", options.user);
if (options.responseFormat) {
formData.append("response_format", options.responseFormat);
}
Expand Down Expand Up @@ -324,9 +324,9 @@ export class OpenAI {
formData.append("image", options.image as unknown as Blob);
}

if (options.n) { formData.append("n", options.n); }
if (options.size) { formData.append("size", options.size); }
if (options.user) { formData.append("user", options.user); }
if (options.n) formData.append("n", options.n);
if (options.size) formData.append("size", options.size);
if (options.user) formData.append("user", options.user);
if (options.responseFormat) {
formData.append("response_format", options.responseFormat);
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ export interface ChatCompletionStreamDelta {
function_call?: {
name?: string;
arguments: string;
}
};
}

export interface ChatCompletionStream {
Expand Down