laravelailabs/file-assistant
最新稳定版本:0.0.12
Composer 安装命令:
composer require laravelailabs/file-assistant
包简介
Chat with files using AI
README 文档
README
Analyzes files based on AI and offers the possibility to query them.
Support us
If this helped you, consider supporting my development over on Patreon or on Github.
Demo
Repository: LaravelAILabs/file-assistant-demo
URL: https://file-assistant.laravelailabs.com
Installation
You can install the package via composer:
composer require laravelailabs/file-assistant
You can publish the config file with:
php artisan vendor:publish --tag="file-assistant-config"
Setup
Currently using Pinecone.io as the vector database and OpenAI as the LLM. Planning to make it so any LLM can be used, as well as any Vector Database implemented in Laravel Vector Store.
Add the following secrets to your .env:
VECTOR_STORE_PINECONE_API_KEY=YOUR_PINECONE_API_KEY VECTOR_STORE_PINECONE_ENVIRONMENT=YOUR_PINECONE_ENVIRONMENT FILE_ASSISTANT_OPENAI_API_KEY=YOUR_OPENAPI_KEY FILE_ASSISTANT_PINECONE_DATASET=YOUR_PINECONE_INDEX_NAME
You can find your OpenAI API Key here.
Usage
1. Start a new conversation
$dialog = FileAssistant::addFile('PATH_TO_YOUR_FILE') ->addFile('PATH_TO_YOUR_SECOND_FILE') ->initialize(); echo $dialog->prompt('What is this document about?')
2. Resume a conversation
$dialog = FileAssistant::setConversation(Conversation::find(1)) ->setUser(Auth::user()) ->initialize(); // grab the conversation and display the messages /** * @var \LaravelAILabs\FileAssistant\Models\Conversation $conversation */ $conversation = $dialog->getConversation(); foreach ($conversation->messages as $message) { echo sprintf('%s: %s <br>', $message->role, $message->content); } echo $dialog->prompt('Where did we leave off?')
3. Grab messages and display
The package creates 3 tables: conversations, messages, files, conversation_files. Feel free to modify their names using the file-assistant config environment variables. Use the models to interact with the database and display the messages of a conversation.
Works with
- Word
- TXT
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 55
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-27