From 9fa0023c8b33fff7d6b4a565ac5c3386e5cd9f84 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Mon, 12 Aug 2024 20:55:07 -0400 Subject: [PATCH] This will fix when tools show up at the wrong areas of the site like chat completion --- Modules/LlmDriver/app/BaseClient.php | 4 ++-- Modules/LlmDriver/app/Functions/GatherInfoTool.php | 2 +- Modules/LlmDriver/app/Functions/GetWebSiteFromUrlTool.php | 2 +- Modules/LlmDriver/app/Functions/ReportingTool.php | 2 +- Modules/LlmDriver/app/Functions/SearchTheWeb.php | 2 +- Modules/LlmDriver/app/Functions/StandardsChecker.php | 2 +- Modules/LlmDriver/app/Functions/ToolTypes.php | 1 + 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Modules/LlmDriver/app/BaseClient.php b/Modules/LlmDriver/app/BaseClient.php index 36220182..078e5da1 100644 --- a/Modules/LlmDriver/app/BaseClient.php +++ b/Modules/LlmDriver/app/BaseClient.php @@ -297,12 +297,12 @@ public function remapFunctions(array $functions): array /** * @DEPRECATED * This was before all the LLMs had tools - * + * * @param MessageInDto[] $messages */ protected function insertFunctionsIntoMessageArray(array $messages): array { - $functions = $this->setToolType(ToolTypes::Source)->getFunctions(); + $functions = $this->setToolType(ToolTypes::ChatCompletion)->getFunctions(); $functionsEncoded = collect($functions)->transform( function ($item) { diff --git a/Modules/LlmDriver/app/Functions/GatherInfoTool.php b/Modules/LlmDriver/app/Functions/GatherInfoTool.php index 9ea441b8..3eb823a0 100644 --- a/Modules/LlmDriver/app/Functions/GatherInfoTool.php +++ b/Modules/LlmDriver/app/Functions/GatherInfoTool.php @@ -22,7 +22,7 @@ class GatherInfoTool extends FunctionContract use ToolsHelper; public array $toolTypes = [ - ToolTypes::ChatCompletion, + ToolTypes::ManualChoice, ]; protected string $name = 'gather_info_tool'; diff --git a/Modules/LlmDriver/app/Functions/GetWebSiteFromUrlTool.php b/Modules/LlmDriver/app/Functions/GetWebSiteFromUrlTool.php index a79e81b1..a5e8af5d 100644 --- a/Modules/LlmDriver/app/Functions/GetWebSiteFromUrlTool.php +++ b/Modules/LlmDriver/app/Functions/GetWebSiteFromUrlTool.php @@ -15,7 +15,7 @@ class GetWebSiteFromUrlTool extends FunctionContract public bool $showInUi = false; public array $toolTypes = [ - ToolTypes::ChatCompletion, + ToolTypes::ManualChoice, ToolTypes::Source, ToolTypes::Output, ]; diff --git a/Modules/LlmDriver/app/Functions/ReportingTool.php b/Modules/LlmDriver/app/Functions/ReportingTool.php index 12f4d548..9484eb3c 100644 --- a/Modules/LlmDriver/app/Functions/ReportingTool.php +++ b/Modules/LlmDriver/app/Functions/ReportingTool.php @@ -24,7 +24,7 @@ class ReportingTool extends FunctionContract public bool $showInUi = true; public array $toolTypes = [ - ToolTypes::ChatCompletion, + ToolTypes::ManualChoice, ]; protected string $name = 'reporting_tool'; diff --git a/Modules/LlmDriver/app/Functions/SearchTheWeb.php b/Modules/LlmDriver/app/Functions/SearchTheWeb.php index 0ce73d8a..48b03396 100644 --- a/Modules/LlmDriver/app/Functions/SearchTheWeb.php +++ b/Modules/LlmDriver/app/Functions/SearchTheWeb.php @@ -20,7 +20,7 @@ class SearchTheWeb extends FunctionContract public bool $showInUi = false; public array $toolTypes = [ - ToolTypes::ChatCompletion, + ToolTypes::ManualChoice, ToolTypes::Source, ToolTypes::Output, ]; diff --git a/Modules/LlmDriver/app/Functions/StandardsChecker.php b/Modules/LlmDriver/app/Functions/StandardsChecker.php index 390105ec..a54c5e85 100644 --- a/Modules/LlmDriver/app/Functions/StandardsChecker.php +++ b/Modules/LlmDriver/app/Functions/StandardsChecker.php @@ -20,7 +20,7 @@ class StandardsChecker extends FunctionContract protected array $results = []; public array $toolTypes = [ - ToolTypes::ChatCompletion, + ToolTypes::ManualChoice, ]; protected array $promptHistory = []; diff --git a/Modules/LlmDriver/app/Functions/ToolTypes.php b/Modules/LlmDriver/app/Functions/ToolTypes.php index 9e7d8870..cfff6262 100644 --- a/Modules/LlmDriver/app/Functions/ToolTypes.php +++ b/Modules/LlmDriver/app/Functions/ToolTypes.php @@ -13,4 +13,5 @@ enum ToolTypes: string case Source = 'source'; case Output = 'output'; case NoFunction = 'no_function'; + case ManualChoice = 'manual_choice'; }