Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function createResponse(Request $message): Response|Error
],
],
// TODO better exception
default => throw new InvalidArgumentException('Unsupported PromptGet result type: '.$resultMessage->type),
default => throw new InvalidArgumentException(\sprintf('Unsupported PromptGet result type: %s', $resultMessage->type)),
};

$messages[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function createResponse(Request $message): Response|Error
],
],
// TODO better exception
default => throw new InvalidArgumentException('Unsupported tool result type: '.$result->type),
default => throw new InvalidArgumentException(\sprintf('Unsupported tool result type: %s', $result->type)),
};

return new Response($message->id, [
Expand Down
4 changes: 2 additions & 2 deletions src/platform/src/Bridge/HuggingFace/ResultConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function convert(RawResultInterface|RawHttpResult $result, array $options
default => $content['error'],
};

throw new InvalidArgumentException(\sprintf('API Client Error (%d): ', $httpResponse->getStatusCode()).$message);
throw new InvalidArgumentException(\sprintf('API Client Error (%d): "%s"', $httpResponse->getStatusCode(), $message));
}

if (200 !== $httpResponse->getStatusCode()) {
throw new RuntimeException('Unhandled response code: '.$httpResponse->getStatusCode());
throw new RuntimeException(\sprintf('Unhandled response code: %d', $httpResponse->getStatusCode()));
}

$task = $options['task'] ?? null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function convert(RawResultInterface|RawHttpResult $result, array $options
$httpResponse = $result->getObject();

if (200 !== $httpResponse->getStatusCode()) {
throw new RuntimeException(\sprintf('Unexpected response code %d: ', $httpResponse->getStatusCode()).$httpResponse->getContent(false));
throw new RuntimeException(\sprintf('Unexpected response code %d: "%s"', $httpResponse->getStatusCode(), $httpResponse->getContent(false)));
}

$data = $result->getData();
Expand Down
2 changes: 1 addition & 1 deletion src/platform/src/Bridge/Mistral/Llm/ResultConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function convert(RawResultInterface|RawHttpResult $result, array $options
}

if (200 !== $code = $httpResponse->getStatusCode()) {
throw new RuntimeException(\sprintf('Unexpected response code %d: ', $code).$httpResponse->getContent(false));
throw new RuntimeException(\sprintf('Unexpected response code %d: "%s"', $code, $httpResponse->getContent(false)));
}

$data = $result->getData();
Expand Down
4 changes: 2 additions & 2 deletions src/platform/src/Vector/Vector.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public function __construct(
private ?int $dimensions = null,
) {
if (null !== $dimensions && $dimensions !== \count($data)) {
throw new InvalidArgumentException('Vector must have '.$dimensions.' dimensions');
throw new InvalidArgumentException(\sprintf('Vector must have %d dimensions', $dimensions));
}

if ([] === $data) {
throw new InvalidArgumentException('Vector must have at least one dimension.');
}

if (\is_int($dimensions) && \count($data) !== $dimensions) {
throw new InvalidArgumentException('Vector must have '.$dimensions.' dimensions');
throw new InvalidArgumentException(\sprintf('Vector must have %d dimensions', $dimensions));
}

if (null === $this->dimensions) {
Expand Down
2 changes: 1 addition & 1 deletion src/store/src/Bridge/ClickHouse/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private function insertBatch(array $rows): void
if (200 !== $response->getStatusCode()) {
$content = $response->getContent(false);

throw new RuntimeException("Could not insert data into ClickHouse. Http status code: {$response->getStatusCode()}. Response: {$content}.");
throw new RuntimeException(\sprintf('Could not insert data into ClickHouse. Http status code: %d. Response: "%s".', $response->getStatusCode(), $content));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/store/tests/Bridge/ClickHouse/StoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function testAddThrowsExceptionOnHttpError()
$store = new Store($httpClient, 'test_db', 'test_table');

$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Could not insert data into ClickHouse. Http status code: 500. Response: Internal Server Error.');
$this->expectExceptionMessage('Could not insert data into ClickHouse. Http status code: 500. Response: "Internal Server Error".');

$store->add($document);
}
Expand Down