diff --git a/badges/coverage.svg b/badges/coverage.svg
index 87a9754..3223905 100644
--- a/badges/coverage.svg
+++ b/badges/coverage.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/dist/index.js b/dist/index.js
index 402107f..5883345 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -11402,12 +11402,15 @@ const openai_1 = __importDefault(__nccwpck_require__(47));
async function completionRequest(apiKey, systemPrompt, userPrompt) {
try {
const openai = new openai_1.default({ apiKey });
+ const requestTimeout = 300 * 1000; // 5 minutes
const response = await openai.chat.completions.create({
messages: [
{ role: 'system', content: systemPrompt },
{ role: 'user', content: userPrompt }
],
model: 'gpt-3.5-turbo'
+ }, {
+ timeout: requestTimeout
});
if (response.choices &&
response.choices[0] &&
diff --git a/src/ai.ts b/src/ai.ts
index 1699ffb..0afe676 100644
--- a/src/ai.ts
+++ b/src/ai.ts
@@ -7,13 +7,19 @@ export async function completionRequest(
): Promise {
try {
const openai = new OpenAI({ apiKey })
- const response = await openai.chat.completions.create({
- messages: [
- { role: 'system', content: systemPrompt },
- { role: 'user', content: userPrompt }
- ],
- model: 'gpt-3.5-turbo'
- })
+ const requestTimeout = 300 * 1000 // 5 minutes
+ const response = await openai.chat.completions.create(
+ {
+ messages: [
+ { role: 'system', content: systemPrompt },
+ { role: 'user', content: userPrompt }
+ ],
+ model: 'gpt-3.5-turbo'
+ },
+ {
+ timeout: requestTimeout
+ }
+ )
if (
response.choices &&
response.choices[0] &&