name: symfony-ai description: Use when working with Symfony AI documentation or implementing integrations with LLM providers such as OpenAI, Anthropic, or Google Gemini embeddings, structured output, tool calling, streaming, multimodal input, or AI Bundle platform/agent configuration.
Symfony AI
Workflow
Use this skill for Symfony AI provider work. Treat Symfony AI as fast-moving: verify current official docs before changing code or giving definitive configuration advice.
- Read
references/docs.mdto pick the relevant official Symfony AI docs. - Browse the selected official docs pages before implementing provider-specific behavior.
- Inspect the local project for existing Symfony AI, Gemini, LLM, HTTP client, env var, and service configuration patterns.
- Prefer Symfony AI Bundle configuration in
config/packages/ai.yamlfor Symfony apps. Use the standalone Platform component only when the project already uses it directly or the task explicitly asks for component-level code. - Keep provider secrets in the Symfony Secrets component. DO NOT hard-code API keys, model names tied to private deployments, tenant IDs, or endpoints.
- Add tests with fake/in-memory platforms or mocked clients where practical. Avoid tests that call live LLM APIs unless the user explicitly asks for integration testing.
Implementation Notes
- Use
ai.platform.<provider>service IDs from the AI Bundle when wiring agents, vectorizers, or stores. - For Google Gemini, start from
ai.platform.geminiconfiguration andGEMINI_API_KEYunless existing project conventions say otherwise. - For tool calling, read the Agent and AI Bundle tool sections; register application tools with
#[AsTool]and restrict injected tools per agent when broad access is not intended. - For structured extraction, prefer Symfony AI structured output support when the provider/model supports it, and still validate returned data in application code. Additionally, use PHP DTO classes to define structured output schemas:
- For RAG or embeddings, read Platform embeddings, Store, Vectorizer, and Indexer docs together; the provider config alone is not enough.
Project Fit
In this repository, respect the RICH module pattern and existing Symfony conventions. Place business behavior in module handlers/services instead of controllers, use immutable DTOs where data crosses boundaries, and run the project’s normal validation command when code changes are made.