Skip to content

Commit ba527bf

Browse files
chore: Require php-llm/llm-chain 0.7.0 (#38)
* Require `php-llm/llm-chain` 0.7.0 * fix: service definitions * fix: adopt LLM interface changes --------- Co-authored-by: Christopher Hertel <[email protected]>
1 parent 3a08f92 commit ba527bf

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"require": {
1313
"php": ">=8.2",
14-
"php-llm/llm-chain": "^0.6",
14+
"php-llm/llm-chain": "^0.7",
1515
"symfony/config": "^6.4 || ^7.0",
1616
"symfony/dependency-injection": "^6.4 || ^7.0",
1717
"symfony/framework-bundle": "^6.4 || ^7.0"

src/DependencyInjection/LlmChainExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private function processPlatformConfig(string $name, array $platform, ContainerB
102102
$definition
103103
->replaceArgument('$baseUrl', $platform['base_url'])
104104
->replaceArgument('$deployment', $platform['deployment'])
105-
->replaceArgument('$key', $platform['api_key'])
105+
->replaceArgument('$apiKey', $platform['api_key'])
106106
->replaceArgument('$apiVersion', $platform['version']);
107107

108108
$container->setDefinition('llm_chain.platform.'.$name, $definition);

src/Profiler/TraceableLanguageModel.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
use PhpLlm\LlmChain\LanguageModel;
88
use PhpLlm\LlmChain\Message\MessageBag;
9-
use PhpLlm\LlmChain\Response\Response;
9+
use PhpLlm\LlmChain\Response\ResponseInterface;
1010

1111
/**
1212
* @phpstan-type LlmCallData array{
1313
* messages: MessageBag,
1414
* options: array<string, mixed>,
15-
* response: Response,
15+
* response: ResponseInterface,
1616
* }
1717
*/
1818
final class TraceableLanguageModel implements LanguageModel
@@ -28,7 +28,7 @@ public function __construct(
2828
) {
2929
}
3030

31-
public function call(MessageBag $messages, array $options = []): Response
31+
public function call(MessageBag $messages, array $options = []): ResponseInterface
3232
{
3333
$response = $this->llm->call($messages, $options);
3434

src/Resources/config/services.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use PhpLlm\LlmChain\Store\Pinecone\Store as PineconeStore;
2020
use PhpLlm\LlmChain\StructuredOutput\ChainProcessor as StructureOutputProcessor;
2121
use PhpLlm\LlmChain\StructuredOutput\ResponseFormatFactory;
22+
use PhpLlm\LlmChain\StructuredOutput\ResponseFormatFactoryInterface;
2223
use PhpLlm\LlmChain\StructuredOutput\SchemaFactory;
2324
use PhpLlm\LlmChain\ToolBox\ChainProcessor as ToolProcessor;
2425
use PhpLlm\LlmChain\ToolBox\ParameterAnalyzer;
@@ -53,7 +54,7 @@
5354
'$baseUrl' => abstract_arg('Base URL for Azure API'),
5455
'$deployment' => abstract_arg('Deployment for Azure API'),
5556
'$apiVersion' => abstract_arg('API version for Azure API'),
56-
'$key' => abstract_arg('API key for Azure API'),
57+
'$apiKey' => abstract_arg('API key for Azure API'),
5758
])
5859
->set(OpenAIPlatform::class)
5960
->abstract()
@@ -106,8 +107,8 @@
106107

107108
// structured output
108109
->set(ResponseFormatFactory::class)
110+
->alias(ResponseFormatFactoryInterface::class, ResponseFormatFactory::class)
109111
->set(SchemaFactory::class)
110-
->factory([SchemaFactory::class, 'create'])
111112
->set(StructureOutputProcessor::class)
112113

113114
// tools

0 commit comments

Comments
 (0)