Skip to content

Commit 2ff1c2e

Browse files
authored
Merge branch 'symfony:main' into store-add-pinecone-managedstore
2 parents 915ca28 + c5fe55c commit 2ff1c2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+282
-392
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
#
3+
# Validates that all bridges have the correct "type" field in composer.json.
4+
#
5+
# Usage: validate-bridge-type.sh <bridge_type> [component]
6+
#
7+
# Arguments:
8+
# bridge_type Type of bridge (e.g., "store", "tool", "platform", "message-store")
9+
# This determines the expected composer.json type: symfony-ai-{bridge_type}
10+
# component Name of the parent component (e.g., agent, platform, store, chat)
11+
# If not provided, defaults to bridge_type
12+
#
13+
# Example:
14+
# validate-bridge-type.sh store
15+
# validate-bridge-type.sh tool agent
16+
# validate-bridge-type.sh message-store chat
17+
#
18+
# The script builds the bridge path internally as: src/${component}/src/Bridge/*
19+
20+
set -e
21+
22+
BRIDGE_TYPE="${1:?Bridge type is required (e.g., store, tool, platform, message-store)}"
23+
COMPONENT="${2:-$BRIDGE_TYPE}"
24+
BRIDGE_PATH="src/${COMPONENT}/src/Bridge/*"
25+
26+
EXPECTED_TYPE="symfony-ai-${BRIDGE_TYPE}"
27+
ERRORS=0
28+
29+
echo "Validating ${BRIDGE_TYPE} bridges have correct type (${BRIDGE_PATH})..."
30+
echo "Expected type: ${EXPECTED_TYPE}"
31+
echo ""
32+
33+
for composer_file in ${BRIDGE_PATH}/composer.json; do
34+
if [[ ! -f "$composer_file" ]]; then
35+
continue
36+
fi
37+
38+
bridge_dir=$(dirname "$composer_file")
39+
bridge_name=$(basename "$bridge_dir")
40+
41+
actual_type=$(jq -r '.type // empty' "$composer_file")
42+
43+
if [[ -z "$actual_type" ]]; then
44+
echo "::error file=$composer_file::${BRIDGE_TYPE} bridge '$bridge_name' is missing 'type' field in composer.json"
45+
ERRORS=$((ERRORS + 1))
46+
elif [[ "$actual_type" != "$EXPECTED_TYPE" ]]; then
47+
echo "::error file=$composer_file::${BRIDGE_TYPE} bridge '$bridge_name' has incorrect type '$actual_type', expected '$EXPECTED_TYPE'"
48+
ERRORS=$((ERRORS + 1))
49+
else
50+
echo "$bridge_name: type '$actual_type' is correct"
51+
fi
52+
done
53+
54+
if [[ $ERRORS -gt 0 ]]; then
55+
echo ""
56+
echo "::error::Found $ERRORS type validation error(s) in ${BRIDGE_TYPE} bridges"
57+
exit 1
58+
fi
59+
60+
echo ""
61+
echo "All ${BRIDGE_TYPE} bridges have the correct type!"

.github/workflows/validation.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- '.github/scripts/validate-bridge-naming.sh'
1111
- '.github/scripts/validate-bridge-splitsh.sh'
1212
- '.github/scripts/validate-bridge-files.sh'
13+
- '.github/scripts/validate-bridge-type.sh'
1314
pull_request:
1415
paths:
1516
- 'src/*/src/Bridge/**/*'
@@ -19,6 +20,7 @@ on:
1920
- '.github/scripts/validate-bridge-naming.sh'
2021
- '.github/scripts/validate-bridge-splitsh.sh'
2122
- '.github/scripts/validate-bridge-files.sh'
23+
- '.github/scripts/validate-bridge-type.sh'
2224

2325
concurrency:
2426
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -41,6 +43,9 @@ jobs:
4143
- name: Validate store bridges have required files
4244
run: .github/scripts/validate-bridge-files.sh store
4345

46+
- name: Validate store bridges have correct type
47+
run: .github/scripts/validate-bridge-type.sh store
48+
4449
validate_tools:
4550
name: Tool Bridges
4651
runs-on: ubuntu-latest
@@ -57,6 +62,9 @@ jobs:
5762
- name: Validate tool bridges have required files
5863
run: .github/scripts/validate-bridge-files.sh tool agent
5964

65+
- name: Validate tool bridges have correct type
66+
run: .github/scripts/validate-bridge-type.sh tool agent
67+
6068
validate_message_stores:
6169
name: Message Store Bridges
6270
runs-on: ubuntu-latest
@@ -73,6 +81,9 @@ jobs:
7381
- name: Validate message store bridges have required files
7482
run: .github/scripts/validate-bridge-files.sh message-store chat
7583

84+
- name: Validate message store bridges have correct type
85+
run: .github/scripts/validate-bridge-type.sh message-store chat
86+
7687
validate_platforms:
7788
name: Platform Bridges
7889
runs-on: ubuntu-latest
@@ -89,3 +100,6 @@ jobs:
89100
- name: Validate platform bridges have required files
90101
run: .github/scripts/validate-bridge-files.sh platform
91102

103+
- name: Validate platform bridges have correct type
104+
run: .github/scripts/validate-bridge-type.sh platform
105+

demo/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"mrmysql/youtube-transcript": "^0.0.5",
1313
"nyholm/psr7": "^1.8",
1414
"php-http/discovery": "^1.20",
15-
"symfony/ai-azure-platform": "@dev",
1615
"symfony/ai-bundle": "@dev",
1716
"symfony/ai-chroma-db-store": "@dev",
1817
"symfony/ai-clock-tool": "@dev",

demo/config/reference.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,16 @@
159159
* version: string,
160160
* http_client?: string, // Service ID of the HTTP client to use // Default: "http_client"
161161
* },
162+
* decart?: array{
163+
* api_key: string,
164+
* host?: string, // Default: "https://api.decart.ai/v1"
165+
* http_client?: string, // Service ID of the HTTP client to use // Default: "http_client"
166+
* },
162167
* elevenlabs?: array{
163168
* api_key: string,
164169
* host?: string, // Default: "https://api.elevenlabs.io/v1"
165170
* http_client?: string, // Service ID of the HTTP client to use // Default: "http_client"
171+
* api_catalog?: bool, // If set, the ElevenLabs API will be used to build the catalog and retrieve models information, using this option leads to additional HTTP calls
166172
* },
167173
* gemini?: array{
168174
* api_key: string,
@@ -236,7 +242,6 @@
236242
* }>>,
237243
* agent?: array<string, array{ // Default: []
238244
* platform?: string, // Service name of platform // Default: "Symfony\\AI\\Platform\\PlatformInterface"
239-
* track_token_usage?: bool, // Enable tracking of token usage for the agent // Default: true
240245
* model?: mixed,
241246
* memory?: mixed, // Memory configuration: string for static memory, or array with "service" key for service reference // Default: null
242247
* prompt?: string|array{ // The system prompt configuration
@@ -355,6 +360,14 @@
355360
* distance?: string, // Default: "cosine"
356361
* quantization?: bool,
357362
* }>,
363+
* elasticsearch?: array<string, array{ // Default: []
364+
* endpoint?: string,
365+
* index_name?: string,
366+
* vectors_field?: string, // Default: "_vectors"
367+
* dimensions?: int, // Default: 1536
368+
* similarity?: string, // Default: "cosine"
369+
* http_client?: string, // Default: "http_client"
370+
* }>,
358371
* opensearch?: array<string, array{ // Default: []
359372
* endpoint?: string,
360373
* index_name?: string,

docs/components/agent.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ array of options::
3737
// Platform instantiation
3838

3939
$agent = new Agent($platform, $model);
40-
$input = new MessageBag(
40+
$messages = new MessageBag(
4141
Message::forSystem('You are a helpful chatbot answering questions about LLM agent.'),
4242
Message::ofUser('Hello, how are you?'),
4343
);

examples/aimlapi/image-input-binary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
Image::fromFile(dirname(__DIR__, 2).'/fixtures/image.jpg'),
2626
),
2727
);
28-
$result = $platform->invoke('google/gemma-3-27b-it', $messages);
28+
$result = $platform->invoke('google/gemini-2.5-pro', $messages);
2929

3030
echo $result->asText().\PHP_EOL;

examples/albert/chat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@
3939
Message::ofUser('Summarize the main objectives of France\'s AI strategy in one sentence.'),
4040
);
4141

42-
$result = $platform->invoke('albert-small', $messages);
42+
$result = $platform->invoke('openweight-small', $messages);
4343

4444
echo $result->asText().\PHP_EOL;

examples/albert/embeddings.php

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

1616
$platform = PlatformFactory::create(env('ALBERT_API_KEY'), env('ALBERT_API_URL'), http_client());
1717

18-
$response = $platform->invoke('embeddings-small', <<<TEXT
18+
$response = $platform->invoke('openweight-embeddings', <<<TEXT
1919
Once upon a time, there was a country called Japan. It was a beautiful country with a lot of mountains and rivers.
2020
The people of Japan were very kind and hardworking. They loved their country very much and took care of it. The
2121
country was very peaceful and prosperous. The people lived happily ever after.

examples/bootstrap.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ function print_token_usage(Metadata $metadata): void
101101
{
102102
$tokenUsage = $metadata->get('token_usage');
103103

104-
assert($tokenUsage instanceof TokenUsage);
104+
if (!$tokenUsage instanceof TokenUsage) {
105+
output()->writeln('<error>No token usage information available.</error>');
106+
exit(1);
107+
}
105108

106109
$na = '<comment>n/a</comment>';
107110
$table = new Table(output());

examples/composer.json

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,6 @@
1919
{
2020
"type": "path",
2121
"url": "../src/store"
22-
},
23-
{
24-
"type": "path",
25-
"url": "../src/chat/src/Bridge/Cache"
26-
},
27-
{
28-
"type": "path",
29-
"url": "../src/chat/src/Bridge/Cloudflare"
30-
},
31-
{
32-
"type": "path",
33-
"url": "../src/chat/src/Bridge/Doctrine"
34-
},
35-
{
36-
"type": "path",
37-
"url": "../src/chat/src/Bridge/Session"
38-
},
39-
{
40-
"type": "path",
41-
"url": "../src/chat/src/Bridge/Meilisearch"
42-
},
43-
{
44-
"type": "path",
45-
"url": "../src/chat/src/Bridge/MongoDb"
46-
},
47-
{
48-
"type": "path",
49-
"url": "../src/chat/src/Bridge/Pogocache"
50-
},
51-
{
52-
"type": "path",
53-
"url": "../src/chat/src/Bridge/Redis"
54-
},
55-
{
56-
"type": "path",
57-
"url": "../src/chat/src/Bridge/SurrealDb"
5822
}
5923
],
6024
"require": {
@@ -138,9 +102,6 @@
138102
"phpstan/phpstan": "^2.1",
139103
"phpstan/phpstan-strict-rules": "^2.0"
140104
},
141-
"conflict": {
142-
"mongodb/mongodb": "<1.21"
143-
},
144105
"minimum-stability": "dev",
145106
"autoload": {
146107
"psr-4": {

0 commit comments

Comments
 (0)