garissman/larachain
Composer 安装命令:
composer require garissman/larachain
包简介
larachain
README 文档
README
Chatbot using LLM Models to support your product made with Laravel.
Installation
composer require garissman/larachain
Publish
After installing, you should publish the configuration file using the vendor:publish Artisan command. This command will publish the configuration file to your application's config directory:
php artisan vendor:publish --provider="Garissman\LaraChain\LaraChainServiceProvider"
Using Ollama(Free)
Go to https://ollama.com/ and follow there instructions
ones installed, download the model, at this moment the model that works with function for me is mistral-nemo so run:
ollama pull mistral-nemo
Using OpenAi(ChatGPT)
Just get your API key in: https://platform.openai.com/api-keys
and set you OPENAI_API_KEY in the .env file
Create the Default Agent
This is important to give personality to your char bot
php artisan larachain:create_default_agent
Install Horizon
Go to https://laravel.com/docs/11.x/horizon and follow there instructions, after install run:
php artisan horizon
Install Reverb
Go to https://laravel.com/docs/11.x/reverb and follow there instructions, after install run:
php artisan reverb:start --debug
Go to the UI and Chat with your bot
Now you are ready to chat,
php artisan serve
http://localhost:8000/larachain/chat
Create your tools
Now let's do actual coding, tools are the reason why y made this package, are custom code triggers by the chain and let the LLM model do the RAG base on that function output,
create a Class that extend from Garissman\LaraChain\Structures\Classes\FunctionContract,
like Garissman\LaraChain\Functions\ExampleTool
The Description is the most important part of the function, it tells the LLM when to trigger the tool call and start asking for parameter
The properties are the parameter of your tool, it tells the LLM what are the parameter, also has a description as well, very important.
TODO
- make Function command and use RAG for the description.
- make Agent command and use RAG for the context.
- Knowledge Table.
- Tests, nothing new!!!
garissman/larachain 适用场景与选型建议
garissman/larachain 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 123 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 09 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「ai」 「chatbot」 「llm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 garissman/larachain 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 garissman/larachain 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 garissman/larachain 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
A simple laravel wrapper for linecorp/line-bot-sdk
Alibaba Cloud Chatbot SDK for PHP
Chatopera企业聊天机器人
Chatbot is a php library that uses machine learning to generate responses based on collection of known conversations.
commune/chatbot studio base on swoole coroutine framework hyperf
统计信息
- 总下载量: 123
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-22