Files

1 line
12 KiB
JSON

{"repo": "aiaccess/ai-access", "files": {"src/Provider/DeepSeek/Client.php": {"4a75254fbea95893959e89728b6e8d0d24774651": {"t": 1785746140.6821141, "n": 1731, "h": "11bbeda1ae5440de", "c": "<?php declare(strict_types=1);\n\n/**\n * This file is part of the AI Access library.\n * Copyright (c) 2024 David Grudl (https://davidgrudl.com)\n */\n\nnamespace AIAccess\\Provider\\DeepSeek;\n\nuse AIAccess;\nuse AIAccess\\Http;\nuse function is_array, rtrim;\n\n\n/**\n * Client implementation for accessing DeepSeek API models.\n */\nfinal class Client implements AIAccess\\Chat\\Service\n{\n\tprivate string $baseUrl = 'https://api.deepseek.com/';\n\n\n\tpublic function __construct(\n\t\tprivate readonly string $apiKey,\n\t\tprivate readonly Http\\Client $httpClient = new Http\\CurlClient,\n\t) {\n\t}\n\n\n\tpublic function createChat(string $model): Chat\n\t{\n\t\treturn new Chat($this, $model);\n\t}\n\n\n\t/**\n\t * Sets or updates client-wide options.\n\t * @param ?string $customBaseUrl Override the base API URL. Null leaves current setting unchanged.\n\t */\n\tpublic function setOptions(\n\t\t?string $customBaseUrl = null,\n\t): static\n\t{\n\t\tif ($customBaseUrl !== null) {\n\t\t\t$this->baseUrl = rtrim($customBaseUrl, '/') . '/';\n\t\t}\n\t\treturn $this;\n\t}\n\n\n\t/**\n\t * @param mixed[] $payload\n\t * @return mixed[]\n\t * @throws AIAccess\\ServiceException\n\t * @internal\n\t */\n\tpublic function callApi(string $endpoint, array $payload): array\n\t{\n\t\t$headers = [\n\t\t\t'Authorization' => 'Bearer ' . $this->apiKey,\n\t\t];\n\n\t\t$response = $this->httpClient->fetch($this->baseUrl . $endpoint, $payload, $headers);\n\t\t$data = $response->getData();\n\n\t\tif ($response->getStatusCode() >= 400) {\n\t\t\t$errorMessage = $data['error']['message'] ?? \"DeepSeek API error (HTTP {$response->getStatusCode()})\";\n\t\t\tthrow new AIAccess\\ApiException($errorMessage, $response->getStatusCode());\n\t\t}\n\n\t\treturn is_array($data)\n\t\t\t? $data\n\t\t\t: throw new AIAccess\\ApiException('Invalid JSON response from DeepSeek API');\n\t}\n}\n"}, "03db896ad04b93210c609963cc69b04f28566fdb": {"t": 1785760121.6273313, "n": 1731, "h": "11bbeda1ae5440de", "c": "<?php declare(strict_types=1);\n\n/**\n * This file is part of the AI Access library.\n * Copyright (c) 2024 David Grudl (https://davidgrudl.com)\n */\n\nnamespace AIAccess\\Provider\\DeepSeek;\n\nuse AIAccess;\nuse AIAccess\\Http;\nuse function is_array, rtrim;\n\n\n/**\n * Client implementation for accessing DeepSeek API models.\n */\nfinal class Client implements AIAccess\\Chat\\Service\n{\n\tprivate string $baseUrl = 'https://api.deepseek.com/';\n\n\n\tpublic function __construct(\n\t\tprivate readonly string $apiKey,\n\t\tprivate readonly Http\\Client $httpClient = new Http\\CurlClient,\n\t) {\n\t}\n\n\n\tpublic function createChat(string $model): Chat\n\t{\n\t\treturn new Chat($this, $model);\n\t}\n\n\n\t/**\n\t * Sets or updates client-wide options.\n\t * @param ?string $customBaseUrl Override the base API URL. Null leaves current setting unchanged.\n\t */\n\tpublic function setOptions(\n\t\t?string $customBaseUrl = null,\n\t): static\n\t{\n\t\tif ($customBaseUrl !== null) {\n\t\t\t$this->baseUrl = rtrim($customBaseUrl, '/') . '/';\n\t\t}\n\t\treturn $this;\n\t}\n\n\n\t/**\n\t * @param mixed[] $payload\n\t * @return mixed[]\n\t * @throws AIAccess\\ServiceException\n\t * @internal\n\t */\n\tpublic function callApi(string $endpoint, array $payload): array\n\t{\n\t\t$headers = [\n\t\t\t'Authorization' => 'Bearer ' . $this->apiKey,\n\t\t];\n\n\t\t$response = $this->httpClient->fetch($this->baseUrl . $endpoint, $payload, $headers);\n\t\t$data = $response->getData();\n\n\t\tif ($response->getStatusCode() >= 400) {\n\t\t\t$errorMessage = $data['error']['message'] ?? \"DeepSeek API error (HTTP {$response->getStatusCode()})\";\n\t\t\tthrow new AIAccess\\ApiException($errorMessage, $response->getStatusCode());\n\t\t}\n\n\t\treturn is_array($data)\n\t\t\t? $data\n\t\t\t: throw new AIAccess\\ApiException('Invalid JSON response from DeepSeek API');\n\t}\n}\n"}, "b408b3320ea03fd5ba9162e0b49572a7f5a3f02a": {"t": 1785760123.1068442, "n": 1713, "h": "6d3f6e1710c5a841", "c": "<?php declare(strict_types=1);\n\n/**\n * This file is part of the AI Access library.\n * Copyright (c) 2024 David Grudl (https://davidgrudl.com)\n */\n\nnamespace AIAccess\\Provider\\DeepSeek;\n\nuse AIAccess;\nuse AIAccess\\Http;\nuse function is_array, rtrim;\n\n\n/**\n * Client implementation for accessing DeepSeek API models.\n */\nfinal class Client implements AIAccess\\Chat\\Service\n{\n\tprivate string $baseUrl = 'https://api.deepseek.com/';\n\n\n\tpublic function __construct(\n\t\tprivate string $apiKey,\n\t\tprivate Http\\Client $httpClient = new Http\\CurlClient,\n\t) {\n\t}\n\n\n\tpublic function createChat(string $model): Chat\n\t{\n\t\treturn new Chat($this, $model);\n\t}\n\n\n\t/**\n\t * Sets or updates client-wide options.\n\t * @param ?string $customBaseUrl Override the base API URL. Null leaves current setting unchanged.\n\t */\n\tpublic function setOptions(\n\t\t?string $customBaseUrl = null,\n\t): static\n\t{\n\t\tif ($customBaseUrl !== null) {\n\t\t\t$this->baseUrl = rtrim($customBaseUrl, '/') . '/';\n\t\t}\n\t\treturn $this;\n\t}\n\n\n\t/**\n\t * @param mixed[] $payload\n\t * @return mixed[]\n\t * @throws AIAccess\\ServiceException\n\t * @internal\n\t */\n\tpublic function callApi(string $endpoint, array $payload): array\n\t{\n\t\t$headers = [\n\t\t\t'Authorization' => 'Bearer ' . $this->apiKey,\n\t\t];\n\n\t\t$response = $this->httpClient->fetch($this->baseUrl . $endpoint, $payload, $headers);\n\t\t$data = $response->getData();\n\n\t\tif ($response->getStatusCode() >= 400) {\n\t\t\t$errorMessage = $data['error']['message'] ?? \"DeepSeek API error (HTTP {$response->getStatusCode()})\";\n\t\t\tthrow new AIAccess\\ApiException($errorMessage, $response->getStatusCode());\n\t\t}\n\n\t\treturn is_array($data)\n\t\t\t? $data\n\t\t\t: throw new AIAccess\\ApiException('Invalid JSON response from DeepSeek API');\n\t}\n}\n"}, "16eb53fb70a83d2a58cb1bf99bcfcf390bf6ceef": {"t": 1785760124.4568317, "n": 1714, "h": "30a7e6a6e0b87c4c", "c": "<?php\n\n/**\n * This file is part of the AI Access library.\n * Copyright (c) 2024 David Grudl (https://davidgrudl.com)\n */\n\ndeclare(strict_types=1);\n\nnamespace AIAccess\\Provider\\DeepSeek;\n\nuse AIAccess;\nuse AIAccess\\Http;\nuse function is_array, rtrim;\n\n\n/**\n * Client implementation for accessing DeepSeek API models.\n */\nfinal class Client implements AIAccess\\Chat\\Service\n{\n\tprivate string $baseUrl = 'https://api.deepseek.com/';\n\n\n\tpublic function __construct(\n\t\tprivate string $apiKey,\n\t\tprivate Http\\Client $httpClient = new Http\\CurlClient,\n\t) {\n\t}\n\n\n\tpublic function createChat(string $model): Chat\n\t{\n\t\treturn new Chat($this, $model);\n\t}\n\n\n\t/**\n\t * Sets or updates client-wide options.\n\t * @param ?string $customBaseUrl Override the base API URL. Null leaves current setting unchanged.\n\t */\n\tpublic function setOptions(\n\t\t?string $customBaseUrl = null,\n\t): static\n\t{\n\t\tif ($customBaseUrl !== null) {\n\t\t\t$this->baseUrl = rtrim($customBaseUrl, '/') . '/';\n\t\t}\n\t\treturn $this;\n\t}\n\n\n\t/**\n\t * @param mixed[] $payload\n\t * @return mixed[]\n\t * @throws AIAccess\\ServiceException\n\t * @internal\n\t */\n\tpublic function callApi(string $endpoint, array $payload): array\n\t{\n\t\t$headers = [\n\t\t\t'Authorization' => 'Bearer ' . $this->apiKey,\n\t\t];\n\n\t\t$response = $this->httpClient->fetch($this->baseUrl . $endpoint, $payload, $headers);\n\t\t$data = $response->getData();\n\n\t\tif ($response->getStatusCode() >= 400) {\n\t\t\t$errorMessage = $data['error']['message'] ?? \"DeepSeek API error (HTTP {$response->getStatusCode()})\";\n\t\t\tthrow new AIAccess\\ApiException($errorMessage, $response->getStatusCode());\n\t\t}\n\n\t\treturn is_array($data)\n\t\t\t? $data\n\t\t\t: throw new AIAccess\\ApiException('Invalid JSON response from DeepSeek API');\n\t}\n}\n"}, "dcb156156657d5349e6b24b2d89e01ce4424a0bc": {"t": 1785760126.0244534, "n": 1684, "h": "8644b7a09b22d99a", "c": "<?php\n\n/**\n * This file is part of the AI Access library.\n * Copyright (c) 2024 David Grudl (https://davidgrudl.com)\n */\n\ndeclare(strict_types=1);\n\nnamespace AIAccess\\Provider\\DeepSeek;\n\nuse AIAccess;\nuse AIAccess\\Http;\n\n\n/**\n * Client implementation for accessing DeepSeek API models.\n */\nfinal class Client implements AIAccess\\Chat\\Service\n{\n\tprivate string $baseUrl = 'https://api.deepseek.com/';\n\n\n\tpublic function __construct(\n\t\tprivate string $apiKey,\n\t\tprivate Http\\Client $httpClient = new Http\\CurlClient,\n\t) {\n\t}\n\n\n\tpublic function createChat(string $model): Chat\n\t{\n\t\treturn new Chat($this, $model);\n\t}\n\n\n\t/**\n\t * Sets or updates client-wide options.\n\t * @param ?string $customBaseUrl Override the base API URL. Null leaves current setting unchanged.\n\t */\n\tpublic function setOptions(\n\t\t?string $customBaseUrl = null,\n\t): static\n\t{\n\t\tif ($customBaseUrl !== null) {\n\t\t\t$this->baseUrl = rtrim($customBaseUrl, '/') . '/';\n\t\t}\n\t\treturn $this;\n\t}\n\n\n\t/**\n\t * @param mixed[] $payload\n\t * @return mixed[]\n\t * @throws AIAccess\\ServiceException\n\t * @internal\n\t */\n\tpublic function callApi(string $endpoint, array $payload): array\n\t{\n\t\t$headers = [\n\t\t\t'Authorization' => 'Bearer ' . $this->apiKey,\n\t\t];\n\n\t\t$response = $this->httpClient->fetch($this->baseUrl . $endpoint, $payload, $headers);\n\t\t$data = $response->getData();\n\n\t\tif ($response->getStatusCode() >= 400) {\n\t\t\t$errorMessage = $data['error']['message'] ?? \"DeepSeek API error (HTTP {$response->getStatusCode()})\";\n\t\t\tthrow new AIAccess\\ApiException($errorMessage, $response->getStatusCode());\n\t\t}\n\n\t\treturn is_array($data)\n\t\t\t? $data\n\t\t\t: throw new AIAccess\\ApiException('Invalid JSON response from DeepSeek API');\n\t}\n}\n"}, "922daa010051cee92b6850132f271f7982e04c59": {"t": 1785760127.5032587, "n": 1560, "h": "51ad68b96b110b3b", "c": "<?php\n\n/**\n * This file is part of the AI Access library.\n * Copyright (c) 2024 David Grudl (https://davidgrudl.com)\n */\n\ndeclare(strict_types=1);\n\nnamespace AIAccess\\Provider\\DeepSeek;\n\nuse AIAccess;\nuse AIAccess\\Http;\n\n\n/**\n * Client implementation for accessing DeepSeek API models.\n */\nfinal class Client\n{\n\tprivate string $baseUrl = 'https://api.deepseek.com/';\n\n\n\tpublic function __construct(\n\t\tprivate string $apiKey,\n\t\tprivate Http\\Client $httpClient = new Http\\CurlClient,\n\t) {\n\t}\n\n\n\t/**\n\t * Sets or updates client-wide options.\n\t * @param ?string $customBaseUrl Override the base API URL. Null leaves current setting unchanged.\n\t */\n\tpublic function setOptions(\n\t\t?string $customBaseUrl = null,\n\t): static\n\t{\n\t\tif ($customBaseUrl !== null) {\n\t\t\t$this->baseUrl = rtrim($customBaseUrl, '/') . '/';\n\t\t}\n\t\treturn $this;\n\t}\n\n\n\t/**\n\t * @param mixed[] $payload\n\t * @return mixed[]\n\t * @throws AIAccess\\ServiceException\n\t * @internal\n\t */\n\tpublic function callApi(string $endpoint, array $payload): array\n\t{\n\t\t$headers = [\n\t\t\t'Authorization' => 'Bearer ' . $this->apiKey,\n\t\t];\n\n\t\t$response = $this->httpClient->fetch($this->baseUrl . $endpoint, $payload, $headers);\n\t\t$data = $response->getData();\n\n\t\tif ($response->getStatusCode() >= 400) {\n\t\t\t$errorMessage = $data['error']['message'] ?? \"DeepSeek API error (HTTP {$response->getStatusCode()})\";\n\t\t\tthrow new AIAccess\\ApiException($errorMessage, $response->getStatusCode());\n\t\t}\n\n\t\treturn is_array($data)\n\t\t\t? $data\n\t\t\t: throw new AIAccess\\ApiException('Invalid JSON response from DeepSeek API');\n\t}\n}\n"}}}}