DEV Community

Cover image for PHP Library for Working with LLM, Agents and RAG
Sami Maameri
Sami Maameri

Posted on

2

PHP Library for Working with LLM, Agents and RAG

Hello All,

I kicked of a small PHP package, with the aim of making it easy to work with LLMs, Agents and RAG in PHP.

It's just got a single method/class just now :) (release fast!?)

Wondering if it is something that sound's interesting to the PHP community. Why should Python guys have all the fun!

Would be great to have some sign of interest, and even feature requests, to inspire me to put some more work into it. Have kicked off the package here on github, and it is available on packagist also.

Like I said, it currently just supports one action, which allows you to send a message to OpenAI Chat by doing

$chat = new ChatOpenAI(getenv('OPENAI_API_KEY'));
$response = $chat->sendMessage('Hello, world!');
Enter fullscreen mode Exit fullscreen mode

I know there is the LLPhant library, but this could evolve to be something a little different, perhaps with its own benefits

Any feedback? Feature requests would be great too.

Thanks!

Sami

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (2)

Collapse
 
bogomil profile image
Bogomil Shopov - Бого

is it opensource?

Collapse
 
smaameri profile image
Sami Maameri

Yes

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post