Skip to content

Commit 55663a6

Browse files
author
Michał Żarnecki
committed
set timeout to avoid failures during model inference
1 parent df0d1f6 commit 55663a6

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

app/src/script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ $(function(){
1313
beforeSend: function () {
1414
$("#response .data").html('');
1515
$("#response .spinner").show();
16-
}
16+
},
17+
timeout: 300000,
1718
});
1819
return false;
1920
});

app/src/service/DocumentProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getSimilarDocuments(
3232
if ($useReranking) {
3333
$documents = $this->rerank($prompt, $documents);
3434
} else {
35-
$documents = array_map(fn($document) => $document['text'], $documents);
35+
$documents = array_map(fn ($document) => $document['text'], $documents);
3636
}
3737

3838
return [$documents, $documentsNames];

app/src/service/claude/AbstractClaudeAPIClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected function request(string $prompt, string $endpoint, string $model): arr
5454
'anthropic-version' => '2023-06-01',
5555
'Content-Type' => 'application/json',
5656
],
57+
'timeout' => 180,
5758
]);
5859

5960
$responseData = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);

app/src/service/deepseek/AbstractDeepSeekAPIClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ protected function request(array $messages, string $model, bool $stream = false,
4242
'Authorization' => 'Bearer '.$this->apiKey,
4343
'Content-Type' => 'application/json',
4444
],
45+
'timeout' => 180,
4546
]);
4647

4748
$responseData = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);

app/src/service/gemini/AbstractGeminiAPIClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected function request(string $method, string $model, array $data): array
3838
$response = $this->httpClient->post($url, [
3939
'json' => $data,
4040
'headers' => ['Content-Type' => 'application/json'],
41+
'timeout' => 180,
4142
]);
4243

4344
$responseData = json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);

0 commit comments

Comments
 (0)