Skip to content

Commit 0965572

Browse files
committed
refactor(core): chat sub-component started
1 parent 0748a72 commit 0965572

17 files changed

+185
-15
lines changed

examples/misc/persistent-chat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
use Symfony\AI\Agent\Agent;
1313
use Symfony\AI\Agent\Chat;
14-
use Symfony\AI\Agent\Chat\MessageStore\InMemoryStore;
14+
use Symfony\AI\Chat\Bridge\Local\InMemoryStore;
1515
use Symfony\AI\Platform\Bridge\OpenAi\Gpt;
1616
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
1717
use Symfony\AI\Platform\Message\Message;

src/chat/.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.github export-ignore
2+
/tests export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
phpstan.dist.neon export-ignore
6+
phpunit.xml.dist export-ignore
7+
CLAUDE.md export-ignore
8+
AGENTS.md export-ignore
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
4+
Please submit your PR here instead:
5+
https://github.com/symfony/ai
6+
7+
This repository is what we call a "subtree split": a read-only subset of that main repository.
8+
We're looking forward to your PR there!
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Close Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: superbrothers/close-pull-request@v3
12+
with:
13+
comment: |
14+
Thanks for your Pull Request! We love contributions.
15+
16+
However, you should instead open your PR on the main repository:
17+
https://github.com/symfony/ai
18+
19+
This repository is what we call a "subtree split": a read-only subset of that main repository.
20+
We're looking forward to your PR there!

src/chat/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
composer.lock
2+
vendor
3+
.phpunit.cache

src/chat/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2025-present Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

src/chat/composer.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "symfony/ai-chat",
3+
"description": "PHP library for building chats with agents.",
4+
"license": "MIT",
5+
"type": "library",
6+
"keywords": [
7+
"ai",
8+
"llm",
9+
"agent"
10+
],
11+
"authors": [
12+
{
13+
"name": "Christopher Hertel",
14+
"email": "[email protected]"
15+
},
16+
{
17+
"name": "Oskar Stark",
18+
"email": "[email protected]"
19+
}
20+
],
21+
"require": {
22+
"php": ">=8.2",
23+
"symfony/ai-agent": "@dev",
24+
"symfony/ai-platform": "@dev"
25+
},
26+
"require-dev": {
27+
"phpstan/phpstan": "^2.0",
28+
"phpstan/phpstan-strict-rules": "^2.0",
29+
"phpunit/phpunit": "^11.5.13",
30+
"symfony/http-foundation": "^7.3|^8.0",
31+
"psr/cache": "^3.0"
32+
},
33+
"autoload": {
34+
"psr-4": {
35+
"Symfony\\AI\\Chat\\": "src/"
36+
}
37+
},
38+
"autoload-dev": {
39+
"psr-4": {
40+
"Symfony\\AI\\Chat\\Tests\\": "tests/",
41+
"Symfony\\AI\\PHPStan\\": "../../.phpstan/"
42+
}
43+
},
44+
"config": {
45+
"sort-packages": true
46+
},
47+
"extra": {
48+
"thanks": {
49+
"name": "symfony/ai",
50+
"url": "https://github.com/symfony/ai"
51+
}
52+
},
53+
"minimum-stability": "dev"
54+
}

src/chat/doc/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Symfony AI - Chat Component
2+
============================
3+
4+
The Agent component provides a framework for building AI agents that, sits on top of the Platform and Store components,
5+
allowing you to create agents that can interact with users, perform tasks, and manage workflows.
6+
7+
Installation
8+
------------
9+
10+
Install the component using Composer:
11+
12+
.. code-block:: terminal
13+
14+
$ composer require symfony/ai-chat
15+
16+
Basic Usage
17+
-----------

src/chat/phpstan.dist.neon

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
includes:
2+
- ../../.phpstan/extension.neon
3+
4+
parameters:
5+
level: 6
6+
paths:
7+
- src/
8+
- tests/
9+
ignoreErrors:
10+
-
11+
message: "#^Method .*::test.*\\(\\) has no return type specified\\.$#"
12+
-
13+
identifier: missingType.iterableValue
14+
path: tests/*
15+
-
16+
identifier: 'symfonyAi.forbidNativeException'
17+
path: tests/*

src/chat/phpunit.xml.dist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheDirectory=".phpunit.cache"
6+
colors="true"
7+
executionOrder="depends,defects"
8+
beStrictAboutOutputDuringTests="true"
9+
failOnRisky="true"
10+
failOnWarning="true">
11+
<testsuites>
12+
<testsuite name="symfony/ai-agent">
13+
<directory>tests</directory>
14+
</testsuite>
15+
</testsuites>
16+
17+
<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
18+
<include>
19+
<directory>src</directory>
20+
</include>
21+
</source>
22+
</phpunit>

0 commit comments

Comments
 (0)