We designed this framework to be as simple as possible, while still providing you with the tools you need to build powerful apps. It is compatible with Symfony and Laravel.
We are working to expand the support of different LLMs. Right now, we are supporting OpenAI, Anthropic, Mistral, Ollama, llmman, LM Studio, Atlas Cloud and services compatible with the OpenAI API such as LocalAI. Ollama that can be used to run LLM locally such as Llama 2.
LLPhant now supports typed Jev classification with Noul, Choice, and
the new Score rubric-based questions via JevClassifier.
Returned answers now also expose Jev usage metadata via inputTokens and
outputTokens fields.
The same Jev integration can now be used to detect malicious prompt injections
in QuestionAnswering through ClassifierPromptInjectionQueryTransformer.
To use JevClassifier, set your API key:
export JEV_API_KEY=your_api_keyThen instantiate new JevClassifier(). If you prefer, you can also pass the
key explicitly through new JevConfig(apiKey: '...').
See the full Jev API reference: https://docs.typesafe.ai/api and the LLPhant Jev guide in docs/jev-classifier.rst.
We want to thank few amazing projects that we use here or inspired us:
- the learnings from using LangChain and LLamaIndex
- the excellent work from the OpenAI PHP SDK.
We can find great external resource on LLPhant (ping us to add yours):
- 🇫🇷 Construire un RAG en PHP avec la doc de Symfony, LLPhant et OpenAI : Tutoriel Complet
- 🇫🇷 Retour d'expérience sur la création d'un agent autonome
- 🇬🇧 Exploring AI riding an LLPhant
- 🇬🇧 Evaluating LLM and AI agents Outputs with String Comparison, Criteria & Trajectory Approaches
Note
Requires PHP 8.1+
First, install LLPhant via the Composer package manager:
composer require theodo-group/llphantIn case you have not installed the GD extension, and you do not want to add it to your PHP setup,
you can use the --ignore-platform-req=ext-gd option
composer require theodo-group/llphant --ignore-platform-req=ext-gdIf you want to try the latest features of this library, you can use:
composer require theodo-group/llphant:dev-mainYou may also want to check the requirements for OpenAI PHP SDK as it is the main client.
Find documentation in the docs directory or online at https://llphant.readthedocs.org
The documentation includes a JevClassifier guide with typed classification examples for Noul, Choice, and the new Score rubric-based questions.
See CONTRIBUTING for details.
Thanks to our contributors:
LLPhant is sponsored by :
