diff --git a/composer.json b/composer.json index 564a154..566b3d4 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": ">=8.2", - "php-llm/llm-chain": "^0.6", + "php-llm/llm-chain": "^0.7", "symfony/config": "^6.4 || ^7.0", "symfony/dependency-injection": "^6.4 || ^7.0", "symfony/framework-bundle": "^6.4 || ^7.0" diff --git a/src/DependencyInjection/LlmChainExtension.php b/src/DependencyInjection/LlmChainExtension.php index faaa5f2..2957f19 100644 --- a/src/DependencyInjection/LlmChainExtension.php +++ b/src/DependencyInjection/LlmChainExtension.php @@ -102,7 +102,7 @@ private function processPlatformConfig(string $name, array $platform, ContainerB $definition ->replaceArgument('$baseUrl', $platform['base_url']) ->replaceArgument('$deployment', $platform['deployment']) - ->replaceArgument('$key', $platform['api_key']) + ->replaceArgument('$apiKey', $platform['api_key']) ->replaceArgument('$apiVersion', $platform['version']); $container->setDefinition('llm_chain.platform.'.$name, $definition); diff --git a/src/Profiler/TraceableLanguageModel.php b/src/Profiler/TraceableLanguageModel.php index b79d947..2bd166d 100644 --- a/src/Profiler/TraceableLanguageModel.php +++ b/src/Profiler/TraceableLanguageModel.php @@ -6,13 +6,13 @@ use PhpLlm\LlmChain\LanguageModel; use PhpLlm\LlmChain\Message\MessageBag; -use PhpLlm\LlmChain\Response\Response; +use PhpLlm\LlmChain\Response\ResponseInterface; /** * @phpstan-type LlmCallData array{ * messages: MessageBag, * options: array, - * response: Response, + * response: ResponseInterface, * } */ final class TraceableLanguageModel implements LanguageModel @@ -28,7 +28,7 @@ public function __construct( ) { } - public function call(MessageBag $messages, array $options = []): Response + public function call(MessageBag $messages, array $options = []): ResponseInterface { $response = $this->llm->call($messages, $options); diff --git a/src/Resources/config/services.php b/src/Resources/config/services.php index 56d5aac..d073e51 100644 --- a/src/Resources/config/services.php +++ b/src/Resources/config/services.php @@ -19,6 +19,7 @@ use PhpLlm\LlmChain\Store\Pinecone\Store as PineconeStore; use PhpLlm\LlmChain\StructuredOutput\ChainProcessor as StructureOutputProcessor; use PhpLlm\LlmChain\StructuredOutput\ResponseFormatFactory; +use PhpLlm\LlmChain\StructuredOutput\ResponseFormatFactoryInterface; use PhpLlm\LlmChain\StructuredOutput\SchemaFactory; use PhpLlm\LlmChain\ToolBox\ChainProcessor as ToolProcessor; use PhpLlm\LlmChain\ToolBox\ParameterAnalyzer; @@ -53,7 +54,7 @@ '$baseUrl' => abstract_arg('Base URL for Azure API'), '$deployment' => abstract_arg('Deployment for Azure API'), '$apiVersion' => abstract_arg('API version for Azure API'), - '$key' => abstract_arg('API key for Azure API'), + '$apiKey' => abstract_arg('API key for Azure API'), ]) ->set(OpenAIPlatform::class) ->abstract() @@ -106,8 +107,8 @@ // structured output ->set(ResponseFormatFactory::class) + ->alias(ResponseFormatFactoryInterface::class, ResponseFormatFactory::class) ->set(SchemaFactory::class) - ->factory([SchemaFactory::class, 'create']) ->set(StructureOutputProcessor::class) // tools