You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+53-5Lines changed: 53 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# LLM Chain
2
2
3
-
PHP library for building LLM-based features and applications.
3
+
PHP library for building LLM-based and AI-based features and applications.
4
4
5
-
This library is not a stable yet, but still rather experimental. Feel free to try it out, give feedback, ask questions, contribute or share your use cases.
6
-
Abstractions, concepts and interfaces are not final and potentially subject of change.
5
+
This library is not a stable yet, but still rather experimental. Feel free to try it out, give feedback, ask questions,
6
+
contribute or share your use cases. Abstractions, concepts and interfaces are not final and potentially subject of change.
7
7
8
8
## Requirements
9
9
@@ -25,15 +25,16 @@ See [examples](examples) folder to run example implementations using this librar
25
25
Depending on the example you need to export different environment variables
26
26
for API keys or deployment configurations or create a `.env.local` based on `.env` file.
27
27
28
-
To run all examples, use `make run-examples` or `php example`.
28
+
To run all examples, use `make run-examples` or `php example` and `php huggingface` for all HuggingFace related examples.
29
29
30
30
For a more sophisticated demo, see the [Symfony Demo Application](https://github.com/php-llm/symfony-demo).
31
31
32
32
## Basic Concepts & Usage
33
33
34
34
### Models & Platforms
35
35
36
-
LLM Chain categorizes two main types of models: **Language Models** and **Embeddings Models**.
36
+
LLM Chain categorizes two main types of models: **Language Models** and **Embeddings Models**. On top of that, there are
37
+
other models, like text-to-speech, image generation or classification models that are also supported.
37
38
38
39
Language Models, like GPT, Claude and Llama, as essential centerpiece of LLM applications
39
40
and Embeddings Models as supporting models to provide vector representations of text.
@@ -71,6 +72,8 @@ $embeddings = new Embeddings();
71
72
* Other Models
72
73
*[OpenAI's Dall·E](https://platform.openai.com/docs/guides/image-generation) with [OpenAI](https://platform.openai.com/docs/overview) as Platform
73
74
*[OpenAI's Whisper](https://platform.openai.com/docs/guides/speech-to-text) with [OpenAI](https://platform.openai.com/docs/overview) and [Azure](https://learn.microsoft.com/azure/ai-services/openai/concepts/models) as Platform
75
+
* All models provided by [HuggingFace](https://huggingface.co/) can be listed with `make huggingface-models`
76
+
And more filtered with `php examples/huggingface/_model-listing.php --provider=hf-inference --task=object-detection`
74
77
75
78
See [issue #28](https://github.com/php-llm/llm-chain/issues/28) for planned support of other models and platforms.
76
79
@@ -725,6 +728,51 @@ final class MyProcessor implements OutputProcessor, ChainAwareProcessor
725
728
}
726
729
```
727
730
731
+
## HuggingFace
732
+
733
+
LLM Chain comes out of the box with an integration for [HuggingFace](https://huggingface.co/) which is a platform for
734
+
hosting and sharing all kind of models, including LLMs, embeddings, image generation and classification models.
735
+
736
+
You can just instantiate the Platform with the corresponding HuggingFace bridge and use it with the `task` option:
737
+
```php
738
+
use PhpLlm\LlmChain\Bridge\HuggingFace\Model;
739
+
use PhpLlm\LlmChain\Bridge\HuggingFace\PlatformFactory;
0 commit comments