-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
769 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace LlmLaraHub\LlmDriver\Functions; | ||
|
||
use App\Helpers\ChatHelperTrait; | ||
use App\Models\Document; | ||
use App\Models\Message; | ||
use Illuminate\Support\Facades\Log; | ||
use LlmLaraHub\LlmDriver\Responses\FunctionResponse; | ||
use LlmLaraHub\LlmDriver\ToolsHelper; | ||
|
||
class SatisfyToolsRequired extends FunctionContract | ||
{ | ||
use ChatHelperTrait, ToolsHelper; | ||
|
||
public array $toolTypes = [ | ||
ToolTypes::NoFunction, | ||
]; | ||
|
||
protected string $name = 'satisfy_tools_required'; | ||
|
||
protected string $description = 'This tool has no use just for example purposes'; | ||
|
||
public function handle( | ||
Message $message): FunctionResponse | ||
{ | ||
Log::info('[LaraChain] SatisfyToolsRequired'); | ||
|
||
|
||
return FunctionResponse::from([ | ||
'content' => "Should not be called", | ||
'prompt' => $message->getPrompt(), | ||
'requires_followup' => false, | ||
'documentChunks' => collect([]), | ||
'save_to_message' => false, | ||
]); | ||
} | ||
|
||
/** | ||
* @return PropertyDto[] | ||
*/ | ||
protected function getProperties(): array | ||
{ | ||
return [ | ||
new PropertyDto( | ||
name: 'example_arg', | ||
description: 'Example argument', | ||
type: 'string', | ||
required: true, | ||
), | ||
]; | ||
} | ||
|
||
public function runAsBatch(): bool | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Database\Seeders; | ||
|
||
use App\Models\Setting; | ||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | ||
use Illuminate\Database\Seeder; | ||
|
||
class CopySeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
$setting = Setting::first(); | ||
|
||
if($setting) { | ||
$mainPrompt = $setting->main_collection_prompt; | ||
if(!$mainPrompt) { | ||
$prompt = <<<PROMPT | ||
Your primary function is to assist users in interacting with their "collection" of data within a Retrieval Augmented Generation (RAG) system. This collection comprises documents uploaded by the user or imported from web searches, serving as contextual information for our interactions. | ||
Your responsibilities include: | ||
1. Answering questions based on the provided context | ||
2. Generating reports using the available data | ||
3. Automating tasks such as email composition | ||
When responding to user queries, utilize the tools and information at your disposal while maintaining awareness of the collection's context. Adapt your responses to align with the user's specific needs and the nature of their request, whether it's a simple question, a complex analysis, or a task requiring the use of the collection's data. | ||
PROMPT; | ||
$setting->updateQueitly([ | ||
'main_collection_prompt' => $prompt, | ||
]); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.