86 Commits

Author SHA1 Message Date
Christopher Hertel
ca4a7fe68d Add Mate to root readme and sort components alphabetically 2025-12-21 17:08:08 +01:00
Oskar Stark
b1cf3d47b5 Fix a/an grammar typos
- README.md: "An unified" → "A unified"
- docs/bundles/ai-bundle.rst: "a agent" → "an agent"
- ImageUrlNormalizerTest.php: "a image" → "an image"
2025-12-18 22:31:30 +01:00
Christopher Hertel
53ad2f19cd Add docs, logo and website to readme 2025-11-19 22:42:03 +01:00
Christopher Hertel
3f8820dd60 Extend Hugging Face support and fix/update examples 2025-11-09 23:42:05 +01:00
Guillaume Loulier
3f1dd48366 refactor(core): chat sub-component started 2025-10-02 19:19:51 +02:00
camilleislasse
1382d4c01e Migrate MCP Bundle from symfony/mcp-sdk to official mcp/sdk
- Replace symfony/mcp-sdk dependency with official mcp/sdk
- Refactor Server creation to use Server::make() builder pattern
- Convert tool definitions from interfaces to #[McpTool] attributes
- Implement automatic tool discovery in src/ directory
- Update STDIO transport command to mcp:server
- Simplify service configuration using native SDK patterns
- Remove redundant ServerFactory and routes.php files
- Add custom LogicException for bundle-specific errors
- Update all documentation (README, CHANGELOG, index.rst)
- Fix composer.json description
- Add .idea/ to .gitignore

Resolves #526

Fabbot + php-cs-fixer

DOCtor-RST

 Fix RouteLoader registration to always create when transports enabled

Remove .idea

  - Add autoconfiguration for #[McpTool] attribute with mcp.tool tag
  - Create McpToolPass compiler pass using ServiceLocatorTagPass::register()
  - Inject Service Locator into ServerBuilder via setContainer()

Fix PR review comments for MCP Bundle migration

- Remove prefer-stable from root composer.json
- Move CHANGELOG content to 0.1 section and remove BC BREAK labels
- Use ServerBuilder::class and Server::class in services configuration
- Fix "client vs server" comment in documentation
- Use ServerBuilder::class in test instead of string

Remove symfony/mcp-sdk

Remove symfony/mcp-sdk ref in claude reamdde et phpstan

Rewrite CHANGELOG.md

Use [] === $taggedServices instead of empty($taggedServices)

Use use Symfony\Component\Routing\Exception\LogicException; instead of custom Exception

Add MCP capabilities support to Symfony bundle

This commit implements Model Context Protocol (MCP) support by adding:

- Prompts: System instructions for AI context using #[McpPrompt]
- Resources: Static data access using #[McpResource]
- Resource Templates: Dynamic resources with parameters using #[McpResourceTemplate]

Implementation includes:
- Auto-configuration for MCP attributes with proper tagging
- Compiler passes extending AbstractMcpPass for service registration
- Documentation updates with examples and usage patterns
- Demo examples showcasing each capability type

Technical details:
- Refactored auto-configuration into registerMcpAttributes() method
- Created AbstractMcpPass to eliminate code duplication
- Added proper error handling for timezone validation
- Resource Templates ready but await MCP SDK handler implementation

Apply PHP CS Fixer to demo MCP examples

- Add Symfony license headers to demo files
- Fix code style and formatting
- Add trailing commas where appropriate

Add pagination_limit and instructions configuration options

- Add pagination_limit option to control MCP list responses (default: 50)
- Add instructions option for server description to help LLMs
- Update services.php to pass both options to ServerBuilder
- Add comprehensive tests for new configuration options
- Update documentation with examples and usage
- Update demo configuration with practical examples

Both options map directly to ServerBuilder methods:
- setPaginationLimit(int)
- setInstructions(string)

Add dedicated MCP logger with configurable Monolog integration

- Create monolog.logger.mcp service with dedicated channel
- Update ServerBuilder to use MCP-specific logger instead of generic logger
- Add comprehensive logging documentation with configuration examples
- Include examples for different environments (dev/prod) and handlers (file/Slack)
- Add test coverage for MCP logger service creation and configuration

The MCP logger uses Monolog's logger prototype pattern and can be customized
by users through standard Monolog configuration in their applications.

  Add EventDispatcher support and event system documentation

  - Configure Symfony EventDispatcher for MCP SDK event handling
  - Add comprehensive event system documentation with examples
  - Add test coverage for EventDispatcher configuration
  - Fix PHPStan type assertion for ChildDefinition

Migrate MCP Bundle from SSE to official StreamableHttpTransport

- Replace custom SSE implementation with MCP SDK's StreamableHttpTransport
- Change sse transport to http in configuration and code
- Simplify DependencyInjection compiler passes
- Add HTTP session management (file/memory store options)
- Update documentation and tests for HTTP transport
2025-09-24 22:36:43 +02:00
junaid farooq
b1f5046422 [Platform] Add support for Google vertex AI 2025-08-30 00:03:46 +02:00
Oskar Stark
3bfc403a10 Standardize Gemini naming throughout codebase 2025-07-24 22:54:26 +02:00
Christopher Hertel
b994c57f64 docs: add demo pointer in root README 2025-06-23 21:19:12 +02:00
Christopher Hertel
dd38482b54 docs: split into components 2025-06-23 20:54:20 +02:00
Christopher Hertel
957151a2b8 refactor: rename Embedder to Indexer and open input to iterable (#336) 2025-06-22 15:20:38 +02:00
Šimon Kandráč
9647e94eeb docs: fix typo in README.md (#333) 2025-06-20 23:54:55 +02:00
Christopher Hertel
c26add7bbb chore: move example runner into examples folder including composer setup for examples 2025-06-13 12:34:10 +02:00
Christopher Hertel
7b7dc8ceaf refactor: rework LLM Chain into Symfony AI 2025-06-07 15:28:50 +02:00
Philip Heimböck
0fe079ca9a feat: add option to keep tool messages (#323)
Adds an option to the Toolbox/ChainProcessor to keep tool messages by
avoiding to clone the original messageBag

Fixes #321

Co-authored-by: Philip Heimböck <philip.heimboeck@abacus.ch>
2025-06-06 22:06:34 +02:00
Christopher Hertel
c27618db16 feat: add support for mistral (#291)
* [x] text generation
* [x] streaming
* [x] tool calling
* [x] image input
* [x] structured output
* [x] embeddings
* [x] examples
* [x] documentation

Implementation is basically functional, but has following flaws to be
resolved:
1. tool schema differs in a breaking way from GPT - extension point is a
MUST
2. duplication of stream, message conversion and tool calling
3. error handling - once again
2025-06-01 15:51:19 +02:00
Christopher Hertel
773a700b4e feat: extend Claude support for images and pdf input (#298)
- [x] image input
- [x] pdf input
- [ ] ~streamed toolcalls~ scoped out for now
- [ ] ~thinking~ scoped out for now
2025-06-01 15:50:27 +02:00
Christopher Hertel
5a64eaa527 refactor: Major Library Refactoring (#326)
- [x] Introducing global model class to be more agnostic with explicit
`Capability` class
- [x] Introducing Contract with Normalizers to solve Base Contract
(OpenAI) vs. Model/Platform specific differences
- [x] Reshape into three major components `Chain`, `Platform` and
`Store`
- [x] Adoption of Symfony-style for CS Fixer and `Interface` &
`Exception` suffix

Replaces #301 and #305 

# Breaking Changes
* Sorting into three main sub compontents `Platform`, `Chain` and
`Store`
* High level implementation also went into those components, see
`ChainInterface` as example
  * `Model` namespace went into `Platform`
  * Bridges got sorted into `Platform` or `Store`
  * Tool metadata moved from `Chain` to `Platform\Contract` 
* Implementation of `JsonSerializable` was dropped in favor of Symfony's
serializer/normalizer
* Removal of `LanguageModel` and `EmbeddingsModel` interface in favor of
base `Model` and `Capabilities`
* Renaming of `StructuredResponse` to `ObjectResponse` 
* Slimming down the `supports()` method of `ModelClient` and
`ResponseConverter`
* Changing signature of `ModelClient` to already accepting the
normalized request payload
* Renaming interfaces to always contain the `Interface` suffix
* Renaming exceptions to always contain the `Exception` suffix
2025-06-01 14:57:13 +02:00
Tobias Nyholm
da16b7cd4d add readme and license headers 2025-05-29 15:40:43 +02:00
Tobias Nyholm
d937e789c7 Move to new file structure 2025-05-29 12:54:29 +02:00
Björn Altmann
e6385cc208 feat: implement Bedrock and model clients for Claude, Llama, and Nova (#312)
- [x] Test for Prompt Converters
- [x] Documentation for limits of invokeModel with tool calling using
Nova models
- [x] ~~Documentation for configuration~~ should be part of the bundle
- [x] Image support for Claude and Nova using Bedrock
- [x] Remove local model validation
- [x] Example usage for Bedrock
2025-05-26 21:59:47 +02:00
Christopher Hertel
2fc825054d test: fix makefile targets to run examples (#306) 2025-05-12 23:23:28 +02:00
Christopher Hertel
f9102037eb docs: fix after example rename in #296 (#300) 2025-05-04 22:09:24 +02:00
Christopher Hertel
8e6a7d0d2f chore: split example folder structure into multiple subdirectories (#295) 2025-05-01 21:19:42 +02:00
Christopher Hertel
0d7bac521a feat: adding basic Brave search tool and crawler (#290) 2025-04-25 10:48:50 +02:00
Christopher Hertel
6b6d8f1fc7 feat: add support for TransformersPHP for model runtime in PHP (#280)
Sitting on top of https://github.com/CodeWithKyrian/transformers-php
2025-04-19 00:42:24 +02:00
Christopher Hertel
e38cb0de12 feat: add support for Hugging Face Inference API (#279)
* 1st Commit: Christopher
* 2nd Commit: Claude Desktop with Jetbrains MCP:
> I'm writing a PHP library that is similar to langchain but should also
cover the HuggingFace inference API - like their library.
You can access my terminal and my IDE via tools.
Please have a look at the different tasks that should be available in
src/Bridge/HuggingFace/Task.php and see the example implementation in
examples/huggingface/text-classification.php in combination with the
namespace PhpLlm\LlmChain\Bridge\HuggingFace.
Your task is to implement the response conversion, corresponding DTOs
and examples for all other tasks than text-classification.
* 3rd Commit: Claude Desktop with Jetbrains MCP:
> please have a look at the other examples in the examples/ folder using
audio, image or text input and refactor the ones you just created.
all new example files are located in
/home/christopher/Projects/PHP-LLM/llm-chain/examples/huggingface -
please verify they're working by executing them - and patch bugs if
there are any
* 4th Commit: Claude Desktop with Jetbrains MCP:
> please create an example runner for huggingface examples, based on the
/example file in root directory
* 5th Commit: Christopher making it work.
2025-04-19 00:33:07 +02:00
Christopher Hertel
99336fed21 refactor: message content file handling [BC BREAK] (#285)
Preparation for #279 

* Introducing a base File that centralizes mime type, base64 handling,
etc.
* Image split into ImageUrl and Image based on File => i usually know
what i need in user land
  * `new Image('https://...')` => `new ImageUrl('https://...)`
* `new Image('data:image/jpeg;base64,...')` =>
`Image::fromDataUrl('data:image/jpeg;base64,...')`
* `new Image('/path/to/jpeg.jpg')` =>
`Image::fromFile('/path/to/jpeg.jpg')`
* removing `File` class of Whisper bridge in favor of `Audio`
2025-04-19 00:30:46 +02:00
Christopher Hertel
606f80e5dc feat: bring in Llama 3.3 support with Azure (#276) 2025-04-13 01:12:35 +02:00
Christopher Hertel
6b5e12fc1f docs: add disclaimer and bundle info (#8) 2025-04-01 00:46:57 +02:00
Iyadh Faleh
375acf2b02 docs: typo with Embedder service (#269)
Hello ,

This PR is a suggestion to change the name of embedding providers
variables and classes .

If you accept my suggestion , the PR to adopt this into the bundle is
almost ready .
2025-03-29 15:28:01 +01:00
Christopher Hertel
a588afeff4 docs: add section about chain in chain (#268) 2025-03-20 22:45:05 +01:00
Christopher Hertel
e347295528 docs: add section about different tool metadata factories (#262) 2025-03-20 00:12:16 +01:00
Christopher Hertel
21f07bdce5 refactor: rename toolbox to lowercase (#258) 2025-03-19 23:36:15 +01:00
Christopher Hertel
5b663ee878 feat: add whisper azure support (#252) 2025-03-15 07:46:58 +01:00
Christopher Hertel
30578be2b8 feat: add support for whisper on openai (#251) 2025-03-14 00:29:06 +01:00
Christopher Hertel
4ab0b2a2ca feat: extend Audio content for data urls and raw data (#250) 2025-03-13 23:05:08 +01:00
Christopher Hertel
953b91488e refactor: ease toolbox instatiation (#248)
Extracted from #249
2025-03-13 21:50:44 +01:00
Christopher Hertel
90a581aef0 docs: add tools section (#1) 2025-03-07 21:35:54 +01:00
Christopher Hertel
5bfd6bf757 feat: MCP SDK with server implementation 2025-03-07 21:18:34 +01:00
Christopher Hertel
9f75fbe6b7 refactor: centralize json schema generation (#212)
Centralizing JSON Schema generation for Output Structures and Tools
2025-03-07 10:28:19 +01:00
Christopher Hertel
56673df215 docs: add contributing file (#238) 2025-03-07 09:05:24 +01:00
Christopher Hertel
ab9da42475 chore: reorganize makefile (#241) 2025-03-07 08:58:28 +01:00
Oskar Stark
9209ba5ad1 docs: fix syntax (#242) 2025-03-07 08:57:48 +01:00
Oskar Stark
a5b031543b docs: better readability (#240)
![CleanShot 2025-03-07 at 08 24
24@2x](https://github.com/user-attachments/assets/e05fa09a-0121-43b9-83c8-290663cff190)
2025-03-07 08:31:38 +01:00
Christopher Hertel
e8ce5d5080 refactor: rename tool param attribute (#239)
Pulled out of #212 for a more neutral name also usable with DTO for
structured output
2025-03-07 08:20:02 +01:00
Christopher Hertel
291013316f fix: re-enable filtering of tools (#223) 2025-02-23 19:15:44 +01:00
Christopher Hertel
e27a6e1e21 docs: fix messages example (#222) 2025-02-22 02:02:22 +01:00
Christopher Hertel
f300bbb700 feat: support gemini (#220)
* feat: added initial Google provider supporting basic text generation with it

* refactor: remove visitor infavor of single converter class

---------

Co-authored-by: Roy Garrido <rgarridodomenech@outlook.com>
2025-02-22 00:55:34 +01:00
Christopher Hertel
ec37a3ad8e feat: introduce optional fault tolerant toolbox (#213) 2025-02-21 19:48:47 +01:00