diff --git a/.github/workflows/code-quality.yaml b/.github/workflows/code-quality.yaml index 058574ba0..a43fc344c 100644 --- a/.github/workflows/code-quality.yaml +++ b/.github/workflows/code-quality.yaml @@ -29,7 +29,7 @@ jobs: - name: Configure environment run: | echo COLUMNS=120 >> $GITHUB_ENV - echo COMPOSER_UP='composer update --no-progress --no-interaction --ansi --ignore-platform-req=ext-mongodb' >> $GITHUB_ENV + echo COMPOSER_UP='composer update --no-progress --no-interaction --no-scripts --ansi --ignore-platform-req=ext-mongodb' >> $GITHUB_ENV echo PHPSTAN='vendor/bin/phpstan' >> $GITHUB_ENV PACKAGES=$(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*" -printf '%h\n' | sed 's/^src\///' | grep -Ev "examples" | sort | tr '\n' ' ') diff --git a/demo/config/packages/ai.yaml b/demo/config/packages/ai.yaml index ed37f2a33..d7117a68f 100644 --- a/demo/config/packages/ai.yaml +++ b/demo/config/packages/ai.yaml @@ -25,10 +25,11 @@ ai: options: temperature: 0.5 prompt: - text: 'Please answer the users question based on Wikipedia and provide a link to the article.' + text: 'Please answer the users question based on Wikipedia, only use information provided in the messages.' include_tools: true tools: - 'Symfony\AI\Agent\Toolbox\Tool\Wikipedia' + include_sources: true audio: model: 'gpt-4o-mini?temperature=1.0' prompt: 'You are a friendly chatbot that likes to have a conversation with users and asks them some questions.' @@ -89,7 +90,7 @@ services: Symfony\AI\Store\Document\Loader\RssFeedLoader: ~ Symfony\AI\Store\Document\Transformer\TextTrimTransformer: ~ - + app.filter.week_of_symfony: class: 'Symfony\AI\Store\Document\Filter\TextContainsFilter' arguments: diff --git a/demo/src/Wikipedia/Chat.php b/demo/src/Wikipedia/Chat.php index cd9736f7a..19ec60f5c 100644 --- a/demo/src/Wikipedia/Chat.php +++ b/demo/src/Wikipedia/Chat.php @@ -43,7 +43,9 @@ public function submitMessage(string $message): void \assert($result instanceof TextResult); - $messages->add(Message::ofAssistant($result->getContent())); + $response = Message::ofAssistant($result->getContent()); + $response->getMetadata()->add('sources', $result->getMetadata()->get('sources', [])); + $messages->add($response); $this->saveMessages($messages); } diff --git a/demo/templates/components/wikipedia.html.twig b/demo/templates/components/wikipedia.html.twig index a187a1706..2e78014a9 100644 --- a/demo/templates/components/wikipedia.html.twig +++ b/demo/templates/components/wikipedia.html.twig @@ -1,4 +1,4 @@ -{% import "_message.html.twig" as message %} +{% import "_message.html.twig" as msg %}