• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eliashaeussler / typo3-solver / 14341185346

08 Apr 2025 06:42PM UTC coverage: 81.115% (-7.1%) from 88.172%
14341185346

Pull #323

github

eliashaeussler
[FEATURE] Add Claude as additional solution provider
Pull Request #323: [FEATURE] Add Claude as additional solution provider

3 of 92 new or added lines in 5 files covered. (3.26%)

902 of 1112 relevant lines covered (81.12%)

2.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

44.44
/Classes/ProblemSolving/Solution/Provider/Model/AiModel.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "solver".
7
 *
8
 * Copyright (C) 2023-2025 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\Typo3Solver\ProblemSolving\Solution\Provider\Model;
25

26
use OpenAI\Responses;
27

28
/**
29
 * AiModel
30
 *
31
 * @author Elias Häußler <elias@haeussler.dev>
32
 * @license GPL-2.0-or-later
33
 */
34
final class AiModel
35
{
36
    public function __construct(
1✔
37
        public readonly string $name,
38
        public readonly ?\DateTimeImmutable $createdAt = null,
39
    ) {}
1✔
40

41
    public static function fromOpenAIRetrieveResponse(Responses\Models\RetrieveResponse $response): self
1✔
42
    {
43
        return new self($response->id, new \DateTimeImmutable('@' . $response->created));
1✔
44
    }
45

46
    /**
47
     * @param array{created_at: string, display_name: string, id: string, type: string} $model
48
     */
NEW
49
    public static function fromAnthropicModel(array $model): self
×
50
    {
NEW
51
        $createdAt = \DateTimeImmutable::createFromFormat(\DateTimeInterface::RFC3339, $model['created_at']);
×
52

NEW
53
        if ($createdAt === false) {
×
NEW
54
            $createdAt = null;
×
55
        }
56

NEW
57
        return new self($model['id'], $createdAt);
×
58
    }
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc