Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ai.symfony.com/public/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ A demo application (`composer create-project symfony/ai-demo`) with 8 scenarios:
- [Model Catalogs](https://symfony.com/doc/current/ai/components/platform/model-catalogs.html): How platforms resolve model names into Model objects with capabilities, and how to extend catalogs for new or local models
- [Voyage AI](https://symfony.com/doc/current/ai/components/platform/voyage.html): Voyage AI embedding platform
- [TypeSafe](https://symfony.com/doc/current/ai/components/platform/typesafe.html): TypeSafe Jev platform for typed decisions (noul, choice and score questions)
- [Eden AI](https://symfony.com/doc/current/ai/components/platform/edenai.html): Eden AI gateway for chat, embeddings, OCR, document parsing, speech and image models across many providers
- [Deepgram](https://symfony.com/doc/current/ai/components/platform/deepgram.html): Deepgram speech-to-text (STT) and text-to-speech (TTS) bridge over the Deepgram REST endpoints
- [Agent Component](https://symfony.com/doc/current/ai/components/agent.html): Framework for building AI agents with tool calling, memory, and multi-step reasoning
- [Store Component](https://symfony.com/doc/current/ai/components/store.html): Vector database abstraction for RAG with 20+ store backends
Expand Down Expand Up @@ -114,7 +115,7 @@ Symfony integration for the official MCP SDK (`mcp/sdk`). Install with `composer

## Supported AI Platforms

OpenAI, Anthropic, Google Gemini, Google VertexAI, Azure OpenAI, AWS Bedrock, Ollama, Mistral, Cohere, Meta Llama, DeepSeek, Perplexity, HuggingFace, Replicate, OpenRouter, ElevenLabs, Cartesia, Cerebras, Claude Code, Codex, Decart, Deepgram, MiniMax, LM Studio, Docker Model Runner, OpenResponses, Voyage, Scaleway, OVH, AmazeeAi, Albert, AiMlApi, ModelsDev, Fireworks, Together, Higgsfield, TransformersPHP, and TypeSafe.
OpenAI, Anthropic, Google Gemini, Google VertexAI, Azure OpenAI, AWS Bedrock, Ollama, Mistral, Cohere, Meta Llama, DeepSeek, Perplexity, HuggingFace, Replicate, OpenRouter, ElevenLabs, Cartesia, Cerebras, Claude Code, Codex, Decart, Deepgram, MiniMax, LM Studio, Docker Model Runner, OpenResponses, Voyage, Scaleway, OVH, AmazeeAi, Albert, AiMlApi, ModelsDev, Fireworks, Together, Higgsfield, TransformersPHP, TypeSafe, and Eden AI.

## Supported Vector Stores

Expand Down
7 changes: 7 additions & 0 deletions deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ deptrac:
collectors:
- type: classLike
value: Symfony\\AI\\Platform\\Bridge\\DockerModelRunner\\.*
- name: EdenAiPlatform
collectors:
- type: classLike
value: Symfony\\AI\\Platform\\Bridge\\EdenAi\\.*
- name: ElevenLabsPlatform
collectors:
- type: classLike
Expand Down Expand Up @@ -508,6 +512,9 @@ deptrac:
DockerModelRunnerPlatform:
- PlatformComponent
- GenericPlatform
EdenAiPlatform:
- PlatformComponent
- GenericPlatform
ElevenLabsPlatform:
- PlatformComponent
FailoverPlatform:
Expand Down
23 changes: 17 additions & 6 deletions docs/components/platform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ Supported Models & Platforms
----------------------------

* **Language Models**
* `OpenAI's GPT`_ with `OpenAI`_, `Azure`_ and `OpenRouter`_ as Platform
* `Anthropic's Claude`_ with `Anthropic`_ and `AWS Bedrock`_ as Platform
* `OpenAI's GPT`_ with `OpenAI`_, `Azure`_, `OpenRouter`_ and `Eden AI`_ as Platform
* `Anthropic's Claude`_ with `Anthropic`_, `AWS Bedrock`_ and `Eden AI`_ as Platform
* `Meta's Llama`_ with `Azure`_, `Ollama`_, `Replicate`_, `AWS Bedrock`_ and `OpenRouter`_ as Platform
* `Gemini`_ with `Google`_, `Vertex AI`_ and `OpenRouter`_ as Platform
* `Gemini`_ with `Google`_, `Vertex AI`_, `OpenRouter`_ and `Eden AI`_ as Platform
* `Vertex AI Gen AI`_ with `Vertex AI`_ as Platform
* `DeepSeek's R1`_ with `OpenRouter`_ as Platform
* `Amazon's Nova`_ with `AWS Bedrock`_ as Platform
* `Mistral's Mistral`_ with `Mistral`_ and `OpenRouter`_ as Platform
* `Mistral's Mistral`_ with `Mistral`_, `OpenRouter`_ and `Eden AI`_ as Platform
* `Albert API`_ models with `Albert`_ as Platform (French government's sovereign AI gateway)
* Open-weight models (`gpt-oss`_, `Qwen`_, `Gemma`_) with `Bedrock Mantle`_ as Platform
* Open-weight models like Llama, Qwen, Kimi or GLM with `Together`_ as Platform
Expand All @@ -144,7 +144,7 @@ Supported Models & Platforms
* **Embeddings Models**
* `Gemini Text Embeddings`_ with `Google`_ and `OpenRouter`_
* `Vertex AI Text Embeddings`_ with `Vertex AI`_
* `OpenAI's Text Embeddings`_ with `OpenAI`_, `Azure`_ and `OpenRouter`_ as Platform
* `OpenAI's Text Embeddings`_ with `OpenAI`_, `Azure`_, `OpenRouter`_ and `Eden AI`_ as Platform
* `Voyage's Embeddings`_ with `Voyage`_ as Platform
* `Venice's Embeddings`_ with `Venice`_ as Platform
* `Mistral Embed`_ with `Mistral`_ and `OpenRouter`_ as Platform
Expand All @@ -156,6 +156,7 @@ Supported Models & Platforms
* `OpenAI's Whisper`_ with `OpenAI`_ and `Azure`_ as Platform
* `Mistral OCR`_ with `Mistral`_ as Platform
* `TypeSafe's Jev`_ with `TypeSafe`_ as Platform, see :doc:`platform/typesafe`
* OCR and document parsing (invoices, resumes, identity documents) with `Eden AI`_ as Platform
* `LM Studio Catalog`_ and `HuggingFace`_ Models with `LM Studio`_ as Platform.
* All models provided by `HuggingFace`_ can be listed with a command in the examples folder,
and also filtered, e.g. ``php examples/huggingface/_model.php --provider=hf-inference --task=object-detection``
Expand All @@ -171,6 +172,7 @@ Supported Models & Platforms
* Text-to-speech and speech-to-text with `Together`_ as Platform
* `Venice TTS`_ with `Venice`_ as Platform
* `Venice STT`_ with `Venice`_ as Platform
* Multi-provider TTS and STT with `Eden AI`_ as Platform

For complete Deepgram setup and usage guide (TTS + STT), see :doc:`platform/deepgram`.
* **Image/Video Models**
Expand All @@ -180,13 +182,14 @@ Supported Models & Platforms
* Image and video generation with `Higgsfield`_ as Platform (asynchronous, poll-based)
* `Venice T2I`_ with `Venice`_ as Platform
* `Venice T2V`_ with `Venice`_ as Platform
* Image generation, object detection and explicit content detection with `Eden AI`_ as Platform

For complete Venice setup and usage guide (chat, images, audio and video), see :doc:`platform/venice`.

Generic Platforms
~~~~~~~~~~~~~~~~~

Platforms like `LiteLLM`_ or `OpenRouter`_ provide a unified API to access multiple models from different providers.
Platforms like `LiteLLM`_, `OpenRouter`_ or `Eden AI`_ provide a unified API to access multiple models from different providers.
Therefore, they rely on endpoint and contract design, that is inspired by OpenAI's original GPT API - an implicit
standard in the industry. Platforms using this de facto standard can be used with the generic bridge::

Expand Down Expand Up @@ -219,6 +222,10 @@ AWS Bedrock reaches its models through two inference engines - the SDK-based ``I
and the OpenAI- and Anthropic-compatible Mantle endpoint - each with its own factory and model
catalog. See :doc:`platform/bedrock` for the full setup and usage guide.

Eden AI pairs its OpenAI-compatible chat and embeddings endpoints with expert models for OCR,
document parsing, speech and images, which are addressed as ``feature/subfeature/provider``.
See :doc:`platform/edenai` for the full setup and usage guide.

Providers and Multi-Provider Platforms
--------------------------------------

Expand Down Expand Up @@ -1373,6 +1380,9 @@ completions, it is invoked with a single document content object - a
The result exposes every ``Page`` with its markdown, dimensions, extracted layout images
(with bounding boxes) and optional annotations.

Eden AI also exposes OCR and document parsing (invoices, resumes, identity documents) from
multiple providers. See :doc:`platform/edenai`.

Code Examples
~~~~~~~~~~~~~

Expand Down Expand Up @@ -2239,6 +2249,7 @@ Code Examples
.. _`Vertex AI`: https://cloud.google.com/vertex-ai/generative-ai/docs
.. _`Google`: https://ai.google.dev/
.. _`OpenRouter`: https://www.openrouter.ai/
.. _`Eden AI`: https://www.edenai.co/
.. _`DeepSeek's R1`: https://www.deepseek.com/
.. _`Amazon's Nova`: https://nova.amazon.com
.. _`Mistral's Mistral`: https://www.mistral.ai/
Expand Down
221 changes: 221 additions & 0 deletions docs/components/platform/edenai.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
Eden AI
=======

Eden AI is an AI gateway exposing hundreds of models from many providers behind a
single API, addressed with ``provider/model`` identifiers. The bridge covers both halves of
the v3 API: the OpenAI-compatible endpoints (``/v3/chat/completions`` and ``/v3/embeddings``,
reusing the Generic bridge, including streaming and tool calling) and the expert models of
the ``/v3/universal-ai`` endpoints.

For comprehensive information about Eden AI, see the `Eden AI API reference`_.

Installation
------------

To use Eden AI with Symfony AI Platform, install the bridge:

.. code-block:: terminal

$ composer require symfony/ai-eden-ai-platform

Setup
-----

Authentication
~~~~~~~~~~~~~~

Eden AI requires an API key, which you can create from the `Eden AI dashboard`_. Configure it in your
environment file:

.. code-block:: bash

EDENAI_API_KEY=your-eden-ai-api-key

Usage
-----

Chat and Embeddings
~~~~~~~~~~~~~~~~~~~

The bridge supports OpenAI-compatible chat and embeddings endpoints, so streaming and tool
calling work as with any Generic-bridge platform::

use Symfony\AI\Platform\Bridge\EdenAi\Factory;
use Symfony\AI\Platform\Message\Message;
use Symfony\AI\Platform\Message\MessageBag;

$platform = Factory::createPlatform($apiKey);

$messages = new MessageBag(Message::ofUser('What is the Symfony framework?'));
echo $platform->invoke('openai/gpt-4o-mini', $messages)->asText();

$vectors = $platform->invoke('openai/text-embedding-3-small', 'Some text')->asVectors();

OCR and Document Parsing
~~~~~~~~~~~~~~~~~~~~~~~~

Eden AI exposes OCR and document parsing (invoices, resumes, identity documents) from multiple
providers through its ``/v3/universal-ai`` endpoint, using ``ocr/{subfeature}/{provider}`` model
names. Models are invoked with a
:class:`Symfony\\AI\\Platform\\Message\\Content\\DocumentUrl` or
:class:`Symfony\\AI\\Platform\\Message\\Content\\ImageUrl`, or with a plain string holding a
direct file URL or a file ID from Eden AI's upload API. Input parameters like ``language`` or
``document_type`` are passed as options, or inline in the model name
(``ocr/ocr/google?language=en``)::

use Symfony\AI\Platform\Bridge\EdenAi\DocumentParser\Result\DocumentParsingResult;
use Symfony\AI\Platform\Bridge\EdenAi\Factory;
use Symfony\AI\Platform\Bridge\EdenAi\Ocr\Result\OcrResult;
use Symfony\AI\Platform\Message\Content\DocumentUrl;
use Symfony\AI\Platform\Message\Content\ImageUrl;

$platform = Factory::createPlatform($apiKey);

// OCR: extract raw text and bounding boxes
$result = $platform->invoke('ocr/ocr/google', new ImageUrl('https://example.com/scan.jpg'), [
'language' => 'en',
]);

$ocr = $result->asObject();
\assert($ocr instanceof OcrResult);

echo $ocr->getText();

// Document parsing: extract structured data from an invoice
$result = $platform->invoke('ocr/financial_parser/affinda', new DocumentUrl('https://example.com/invoice.pdf'), [
'language' => 'en',
'document_type' => 'invoice',
]);

$parsing = $result->asObject();
\assert($parsing instanceof DocumentParsingResult);

$extractedData = $parsing->getExtractedData();

.. note::

Not every provider reads an uploaded file. ``ocr/financial_parser/openai`` answers a
successful but empty result when its input is a file ID, while it parses the very same
document handed over as a URL. ``ocr/financial_parser/affinda`` reads both. Pass a
:class:`Symfony\\AI\\Platform\\Message\\Content\\DocumentUrl` to the providers behaving that way.

Expert Models
~~~~~~~~~~~~~

Beyond OCR and document parsing, the Eden AI bridge exposes the other expert models of the
``/v3/universal-ai`` endpoints: text-to-speech, speech-to-text, image analysis (object
detection, explicit content, logo detection, face detection, AI detection and deepfake
detection) and image generation. Binary content
(:class:`Symfony\\AI\\Platform\\Message\\Content\\Audio`,
:class:`Symfony\\AI\\Platform\\Message\\Content\\Document` or
:class:`Symfony\\AI\\Platform\\Message\\Content\\Image`) is transparently uploaded through
Eden AI's ``/v3/upload`` endpoint before the request::

use Symfony\AI\Platform\Bridge\EdenAi\Factory;
use Symfony\AI\Platform\Message\Content\Audio;
use Symfony\AI\Platform\Message\Content\ImageUrl;

$platform = Factory::createPlatform($apiKey);

// Text-to-speech: returns the synthesized audio as binary data
$result = $platform->invoke('audio/tts/amazon/neural', 'Welcome to Symfony AI!');
$result->asFile('welcome.mp3');

// Speech-to-text: diarization is exposed as result metadata
$result = $platform->invoke('audio/speech_to_text_async/openai', 'https://example.com/audio.mp3');
echo $result->asText();

// Speech-to-text from a local file, uploaded automatically
$result = $platform->invoke('audio/speech_to_text_async/deepgram', Audio::fromFile('./audio.mp3'));

// Object detection
$analysis = $platform->invoke('image/object_detection/google', new ImageUrl('https://example.com/photo.jpg'))->asObject();
foreach ($analysis->getItems() as $item) {
echo $item['label'];
}

// Image generation: every generated image is returned, so requesting several yields a
// MultiPartResult instead of a single BinaryResult
$result = $platform->invoke('image/generation/stabilityai', 'A red apple on a white table');
$result->asFile('apple.png');

Asynchronous Transcription
~~~~~~~~~~~~~~~~~~~~~~~~~~

Speech-to-text runs on ``/v3/universal-ai/async``. Providers that are done by the time Eden AI
answers put the transcription straight into the response, and the invocation is over. The others
report a job that is still running, and the invocation returns a
:class:`Symfony\\AI\\Platform\\Result\\JobResult` instead - a handle that can be waited for right
away, or stored and picked up by a worker later, since it holds no connection::

use Symfony\AI\Platform\Bridge\EdenAi\Factory;
use Symfony\AI\Platform\Job\JobRunner;
use Symfony\AI\Platform\Result\JobResult;

$result = $platform->invoke('audio/speech_to_text_async/deepgram', 'https://example.com/audio.mp3');

if ($result->getResult() instanceof JobResult) {
$jobClient = Factory::createJobClient($apiKey);

// The handle states how long transcription may run through the gateway, so the caller
// does not have to know; pass maxDuration to overrule it.
$result = (new JobRunner())->wait($jobClient, $result->asJob(), maxDuration: 60);
}

echo $result->asText();

The bridge never blocks inside ``invoke()``: how long to wait for a job, and whether to wait at
all, is the caller's decision. Pass a ``webhook_receiver`` option to be notified out of band
instead, and resolve the handle when the webhook fires.

In a Symfony application the job client is available as a service, autowirable by name::

public function __construct(
#[Autowire(service: 'ai.platform.job_client.edenai')]
private JobClientInterface $edenaiJobClient,
private JobRunner $jobRunner,
) {
}

Eden AI fronts more than a thousand models, and
:class:`Symfony\\AI\\Platform\\Bridge\\EdenAi\\ModelCatalog` only curates a subset of them.
Register any other one through its ``$additionalModels`` argument, or hand the factory a
:class:`Symfony\\AI\\Platform\\Bridge\\EdenAi\\ModelApiCatalog`, which discovers everything
Eden AI currently serves from its public ``/v3/models``, ``/v3/embeddings/models`` and
``/v3/info`` endpoints::

use Symfony\AI\Platform\Bridge\EdenAi\Factory;
use Symfony\AI\Platform\Bridge\EdenAi\ModelApiCatalog;

$platform = Factory::createPlatform($apiKey, $httpClient, new ModelApiCatalog($httpClient));

// No catalog entry needed for this one
$result = $platform->invoke('audio/tts/elevenlabs/eleven_multilingual_v2', 'Welcome!');

Expert subfeatures the bridge has no result converter for stay hidden from that catalog, so
an unsupported model fails at lookup time rather than during conversion.

Code Examples
-------------

* `OCR with Eden AI`_
* `Invoice parsing with Eden AI`_
* `Resume parsing with Eden AI`_
* `TTS with Eden AI`_
* `STT with Eden AI`_
* `STT with Eden AI (file upload)`_
* `Object detection with Eden AI`_
* `Logo detection with Eden AI`_
* `Image generation with Eden AI`_

.. _`Eden AI API reference`: https://docs.edenai.co/
.. _`Eden AI dashboard`: https://app.edenai.run/
.. _`OCR with Eden AI`: https://github.com/symfony/ai/blob/main/examples/edenai/ocr.php
.. _`Invoice parsing with Eden AI`: https://github.com/symfony/ai/blob/main/examples/edenai/financial-parser.php
.. _`Resume parsing with Eden AI`: https://github.com/symfony/ai/blob/main/examples/edenai/resume-parser.php
.. _`TTS with Eden AI`: https://github.com/symfony/ai/blob/main/examples/edenai/tts.php
.. _`STT with Eden AI`: https://github.com/symfony/ai/blob/main/examples/edenai/speech-to-text.php
.. _`STT with Eden AI (file upload)`: https://github.com/symfony/ai/blob/main/examples/edenai/speech-to-text-upload.php
.. _`Object detection with Eden AI`: https://github.com/symfony/ai/blob/main/examples/edenai/object-detection.php
.. _`Logo detection with Eden AI`: https://github.com/symfony/ai/blob/main/examples/edenai/logo-detection.php
.. _`Image generation with Eden AI`: https://github.com/symfony/ai/blob/main/examples/edenai/image-generation.php
3 changes: 3 additions & 0 deletions examples/.env
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ HUGGINGFACE_KEY=
# For using OpenRouter
OPENROUTER_KEY=

# For using Eden AI
EDENAI_API_KEY=

# For using ElevenLabs
ELEVEN_LABS_API_KEY=

Expand Down
1 change: 1 addition & 0 deletions examples/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ COHERE_API_KEY=sk-test
DEEPGRAM_API_KEY=sk-test
DEEPSEEK_API_KEY=sk-test
DECART_API_KEY=sk-test
EDENAI_API_KEY=sk-test
ELEVEN_LABS_API_KEY=sk-test
FIRECRAWL_API_KEY=sk-test
FIREWORKS_API_KEY=fw-test
Expand Down
5 changes: 5 additions & 0 deletions examples/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "path",
"url": "../src/platform/src/Bridge/EdenAi"
},
{
"type": "path",
"url": "../src/platform/src/Bridge/TypeSafe"
Expand Down Expand Up @@ -40,6 +44,7 @@
"symfony/ai-deepgram-platform": "^0.13",
"symfony/ai-docker-model-runner-platform": "^0.13",
"symfony/ai-doctrine-message-store": "^0.13",
"symfony/ai-eden-ai-platform": "dev-main",
"symfony/ai-elasticsearch-store": "^0.13",
"symfony/ai-eleven-labs-platform": "^0.13",
"symfony/ai-failover-platform": "^0.13",
Expand Down
2 changes: 2 additions & 0 deletions examples/edenai/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
image-generation.png
tts.mp3
Loading
Loading