Skip to content

Commit f42af63

Browse files
committed
minor #716 [AI Bundle] Update documentation to use plain string model syntax (OskarStark)
This PR was merged into the main branch. Discussion ---------- [AI Bundle] Update documentation to use plain string model syntax | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | yes | Issues | Follows #640 | License | MIT Replace deprecated class and constant-based model configuration with plain string syntax across all examples in the AI Bundle documentation. Commits ------- 993490f [AI Bundle] Update documentation to use plain string model syntax
2 parents b602bb9 + 993490f commit f42af63

File tree

1 file changed

+21
-58
lines changed

1 file changed

+21
-58
lines changed

src/ai-bundle/doc/index.rst

Lines changed: 21 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ Configuration
3030
api_key: '%env(OPENAI_API_KEY)%'
3131
agent:
3232
default:
33-
model:
34-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
35-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI
33+
model: 'gpt-4o-mini'
3634
3735
**Advanced Example with Anthropic, Azure, ElevenLabs, Gemini, Perplexity, Vertex AI, Ollama multiple agents**
3836

@@ -68,9 +66,7 @@ Configuration
6866
platform: 'ai.platform.azure.gpt_deployment'
6967
structured_output: false # Disables support for "output_structure" option, default is true
7068
track_token_usage: true # Enable tracking of token usage for the agent, default is true
71-
model:
72-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
73-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI
69+
model: 'gpt-4o-mini'
7470
memory: 'You have access to conversation history and user preferences' # Optional: static memory content
7571
prompt: # The system prompt configuration
7672
text: 'You are a helpful assistant that can answer questions.' # The prompt text
@@ -91,23 +87,17 @@ Configuration
9187
description: 'Can research on Wikipedia'
9288
research:
9389
platform: 'ai.platform.anthropic'
94-
model:
95-
class: 'Symfony\AI\Platform\Bridge\Anthropic\Claude'
96-
name: !php/const Symfony\AI\Platform\Bridge\Anthropic\Claude::SONNET_37
90+
model: 'claude-3-7-sonnet'
9791
tools: # If undefined, all tools are injected into the agent, use "tools: false" to disable tools.
9892
- 'Symfony\AI\Agent\Toolbox\Tool\Wikipedia'
9993
fault_tolerant_toolbox: false # Disables fault tolerant toolbox, default is true
10094
search_agent:
10195
platform: 'ai.platform.perplexity'
102-
model:
103-
class: 'Symfony\AI\Platform\Bridge\Perplexity\Perplexity'
104-
name: !php/const Symfony\AI\Platform\Bridge\Perplexity\Perplexity::SONAR
96+
model: 'sonar'
10597
tools: false
10698
audio:
10799
platform: 'ai.platform.eleven_labs'
108-
model:
109-
class: 'Symfony\AI\Platform\Bridge\ElevenLabs'
110-
name: !php/const Symfony\AI\Platform\Bridge\ElevenLabs::TEXT_TO_SPEECH
100+
model: 'text-to-speech'
111101
tools: false
112102
store:
113103
chroma_db:
@@ -127,15 +117,12 @@ Configuration
127117
openai_embeddings:
128118
platform: 'ai.platform.openai'
129119
model:
130-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Embeddings'
131-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Embeddings::TEXT_EMBEDDING_3_SMALL
120+
name: 'text-embedding-3-small'
132121
options:
133122
dimensions: 512
134123
mistral_embeddings:
135124
platform: 'ai.platform.mistral'
136-
model:
137-
class: 'Symfony\AI\Platform\Bridge\Mistral\Embeddings'
138-
name: !php/const Symfony\AI\Platform\Bridge\Mistral\Embeddings::MISTRAL_EMBED
125+
model: 'mistral-embed'
139126
indexer:
140127
default:
141128
vectorizer: 'ai.vectorizer.openai_embeddings'
@@ -204,9 +191,7 @@ Models can be configured in two different ways to specify model options and para
204191
ai:
205192
agent:
206193
my_agent:
207-
model:
208-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
209-
name: 'gpt-4o-mini?temperature=0.7&max_tokens=2000&stream=true'
194+
model: 'gpt-4o-mini?temperature=0.7&max_tokens=2000&stream=true'
210195
211196
Alternatively, you can specify model options in a separate ``options`` section:
212197

@@ -216,7 +201,6 @@ Alternatively, you can specify model options in a separate ``options`` section:
216201
agent:
217202
my_agent:
218203
model:
219-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
220204
name: 'gpt-4o-mini'
221205
options:
222206
temperature: 0.7
@@ -234,9 +218,7 @@ You can also define models for the vectorizer this way:
234218
ai:
235219
vectorizer:
236220
embeddings:
237-
model:
238-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Embeddings'
239-
name: 'text-embedding-3-small?dimensions=512&encoding_format=float'
221+
model: 'text-embedding-3-small?dimensions=512&encoding_format=float'
240222
241223
HTTP Client Configuration
242224
-------------------------
@@ -274,9 +256,7 @@ For basic usage, specify the system prompt as a simple string:
274256
ai:
275257
agent:
276258
my_agent:
277-
model:
278-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
279-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI
259+
model: 'gpt-4o-mini'
280260
prompt: 'You are a helpful assistant.'
281261
282262
**Advanced Configuration**
@@ -288,9 +268,7 @@ For more control, such as including tool definitions in the system prompt, use t
288268
ai:
289269
agent:
290270
my_agent:
291-
model:
292-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
293-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI
271+
model: 'gpt-4o-mini'
294272
prompt:
295273
text: 'You are a helpful assistant that can answer questions.'
296274
include_tools: true # Include tool definitions at the end of the system prompt
@@ -317,9 +295,7 @@ Then configure the prompt with translation enabled:
317295
ai:
318296
agent:
319297
my_agent:
320-
model:
321-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
322-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI
298+
model: 'gpt-4o-mini'
323299
prompt:
324300
text: 'agent.system_prompt' # Translation key
325301
enable_translation: true
@@ -342,9 +318,7 @@ The simplest way to add memory is to provide a string that will be used as stati
342318
ai:
343319
agent:
344320
my_agent:
345-
model:
346-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
347-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI
321+
model: 'gpt-4o-mini'
348322
memory: 'You have access to user preferences and conversation history'
349323
prompt:
350324
text: 'You are a helpful assistant.'
@@ -361,9 +335,7 @@ Use the array syntax with a ``service`` key to explicitly reference a service:
361335
ai:
362336
agent:
363337
my_agent:
364-
model:
365-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
366-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI
338+
model: 'gpt-4o-mini'
367339
memory:
368340
service: 'my_memory_service' # Explicitly references an existing service
369341
prompt:
@@ -382,14 +354,12 @@ Memory can work independently or alongside the system prompt:
382354
agent:
383355
# Agent with memory only (memory becomes system prompt)
384356
memory_only_agent:
385-
model:
386-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
357+
model: 'gpt-4o-mini'
387358
memory: 'You are a helpful assistant with conversation history'
388-
359+
389360
# Agent with both memory and prompt (memory prepended to prompt)
390361
memory_and_prompt_agent:
391-
model:
392-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
362+
model: 'gpt-4o-mini'
393363
memory: 'Previous conversation context...'
394364
prompt:
395365
text: 'You are a helpful assistant.'
@@ -756,9 +726,7 @@ To disable token usage tracking for an agent, set the ``track_token_usage`` opti
756726
agent:
757727
my_agent:
758728
track_token_usage: false
759-
model:
760-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
761-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI
729+
model: 'gpt-4o-mini'
762730
763731
Vectorizers
764732
-----------
@@ -777,22 +745,17 @@ Vectorizers are defined in the ``vectorizer`` section of your configuration:
777745
openai_small:
778746
platform: 'ai.platform.openai'
779747
model:
780-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Embeddings'
781-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Embeddings::TEXT_EMBEDDING_3_SMALL
748+
name: 'text-embedding-3-small'
782749
options:
783750
dimensions: 512
784751
785752
openai_large:
786753
platform: 'ai.platform.openai'
787-
model:
788-
class: 'Symfony\AI\Platform\Bridge\OpenAi\Embeddings'
789-
name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Embeddings::TEXT_EMBEDDING_3_LARGE
754+
model: 'text-embedding-3-large'
790755
791756
mistral_embed:
792757
platform: 'ai.platform.mistral'
793-
model:
794-
class: 'Symfony\AI\Platform\Bridge\Mistral\Embeddings'
795-
name: !php/const Symfony\AI\Platform\Bridge\Mistral\Embeddings::MISTRAL_EMBED
758+
model: 'mistral-embed'
796759
797760
**Using Vectorizers in Indexers**
798761

0 commit comments

Comments
 (0)