Skip to content

Commit b6f437a

Browse files
committed
-
1 parent 53bd46d commit b6f437a

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

src/platform/src/Bridge/Anthropic/PlatformFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\AI\Platform\Bridge\Anthropic\Contract\AnthropicContract;
1515
use Symfony\AI\Platform\Contract;
16+
use Symfony\AI\Platform\ModelCatalog\ModelCatalogInterface;
1617
use Symfony\AI\Platform\Platform;
1718
use Symfony\Component\HttpClient\EventSourceHttpClient;
1819
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -25,14 +26,15 @@
2526
public static function create(
2627
#[\SensitiveParameter] string $apiKey,
2728
?HttpClientInterface $httpClient = null,
29+
ModelCatalogInterface $modelCatalog = new ModelCatalog(),
2830
?Contract $contract = null,
2931
): Platform {
3032
$httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient);
3133

3234
return new Platform(
3335
[new ModelClient($httpClient, $apiKey)],
3436
[new ResultConverter()],
35-
new ModelCatalog(),
37+
$modelCatalog,
3638
$contract ?? AnthropicContract::create(),
3739
);
3840
}

src/platform/src/Bridge/Azure/Meta/PlatformFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\AI\Platform\Bridge\Azure\Meta;
1313

1414
use Symfony\AI\Platform\Contract;
15+
use Symfony\AI\Platform\ModelCatalog\ModelCatalogInterface;
1516
use Symfony\AI\Platform\Platform;
1617
use Symfony\Component\HttpClient\HttpClient;
1718
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -25,10 +26,11 @@ public static function create(
2526
string $baseUrl,
2627
#[\SensitiveParameter] string $apiKey,
2728
?HttpClientInterface $httpClient = null,
29+
ModelCatalogInterface $modelCatalog = new ModelCatalog(),
2830
?Contract $contract = null,
2931
): Platform {
3032
$modelClient = new LlamaModelClient($httpClient ?? HttpClient::create(), $baseUrl, $apiKey);
3133

32-
return new Platform([$modelClient], [new LlamaResultConverter()], new ModelCatalog(), $contract);
34+
return new Platform([$modelClient], [new LlamaResultConverter()], $modelCatalog, $contract);
3335
}
3436
}

src/platform/src/Bridge/Gemini/PlatformFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\AI\Platform\Bridge\Gemini\Gemini\ModelClient as GeminiModelClient;
1818
use Symfony\AI\Platform\Bridge\Gemini\Gemini\ResultConverter as GeminiResultConverter;
1919
use Symfony\AI\Platform\Contract;
20+
use Symfony\AI\Platform\ModelCatalog\ModelCatalogInterface;
2021
use Symfony\AI\Platform\Platform;
2122
use Symfony\Component\HttpClient\EventSourceHttpClient;
2223
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -29,14 +30,15 @@
2930
public static function create(
3031
#[\SensitiveParameter] string $apiKey,
3132
?HttpClientInterface $httpClient = null,
33+
ModelCatalogInterface $modelCatalog = new ModelCatalog(),
3234
?Contract $contract = null,
3335
): Platform {
3436
$httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient);
3537

3638
return new Platform(
3739
[new EmbeddingsModelClient($httpClient, $apiKey), new GeminiModelClient($httpClient, $apiKey)],
3840
[new EmbeddingsResultConverter(), new GeminiResultConverter()],
39-
new ModelCatalog(),
41+
$modelCatalog,
4042
$contract ?? GeminiContract::create(),
4143
);
4244
}

src/platform/src/Bridge/Ollama/PlatformFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\AI\Platform\Bridge\Ollama\Contract\OllamaContract;
1515
use Symfony\AI\Platform\Contract;
16+
use Symfony\AI\Platform\ModelCatalog\ModelCatalogInterface;
1617
use Symfony\AI\Platform\Platform;
1718
use Symfony\Component\HttpClient\EventSourceHttpClient;
1819
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -25,14 +26,15 @@ final class PlatformFactory
2526
public static function create(
2627
string $hostUrl = 'http://localhost:11434',
2728
?HttpClientInterface $httpClient = null,
29+
ModelCatalogInterface $modelCatalog = new ModelCatalog(),
2830
?Contract $contract = null,
2931
): Platform {
3032
$httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient);
3133

3234
return new Platform(
3335
[new OllamaClient($httpClient, $hostUrl)],
3436
[new OllamaResultConverter()],
35-
new ModelCatalog(),
37+
$modelCatalog,
3638
$contract ?? OllamaContract::create(),
3739
);
3840
}

src/platform/src/Bridge/OpenAi/PlatformFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\AI\Platform\Bridge\OpenAi\Contract\OpenAiContract;
1515
use Symfony\AI\Platform\Contract;
16+
use Symfony\AI\Platform\ModelCatalog\ModelCatalogInterface;
1617
use Symfony\AI\Platform\Platform;
1718
use Symfony\Component\HttpClient\EventSourceHttpClient;
1819
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -28,6 +29,7 @@
2829
public static function create(
2930
#[\SensitiveParameter] string $apiKey,
3031
?HttpClientInterface $httpClient = null,
32+
ModelCatalogInterface $modelCatalog = new ModelCatalog(),
3133
?Contract $contract = null,
3234
?string $region = null,
3335
): Platform {
@@ -46,7 +48,7 @@ public static function create(
4648
new DallE\ResultConverter(),
4749
new Whisper\ResultConverter(),
4850
],
49-
new ModelCatalog(),
51+
$modelCatalog,
5052
$contract ?? OpenAiContract::create(),
5153
);
5254
}

0 commit comments

Comments
 (0)