Skip to content

2.2.0

Latest

Choose a tag to compare

@elliotjreed elliotjreed released this 27 Jun 10:05
9ca3850

Adds PromptInterface for easier testing and autowiring in Symfony.

Here's an example of a Symfony integration in the services.yaml file using the interface:

  guzzle.client.ai:
    class: GuzzleHttp\Client
    arguments:
      - {
        timeout: 10,
        headers: {
          'User-Agent': 'My Symfony Project'
        }
      }

  ElliotJReed\AI\PromptInterface:
    class: ElliotJReed\AI\ChatGPT\Prompt
    arguments:
      $apiKey: '%env(string:CHATGPT_API_KEY)%'
      $model: 'gpt-4o-mini'
      $client: '@guzzle.client.ai'

By using the PromptInterface you can use it in your application like:

<?php

public function __construct(private \ElliotJReed\AI\Claude\PromptInterface $aiClient)
{
}