Skip to content

Commit 042cb1c

Browse files
committed
chore: lib v0.24 compatibility
1 parent 0adf120 commit 042cb1c

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function getConfigTreeBuilder(): TreeBuilder
182182
->end()
183183
->end()
184184
->end()
185-
->arrayNode('embedder')
185+
->arrayNode('indexer')
186186
->normalizeKeys(false)
187187
->useAttributeAsKey('name')
188188
->arrayPrototype()

src/DependencyInjection/LlmChainExtension.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
use PhpLlm\LlmChain\Store\Bridge\ChromaDB\Store as ChromaDBStore;
4040
use PhpLlm\LlmChain\Store\Bridge\MongoDB\Store as MongoDBStore;
4141
use PhpLlm\LlmChain\Store\Bridge\Pinecone\Store as PineconeStore;
42-
use PhpLlm\LlmChain\Store\Embedder;
42+
use PhpLlm\LlmChain\Store\Indexer;
4343
use PhpLlm\LlmChain\Store\StoreInterface;
4444
use PhpLlm\LlmChain\Store\VectorStoreInterface;
4545
use PhpLlm\LlmChainBundle\Profiler\DataCollector;
@@ -98,11 +98,11 @@ public function load(array $configs, ContainerBuilder $container): void
9898
$container->setAlias(StoreInterface::class, reset($stores));
9999
}
100100

101-
foreach ($config['embedder'] as $embedderName => $embedder) {
102-
$this->processEmbedderConfig($embedderName, $embedder, $container);
101+
foreach ($config['indexer'] as $indexerName => $indexer) {
102+
$this->processIndexerConfig($indexerName, $indexer, $container);
103103
}
104-
if (1 === count($config['embedder']) && isset($embedderName)) {
105-
$container->setAlias(Embedder::class, 'llm_chain.embedder.'.$embedderName);
104+
if (1 === count($config['indexer']) && isset($indexerName)) {
105+
$container->setAlias(Indexer::class, 'llm_chain.indexer.'.$indexerName);
106106
}
107107

108108
$container->registerAttributeForAutoconfiguration(AsTool::class, static function (ChildDefinition $definition, AsTool $attribute): void {
@@ -455,7 +455,7 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
455455
/**
456456
* @param array<string, mixed> $config
457457
*/
458-
private function processEmbedderConfig(int|string $name, array $config, ContainerBuilder $container): void
458+
private function processIndexerConfig(int|string $name, array $config, ContainerBuilder $container): void
459459
{
460460
['name' => $modelName, 'version' => $version, 'options' => $options] = $config['model'];
461461

@@ -472,14 +472,14 @@ private function processEmbedderConfig(int|string $name, array $config, Containe
472472
$modelDefinition->setArgument('$options', $options);
473473
}
474474
$modelDefinition->addTag('llm_chain.model.embeddings_model');
475-
$container->setDefinition('llm_chain.embedder.'.$name.'.model', $modelDefinition);
475+
$container->setDefinition('llm_chain.indexer.'.$name.'.model', $modelDefinition);
476476

477-
$definition = new Definition(Embedder::class, [
478-
'$model' => new Reference('llm_chain.embedder.'.$name.'.model'),
477+
$definition = new Definition(Indexer::class, [
478+
'$model' => new Reference('llm_chain.indexer.'.$name.'.model'),
479479
'$platform' => new Reference($config['platform']),
480480
'$store' => new Reference($config['store']),
481481
]);
482482

483-
$container->setDefinition('llm_chain.embedder.'.$name, $definition);
483+
$container->setDefinition('llm_chain.indexer.'.$name, $definition);
484484
}
485485
}

src/Profiler/TraceablePlatform.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
use PhpLlm\LlmChain\Platform\Message\Content\File;
88
use PhpLlm\LlmChain\Platform\Model;
99
use PhpLlm\LlmChain\Platform\PlatformInterface;
10-
use PhpLlm\LlmChain\Platform\Response\ResponseInterface;
10+
use PhpLlm\LlmChain\Platform\Response\ResponsePromise;
1111

1212
/**
1313
* @phpstan-type PlatformCallData array{
1414
* model: Model,
1515
* input: array<mixed>|string|object,
1616
* options: array<string, mixed>,
17-
* response: ResponseInterface,
17+
* response: ResponsePromise,
1818
* }
1919
*/
2020
final class TraceablePlatform implements PlatformInterface
@@ -29,7 +29,7 @@ public function __construct(
2929
) {
3030
}
3131

32-
public function request(Model $model, array|string|object $input, array $options = []): ResponseInterface
32+
public function request(Model $model, array|string|object $input, array $options = []): ResponsePromise
3333
{
3434
$response = $this->platform->request($model, $input, $options);
3535

@@ -41,7 +41,7 @@ public function request(Model $model, array|string|object $input, array $options
4141
'model' => $model,
4242
'input' => is_object($input) ? clone $input : $input,
4343
'options' => $options,
44-
'response' => $response->getContent(),
44+
'response' => $response,
4545
];
4646

4747
return $response;

0 commit comments

Comments
 (0)