diff --git a/Modules/LlmDriver/app/Functions/SearchAndSummarize.php b/Modules/LlmDriver/app/Functions/RetrieveRelated.php similarity index 94% rename from Modules/LlmDriver/app/Functions/SearchAndSummarize.php rename to Modules/LlmDriver/app/Functions/RetrieveRelated.php index 4e7c8011..dc662381 100644 --- a/Modules/LlmDriver/app/Functions/SearchAndSummarize.php +++ b/Modules/LlmDriver/app/Functions/RetrieveRelated.php @@ -14,21 +14,21 @@ use LlmLaraHub\LlmDriver\Responses\CompletionResponse; use LlmLaraHub\LlmDriver\Responses\FunctionResponse; -class SearchAndSummarize extends FunctionContract +class RetrieveRelated extends FunctionContract { use CreateReferencesTrait; - protected string $name = 'search_and_summarize'; + protected string $name = 'retrieve_related'; protected string $description = 'Used to embed users prompt, search local database and return summarized results. - DOES NOT SEARCH THE WEB'; + DOES NOT SEARCH THE WEB. This is only used for local database search.'; protected string $response = ''; public function handle( Message $message): FunctionResponse { - Log::info('[LaraChain] Using Function: SearchAndSummarize'); + Log::info('[LaraChain] Using Function: RetrieveRelated'); /** * @TODO @@ -61,7 +61,7 @@ public function handle( /** * @NOTE - * Yes this is a lot like the SearchAndSummarizeChatRepo + * Yes this is a lot like the RetrieveRelatedChatRepo * But just getting a sense of things */ foreach ($documentChunkResults as $result) { diff --git a/Modules/LlmDriver/app/LlmDriverClient.php b/Modules/LlmDriver/app/LlmDriverClient.php index c39d23ce..0588f60d 100644 --- a/Modules/LlmDriver/app/LlmDriverClient.php +++ b/Modules/LlmDriver/app/LlmDriverClient.php @@ -6,7 +6,7 @@ use LlmLaraHub\LlmDriver\Functions\GatherInfoTool; use LlmLaraHub\LlmDriver\Functions\GetWebSiteFromUrlTool; use LlmLaraHub\LlmDriver\Functions\ReportingTool; -use LlmLaraHub\LlmDriver\Functions\SearchAndSummarize; +use LlmLaraHub\LlmDriver\Functions\RetrieveRelated; use LlmLaraHub\LlmDriver\Functions\SearchTheWeb; use LlmLaraHub\LlmDriver\Functions\StandardsChecker; use LlmLaraHub\LlmDriver\Functions\SummarizeCollection; @@ -62,7 +62,7 @@ public function getFunctions(): array { return [ (new SummarizeCollection())->getFunction(), - (new SearchAndSummarize())->getFunction(), + (new RetrieveRelated())->getFunction(), (new StandardsChecker())->getFunction(), (new ReportingTool())->getFunction(), (new GatherInfoTool())->getFunction(), diff --git a/Modules/LlmDriver/app/LlmServiceProvider.php b/Modules/LlmDriver/app/LlmServiceProvider.php index f47d5bb4..9474b403 100644 --- a/Modules/LlmDriver/app/LlmServiceProvider.php +++ b/Modules/LlmDriver/app/LlmServiceProvider.php @@ -10,7 +10,7 @@ use LlmLaraHub\LlmDriver\Functions\GatherInfoTool; use LlmLaraHub\LlmDriver\Functions\GetWebSiteFromUrlTool; use LlmLaraHub\LlmDriver\Functions\ReportingTool; -use LlmLaraHub\LlmDriver\Functions\SearchAndSummarize; +use LlmLaraHub\LlmDriver\Functions\RetrieveRelated; use LlmLaraHub\LlmDriver\Functions\SearchTheWeb; use LlmLaraHub\LlmDriver\Functions\StandardsChecker; use LlmLaraHub\LlmDriver\Functions\SummarizeCollection; @@ -66,7 +66,7 @@ public function boot(): void }); $this->app->bind('search_and_summarize', function () { - return new SearchAndSummarize(); + return new RetrieveRelated(); }); $this->app->bind('standards_checker', function () { diff --git a/Modules/LlmDriver/app/OllamaClient.php b/Modules/LlmDriver/app/OllamaClient.php index f42ffff6..f78ecc28 100644 --- a/Modules/LlmDriver/app/OllamaClient.php +++ b/Modules/LlmDriver/app/OllamaClient.php @@ -186,9 +186,8 @@ public function completion(string $prompt): CompletionResponse 'stream' => false, ]); - $results = $response->json()['response']; - return new CompletionResponse($results); + return OllamaCompletionResponse::from($response->json()); } protected function getClient() diff --git a/Modules/LlmDriver/app/Orchestrate.php b/Modules/LlmDriver/app/Orchestrate.php index 33eebea1..63a04a47 100644 --- a/Modules/LlmDriver/app/Orchestrate.php +++ b/Modules/LlmDriver/app/Orchestrate.php @@ -8,7 +8,7 @@ use App\Models\Filter; use App\Models\Message; use App\Models\PromptHistory; -use Facades\App\Domains\Messages\SearchAndSummarizeChatRepo; +use Facades\App\Domains\Messages\RetrieveRelatedChatRepo; use Illuminate\Support\Facades\Bus; use Illuminate\Support\Facades\Log; use LlmLaraHub\LlmDriver\Functions\FunctionCallDto; @@ -173,7 +173,7 @@ public function handle( } else { Log::info('[LaraChain] Orchestration No Functions Default Search And Summarize'); - return SearchAndSummarizeChatRepo::search($chat, $message); + return RetrieveRelatedChatRepo::search($chat, $message); } } diff --git a/Modules/LlmDriver/app/Responses/ClaudeCompletionResponse.php b/Modules/LlmDriver/app/Responses/ClaudeCompletionResponse.php index 1b524e6e..e2622473 100644 --- a/Modules/LlmDriver/app/Responses/ClaudeCompletionResponse.php +++ b/Modules/LlmDriver/app/Responses/ClaudeCompletionResponse.php @@ -12,11 +12,11 @@ public function __construct( #[WithCastable(ClaudeContentCaster::class)] public mixed $content, public string|Optional $stop_reason, - public string|Optional $tool_used, + public string|null $tool_used = "", /** @var array */ #[WithCastable(ClaudeToolCaster::class)] #[MapInputName('content')] - public array|Optional $tool_calls, + public array $tool_calls = [], #[MapInputName('usage.input_tokens')] public ?int $input_tokens = null, #[MapInputName('usage.output_tokens')] diff --git a/Modules/LlmDriver/app/Responses/CompletionResponse.php b/Modules/LlmDriver/app/Responses/CompletionResponse.php index a120b3de..ed91de13 100644 --- a/Modules/LlmDriver/app/Responses/CompletionResponse.php +++ b/Modules/LlmDriver/app/Responses/CompletionResponse.php @@ -9,9 +9,9 @@ class CompletionResponse extends \Spatie\LaravelData\Data public function __construct( public mixed $content, public string|Optional $stop_reason, - public string|Optional $tool_used, + public string|null $tool_used = "", /** @var array */ - public array|Optional $tool_calls, + public array $tool_calls = [], public ?int $input_tokens = null, public ?int $output_tokens = null, public ?string $model = null, diff --git a/Modules/LlmDriver/app/Responses/OllamaCompletionResponse.php b/Modules/LlmDriver/app/Responses/OllamaCompletionResponse.php index a600f1b4..4d1dd669 100644 --- a/Modules/LlmDriver/app/Responses/OllamaCompletionResponse.php +++ b/Modules/LlmDriver/app/Responses/OllamaCompletionResponse.php @@ -12,10 +12,10 @@ public function __construct( public mixed $content, #[MapInputName('done_reason')] public string|Optional $stop_reason, - public string|Optional $tool_used, + public string|null $tool_used = "", /** @var array */ #[MapInputName('message.tool_calls')] - public array|Optional $tool_calls, + public array $tool_calls = [], #[MapInputName('prompt_eval_count')] public ?int $input_tokens = null, #[MapInputName('eval_count')] diff --git a/Modules/LlmDriver/app/SimpleSearchAndSummarizeOrchestrate.php b/Modules/LlmDriver/app/SimpleSearchAndSummarizeOrchestrate.php index 59f6264e..6b6dee20 100644 --- a/Modules/LlmDriver/app/SimpleSearchAndSummarizeOrchestrate.php +++ b/Modules/LlmDriver/app/SimpleSearchAndSummarizeOrchestrate.php @@ -3,10 +3,10 @@ namespace LlmLaraHub\LlmDriver; use App\Models\Chat; -use Facades\App\Domains\Messages\SearchAndSummarizeChatRepo; +use Facades\App\Domains\Messages\RetrieveRelatedChatRepo; use Illuminate\Support\Facades\Log; -class SimpleSearchAndSummarizeOrchestrate +class SimpleRetrieveRelatedOrchestrate { protected string $response = ''; @@ -20,7 +20,7 @@ public function handle(string $message, Chat $chat): ?string $chat->chatable, 'Searching data now to summarize content' ); - $response = SearchAndSummarizeChatRepo::search($chat, $message); + $response = RetrieveRelatedChatRepo::search($chat, $message); return $response; } diff --git a/Modules/LlmDriver/tests/Feature/ClaudeClientTest.php b/Modules/LlmDriver/tests/Feature/ClaudeClientTest.php index 2e4dfe97..d7441825 100644 --- a/Modules/LlmDriver/tests/Feature/ClaudeClientTest.php +++ b/Modules/LlmDriver/tests/Feature/ClaudeClientTest.php @@ -321,25 +321,22 @@ public function test_remap_messages_with_tools_as_history() $messages[] = MessageInDto::from([ 'content' => 'test3', 'role' => RoleEnum::Tool->value, - 'meta_data' => MetaDataDto::from([ - 'tool' => 'test', - 'tool_id' => 'test_id', - ]), + 'tool' => 'test', + 'tool_id' => 'test_id', + 'meta_data' => MetaDataDto::from([]), ]); $results = (new ClaudeClient)->remapMessages($messages); - $this->assertCount(3, $results); + $this->assertCount(5, $results); $this->assertEquals('user', $results[0]['role']); $this->assertEquals('assistant', $results[1]['role']); - $this->assertEquals('test', $results[1]['content'][0]['text']); + $this->assertEquals('test3', $results[3]['content'][0]['text']); $this->assertEquals('user', $results[2]['role']); - $this->assertEquals('tool_result', $results[2]['content'][0]['type']); - $this->assertEquals('test', $results[2]['content'][0]['content']); - $this->assertEquals('test_id', $results[2]['content'][0]['tool_use_id']); - - $this->assertArrayNotHasKey('tool_id', $results[2]); + $this->assertEquals('tool_use', $results[3]['content'][1]['type']); + $this->assertEquals('test', $results[3]['content'][1]['name']); + $this->assertEquals('test_id', $results[3]['content'][1]['id']); } } diff --git a/app/Domains/Messages/SearchAndSummarizeChatRepo.php b/app/Domains/Messages/RetrieveRelatedChatRepo.php similarity index 99% rename from app/Domains/Messages/SearchAndSummarizeChatRepo.php rename to app/Domains/Messages/RetrieveRelatedChatRepo.php index 33bf2511..726fdfb3 100644 --- a/app/Domains/Messages/SearchAndSummarizeChatRepo.php +++ b/app/Domains/Messages/RetrieveRelatedChatRepo.php @@ -20,7 +20,7 @@ use LlmLaraHub\LlmDriver\Responses\EmbeddingsResponseDto; use LlmLaraHub\LlmDriver\ToolsHelper; -class SearchAndSummarizeChatRepo +class RetrieveRelatedChatRepo { use CreateReferencesTrait; use ToolsHelper; diff --git a/app/Jobs/EmailReplyOutputJob.php b/app/Jobs/EmailReplyOutputJob.php index 79944a7c..8a8018c5 100644 --- a/app/Jobs/EmailReplyOutputJob.php +++ b/app/Jobs/EmailReplyOutputJob.php @@ -87,7 +87,7 @@ public function handle(): void /** * @NOTE - * Yes this is a lot like the SearchAndSummarizeChatRepo + * Yes this is a lot like the RetrieveRelatedChatRepo * But just getting a sense of things */ foreach ($documentChunkResults as $result) { diff --git a/app/Jobs/SimpleSearchAndSummarizeOrchestrateJob.php b/app/Jobs/SimpleRetrieveRelatedOrchestrateJob.php similarity index 95% rename from app/Jobs/SimpleSearchAndSummarizeOrchestrateJob.php rename to app/Jobs/SimpleRetrieveRelatedOrchestrateJob.php index 4c53ab70..7e09c76d 100644 --- a/app/Jobs/SimpleSearchAndSummarizeOrchestrateJob.php +++ b/app/Jobs/SimpleRetrieveRelatedOrchestrateJob.php @@ -22,7 +22,7 @@ * This is used by LLMs that might not have functions * but still want to do a search and summarize */ -class SimpleSearchAndSummarizeOrchestrateJob implements ShouldQueue +class SimpleRetrieveRelatedOrchestrateJob implements ShouldQueue { use Batchable; use CreateReferencesTrait; @@ -42,7 +42,7 @@ public function __construct( */ public function handle(): void { - Log::info('[LaraChain] Skipping over functions doing SimpleSearchAndSummarizeOrchestrateJob'); + Log::info('[LaraChain] Skipping over functions doing SimpleRetrieveRelatedOrchestrateJob'); notify_ui( $this->message->getChatable(), diff --git a/app/Models/Message.php b/app/Models/Message.php index f1e0b837..facd057a 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -8,6 +8,7 @@ use App\Events\ChatUiUpdateEvent; use App\Events\MessageCreatedEvent; use App\Jobs\OrchestrateJob; +use App\Jobs\SimpleRetrieveRelatedOrchestrateJob; use App\Jobs\SimpleSearchAndSummarizeOrchestrateJob; use Facades\App\Domains\Tokenizer\Templatizer; use Illuminate\Bus\Batch; @@ -259,7 +260,7 @@ public function run(): void } else { Log::info('[LaraChain] Simple Search and Summarize added to queue'); $this->batchJob([ - new SimpleSearchAndSummarizeOrchestrateJob($message), + new SimpleRetrieveRelatedOrchestrateJob($message), ], $chat, 'simple_search_and_summarize'); } diff --git a/tests/Feature/Http/Controllers/ChatControllerTest.php b/tests/Feature/Http/Controllers/ChatControllerTest.php index 70dd4acf..f4c520f5 100644 --- a/tests/Feature/Http/Controllers/ChatControllerTest.php +++ b/tests/Feature/Http/Controllers/ChatControllerTest.php @@ -178,31 +178,7 @@ public function test_kick_off_chat_makes_system() } - public function test_no_functions() - { - Bus::fake(); - $user = User::factory()->create(); - $collection = Collection::factory()->create(); - $chat = Chat::factory()->create([ - 'chatable_id' => $collection->id, - 'chatable_type' => Collection::class, - 'user_id' => $user->id, - ]); - LlmDriverFacade::shouldReceive('driver->hasFunctions')->once()->andReturn(false); - LlmDriverFacade::shouldReceive('getFunctionsForUi')->andReturn([]); - - $this->actingAs($user)->post(route('chats.messages.create', [ - 'chat' => $chat->id, - ]), - [ - 'system_prompt' => 'Foo', - 'input' => 'user input', - ])->assertOk(); - - Bus::assertBatchCount(1); - - } public function test_standard_checker() { diff --git a/tests/Feature/Models/DocumentTest.php b/tests/Feature/Models/DocumentTest.php index 8d0b527b..09e581f4 100644 --- a/tests/Feature/Models/DocumentTest.php +++ b/tests/Feature/Models/DocumentTest.php @@ -28,6 +28,7 @@ public function test_factory(): void public function test_parent() { $modelParent = \App\Models\Document::factory()->create(); + $model = \App\Models\Document::factory()->create([ 'parent_id' => $modelParent->id, ]); diff --git a/tests/Feature/OrchestrateTest.php b/tests/Feature/OrchestrateTest.php index 33675ab7..e22dca3c 100644 --- a/tests/Feature/OrchestrateTest.php +++ b/tests/Feature/OrchestrateTest.php @@ -9,9 +9,9 @@ use App\Models\Collection; use App\Models\Message; use App\Models\User; -use Facades\App\Domains\Messages\SearchAndSummarizeChatRepo; +use Facades\App\Domains\Messages\RetrieveRelatedChatRepo; use Illuminate\Support\Facades\Event; -use LlmLaraHub\LlmDriver\Functions\SearchAndSummarize; +use LlmLaraHub\LlmDriver\Functions\RetrieveRelated; use LlmLaraHub\LlmDriver\Functions\StandardsChecker; use LlmLaraHub\LlmDriver\Functions\SummarizeCollection; use LlmLaraHub\LlmDriver\LlmDriverFacade; @@ -39,7 +39,7 @@ public function test_gets_summarize_function(): void LlmDriverFacade::shouldReceive('driver->chat')->never(); - SearchAndSummarizeChatRepo::shouldReceive('search')->never(); + RetrieveRelatedChatRepo::shouldReceive('search')->never(); $this->instance( 'summarize_collection', @@ -149,11 +149,11 @@ public function test_makes_history_no_message(): void LlmDriverFacade::shouldReceive('driver->chat')->never(); - SearchAndSummarizeChatRepo::shouldReceive('search')->never(); + RetrieveRelatedChatRepo::shouldReceive('search')->never(); $this->instance( 'search_and_summarize', - Mockery::mock(SearchAndSummarize::class, function ($mock) { + Mockery::mock(RetrieveRelated::class, function ($mock) { $mock->shouldReceive('handle') ->once() ->andReturn( diff --git a/tests/Feature/ReportingToolTest.php b/tests/Feature/ReportingToolTest.php index 90f5cf08..3d197a6b 100644 --- a/tests/Feature/ReportingToolTest.php +++ b/tests/Feature/ReportingToolTest.php @@ -25,9 +25,9 @@ class ReportingToolTest extends TestCase */ public function test_can_generate_function_as_array(): void { - $searchAndSummarize = new \LlmLaraHub\LlmDriver\Functions\ReportingTool(); + $RetrieveRelated = new \LlmLaraHub\LlmDriver\Functions\ReportingTool(); - $function = $searchAndSummarize->getFunction(); + $function = $RetrieveRelated->getFunction(); $parameters = $function->parameters; diff --git a/tests/Feature/SearchAndSummarizeChatRepoTest.php b/tests/Feature/SearchAndSummarizeChatRepoTest.php index 878553eb..6ab08f65 100644 --- a/tests/Feature/SearchAndSummarizeChatRepoTest.php +++ b/tests/Feature/SearchAndSummarizeChatRepoTest.php @@ -5,7 +5,7 @@ use App\Domains\Agents\VerifyPromptOutputDto; use App\Domains\Chat\MetaDataDto; use App\Domains\Messages\RoleEnum; -use App\Domains\Messages\SearchAndSummarizeChatRepo; +use App\Domains\Messages\RetrieveRelatedChatRepo; use App\Models\Chat; use App\Models\Collection; use App\Models\Document; @@ -16,7 +16,7 @@ use LlmLaraHub\LlmDriver\LlmDriverFacade; use Tests\TestCase; -class SearchAndSummarizeChatRepoTest extends TestCase +class RetrieveRelatedChatRepoTest extends TestCase { /** * A basic feature test example. @@ -84,7 +84,7 @@ public function test_can_search(): void ]), ]); - $results = (new SearchAndSummarizeChatRepo())->search($chat, $message); + $results = (new RetrieveRelatedChatRepo())->search($chat, $message); $this->assertNotNull($results); $this->assertDatabaseCount('message_document_references', 3); diff --git a/tests/Feature/SearchAndSummarizeTest.php b/tests/Feature/SearchAndSummarizeTest.php index ecf71799..9836dea2 100644 --- a/tests/Feature/SearchAndSummarizeTest.php +++ b/tests/Feature/SearchAndSummarizeTest.php @@ -13,21 +13,21 @@ use LlmLaraHub\LlmDriver\DistanceQuery\DistanceQueryFacade; use LlmLaraHub\LlmDriver\Functions\ParametersDto; use LlmLaraHub\LlmDriver\Functions\PropertyDto; -use LlmLaraHub\LlmDriver\Functions\SearchAndSummarize; +use LlmLaraHub\LlmDriver\Functions\RetrieveRelated; use LlmLaraHub\LlmDriver\LlmDriverFacade; use LlmLaraHub\LlmDriver\Requests\MessageInDto; use Tests\TestCase; -class SearchAndSummarizeTest extends TestCase +class RetrieveRelatedTest extends TestCase { /** * A basic feature test example. */ public function test_can_generate_function_as_array(): void { - $searchAndSummarize = new \LlmLaraHub\LlmDriver\Functions\SearchAndSummarize(); + $RetrieveRelated = new \LlmLaraHub\LlmDriver\Functions\RetrieveRelated(); - $function = $searchAndSummarize->getFunction(); + $function = $RetrieveRelated->getFunction(); $parameters = $function->parameters; @@ -117,7 +117,7 @@ public function test_gets_user_input() )); $message = Message::factory()->user()->create(['chat_id' => $chat->id]); - $results = (new SearchAndSummarize())->handle($message); + $results = (new RetrieveRelated())->handle($message); $this->assertNotNull($results); $this->assertDatabaseCount('message_document_references', 3); diff --git a/tests/Feature/SimpleSearchAndSummarizeOrchestrateJobTest.php b/tests/Feature/SimpleSearchAndSummarizeOrchestrateJobTest.php index 77354178..63d1c7cd 100644 --- a/tests/Feature/SimpleSearchAndSummarizeOrchestrateJobTest.php +++ b/tests/Feature/SimpleSearchAndSummarizeOrchestrateJobTest.php @@ -3,7 +3,7 @@ namespace Tests\Feature; use App\Domains\Chat\MetaDataDto; -use App\Jobs\SimpleSearchAndSummarizeOrchestrateJob; +use App\Jobs\SimpleRetrieveRelatedOrchestrateJob; use App\Models\Chat; use App\Models\DocumentChunk; use App\Models\Message; @@ -11,7 +11,7 @@ use LlmLaraHub\LlmDriver\Responses\NonFunctionResponseDto; use Tests\TestCase; -class SimpleSearchAndSummarizeOrchestrateJobTest extends TestCase +class SimpleRetrieveRelatedOrchestrateJobTest extends TestCase { /** * A basic feature test example. @@ -39,7 +39,7 @@ public function test_job(): void ]), ]); - (new SimpleSearchAndSummarizeOrchestrateJob($message))->handle(); + (new SimpleRetrieveRelatedOrchestrateJob($message))->handle(); $this->assertDatabaseCount('prompt_histories', 1); $this->assertDatabaseCount('message_document_references', 3); diff --git a/tests/Feature/StandardsCheckerTest.php b/tests/Feature/StandardsCheckerTest.php index eedda82b..8d6ce069 100644 --- a/tests/Feature/StandardsCheckerTest.php +++ b/tests/Feature/StandardsCheckerTest.php @@ -19,9 +19,9 @@ class StandardsCheckerTest extends TestCase */ public function test_can_generate_function_as_array(): void { - $searchAndSummarize = new \LlmLaraHub\LlmDriver\Functions\StandardsChecker(); + $RetrieveRelated = new \LlmLaraHub\LlmDriver\Functions\StandardsChecker(); - $function = $searchAndSummarize->getFunction(); + $function = $RetrieveRelated->getFunction(); $parameters = $function->parameters; diff --git a/tests/Feature/SummarizeCollectionTest.php b/tests/Feature/SummarizeCollectionTest.php index 409674b3..bfd44bf1 100644 --- a/tests/Feature/SummarizeCollectionTest.php +++ b/tests/Feature/SummarizeCollectionTest.php @@ -22,9 +22,9 @@ class SummarizeCollectionTest extends TestCase */ public function test_can_generate_function_as_array(): void { - $searchAndSummarize = new \LlmLaraHub\LlmDriver\Functions\SummarizeCollection(); + $RetrieveRelated = new \LlmLaraHub\LlmDriver\Functions\SummarizeCollection(); - $function = $searchAndSummarize->getFunction(); + $function = $RetrieveRelated->getFunction(); $parameters = $function->parameters; @@ -35,7 +35,7 @@ public function test_can_generate_function_as_array(): void public function test_gathers_all_content() { - $searchAndSummarize = new \LlmLaraHub\LlmDriver\Functions\SummarizeCollection(); + $RetrieveRelated = new \LlmLaraHub\LlmDriver\Functions\SummarizeCollection(); $messageArray = []; $messageArray[] = MessageInDto::from([ diff --git a/tests/fixtures/claude_messages_after_remap.json b/tests/fixtures/claude_messages_after_remap.json index 8b2f5eee..a001b362 100644 --- a/tests/fixtures/claude_messages_after_remap.json +++ b/tests/fixtures/claude_messages_after_remap.json @@ -1,22 +1,28 @@ [ { "role": "user", - "content": "Get the content from the url https:\/\/dailyai.studio\n\nThen break the content down into\nthree points that would make sense to a real-estate agent\n\nFormat in Markdown with header sections and then some info\n\nDo not stray from the content" + "content": "test1" + }, + { + "role": "assistant", + "content": "test2" + }, + { + "role": "user", + "content": "Using the surrounding context to continue this response thread" }, { "role": "assistant", "content": [ { "type": "text", - "text": "This is Squarespace. tarantula-seal-jnkt DailyAi End of Squarespace Headers 0 AutomateYour Daily WorkflowsEffortlessly streamline your tasks and save valuable time with our easy-to-use automation platform. Start bringing Ai to your day to day business needs today! No Coding Required No Matter the Size of Your Business Take Advantage of Ai to Assist You Today Marketing Agencies, Real Estate Agencies, and other small businesses can now streamline tedious tasks and elevate their operations with the power of DailyAi's workflow tools.The platform leverages your existing \"Solutions and Strategies\" content to quickly build personalized RFP replies, saving you time and ensuring consistency RFP Reply AssistanceAutomatically generate detailed case studies that showcase your expertise and achievements.Case Study Building Automatically generate detailed case studies that showcase your expertise and achievements. Property Listings Automation Streamline the process of creating and publishing listings across multiple channels, ensuring consistent branding and reducing manual effort.Lead Nurturing Choose the Size that fits your needs Size Small $75 a MonthHosted for you, get going today for up to 3 users and 1000s of documents. Size Large $250 a MonthBigger Server to handle more users and documents! 24 hour email support. Self Hosted $600 Setup FeeYour get to manage the service on your own servers! Discover the easy to use DailyAiMade for you to create time saving automations in a few clicks! Let's ConnectWant to talk more about how DailAi can help your business? Or ready to start hosting your own private DailyAi.Studio? Name(required)First NameLast NameEmail(required)Message(required)SendSend \u00ad\u00ad<\/thinking>" + "text": "test3<\/thinking>" }, { "type": "tool_use", - "id": "toolu_01XDciQSrvSaR8fM1zLRY7iA", - "name": "get_web_site_from_url", - "input": { - "url": "https:\/\/dailyai.studio" - } + "id": "test_id", + "name": "test", + "input": [] } ] }, @@ -25,8 +31,8 @@ "content": [ { "type": "tool_result", - "tool_use_id": "toolu_01XDciQSrvSaR8fM1zLRY7iA", - "content": "This is Squarespace. tarantula-seal-jnkt DailyAi End of Squarespace Headers 0 AutomateYour Daily WorkflowsEffortlessly streamline your tasks and save valuable time with our easy-to-use automation platform. Start bringing Ai to your day to day business needs today! No Coding Required No Matter the Size of Your Business Take Advantage of Ai to Assist You Today Marketing Agencies, Real Estate Agencies, and other small businesses can now streamline tedious tasks and elevate their operations with the power of DailyAi's workflow tools.The platform leverages your existing \"Solutions and Strategies\" content to quickly build personalized RFP replies, saving you time and ensuring consistency RFP Reply AssistanceAutomatically generate detailed case studies that showcase your expertise and achievements.Case Study Building Automatically generate detailed case studies that showcase your expertise and achievements. Property Listings Automation Streamline the process of creating and publishing listings across multiple channels, ensuring consistent branding and reducing manual effort.Lead Nurturing Choose the Size that fits your needs Size Small $75 a MonthHosted for you, get going today for up to 3 users and 1000s of documents. Size Large $250 a MonthBigger Server to handle more users and documents! 24 hour email support. Self Hosted $600 Setup FeeYour get to manage the service on your own servers! Discover the easy to use DailyAiMade for you to create time saving automations in a few clicks! Let's ConnectWant to talk more about how DailAi can help your business? Or ready to start hosting your own private DailyAi.Studio? Name(required)First NameLast NameEmail(required)Message(required)SendSend \u00ad\u00ad" + "tool_use_id": "test_id", + "content": "test3" } ] } diff --git a/tests/fixtures/claude_messages_before_remap.json b/tests/fixtures/claude_messages_before_remap.json index 967e72a8..332b6c91 100644 --- a/tests/fixtures/claude_messages_before_remap.json +++ b/tests/fixtures/claude_messages_before_remap.json @@ -1,24 +1,44 @@ [ { - "content": "Get the content from the url https:\/\/dailyai.studio\n\nThen break the content down into\nthree points that would make sense to a real-estate agent\n\nFormat in Markdown with header sections and then some info\n\nDo not stray from the content", + "content": "test1", "role": "user", "is_ai": false, "show": true, - "tool": null, + "tool": "", "tool_id": "", "args": [], "meta_data": null }, { - "content": "This is Squarespace. tarantula-seal-jnkt DailyAi End of Squarespace Headers 0 AutomateYour Daily WorkflowsEffortlessly streamline your tasks and save valuable time with our easy-to-use automation platform. Start bringing Ai to your day to day business needs today! No Coding Required No Matter the Size of Your Business Take Advantage of Ai to Assist You Today Marketing Agencies, Real Estate Agencies, and other small businesses can now streamline tedious tasks and elevate their operations with the power of DailyAi's workflow tools.The platform leverages your existing \"Solutions and Strategies\" content to quickly build personalized RFP replies, saving you time and ensuring consistency RFP Reply AssistanceAutomatically generate detailed case studies that showcase your expertise and achievements.Case Study Building Automatically generate detailed case studies that showcase your expertise and achievements. Property Listings Automation Streamline the process of creating and publishing listings across multiple channels, ensuring consistent branding and reducing manual effort.Lead Nurturing Choose the Size that fits your needs Size Small $75 a MonthHosted for you, get going today for up to 3 users and 1000s of documents. Size Large $250 a MonthBigger Server to handle more users and documents! 24 hour email support. Self Hosted $600 Setup FeeYour get to manage the service on your own servers! Discover the easy to use DailyAiMade for you to create time saving automations in a few clicks! Let's ConnectWant to talk more about how DailAi can help your business? Or ready to start hosting your own private DailyAi.Studio? Name(required)First NameLast NameEmail(required)Message(required)SendSend \u00ad\u00ad", - "role": "tool", + "content": "test2", + "role": "assistant", "is_ai": false, "show": true, - "tool": "get_web_site_from_url", - "tool_id": "toolu_01XDciQSrvSaR8fM1zLRY7iA", - "args": { - "url": "https:\/\/dailyai.studio" - }, + "tool": "", + "tool_id": "", + "args": [], "meta_data": null + }, + { + "content": "test3", + "role": "tool", + "is_ai": false, + "show": true, + "tool": "test", + "tool_id": "test_id", + "args": [], + "meta_data": { + "persona": "", + "filter": null, + "completion": false, + "tool": "", + "tool_id": "", + "date_range": "", + "input": "", + "driver": "", + "source": "", + "reference_collection_id": "", + "args": [] + } } ] \ No newline at end of file diff --git a/tests/fixtures/claude_payload.json b/tests/fixtures/claude_payload.json index bcbb1a94..6e13ae1f 100644 --- a/tests/fixtures/claude_payload.json +++ b/tests/fixtures/claude_payload.json @@ -4,34 +4,27 @@ "messages": [ { "role": "user", - "content": "Get the content from the url https:\/\/dailyai.studio\n\nThen break the content down into\nthree points that would make sense to a real-estate agent\n\nFormat in Markdown with header sections and then some info\n\nDo not stray from the content" + "content": "test" }, { "role": "assistant", - "content": [ - { - "type": "text", - "text": "This is Squarespace. tarantula-seal-jnkt DailyAi End of Squarespace Headers 0 AutomateYour Daily WorkflowsEffortlessly streamline your tasks and save valuable time with our easy-to-use automation platform. Start bringing Ai to your day to day business needs today! No Coding Required No Matter the Size of Your Business Take Advantage of Ai to Assist You Today Marketing Agencies, Real Estate Agencies, and other small businesses can now streamline tedious tasks and elevate their operations with the power of DailyAi's workflow tools.The platform leverages your existing \"Solutions and Strategies\" content to quickly build personalized RFP replies, saving you time and ensuring consistency RFP Reply AssistanceAutomatically generate detailed case studies that showcase your expertise and achievements.Case Study Building Automatically generate detailed case studies that showcase your expertise and achievements. Property Listings Automation Streamline the process of creating and publishing listings across multiple channels, ensuring consistent branding and reducing manual effort.Lead Nurturing Choose the Size that fits your needs Size Small $75 a MonthHosted for you, get going today for up to 3 users and 1000s of documents. Size Large $250 a MonthBigger Server to handle more users and documents! 24 hour email support. Self Hosted $600 Setup FeeYour get to manage the service on your own servers! Discover the easy to use DailyAiMade for you to create time saving automations in a few clicks! Let's ConnectWant to talk more about how DailAi can help your business? Or ready to start hosting your own private DailyAi.Studio? Name(required)First NameLast NameEmail(required)Message(required)SendSend \u00ad\u00ad<\/thinking>" - }, - { - "type": "tool_use", - "id": "toolu_01XDciQSrvSaR8fM1zLRY7iA", - "name": "get_web_site_from_url", - "input": { - "url": "https:\/\/dailyai.studio" - } - } - ] + "content": "test 1" }, { "role": "user", - "content": [ - { - "type": "tool_result", - "tool_use_id": "toolu_01XDciQSrvSaR8fM1zLRY7iA", - "content": "This is Squarespace. tarantula-seal-jnkt DailyAi End of Squarespace Headers 0 AutomateYour Daily WorkflowsEffortlessly streamline your tasks and save valuable time with our easy-to-use automation platform. Start bringing Ai to your day to day business needs today! No Coding Required No Matter the Size of Your Business Take Advantage of Ai to Assist You Today Marketing Agencies, Real Estate Agencies, and other small businesses can now streamline tedious tasks and elevate their operations with the power of DailyAi's workflow tools.The platform leverages your existing \"Solutions and Strategies\" content to quickly build personalized RFP replies, saving you time and ensuring consistency RFP Reply AssistanceAutomatically generate detailed case studies that showcase your expertise and achievements.Case Study Building Automatically generate detailed case studies that showcase your expertise and achievements. Property Listings Automation Streamline the process of creating and publishing listings across multiple channels, ensuring consistent branding and reducing manual effort.Lead Nurturing Choose the Size that fits your needs Size Small $75 a MonthHosted for you, get going today for up to 3 users and 1000s of documents. Size Large $250 a MonthBigger Server to handle more users and documents! 24 hour email support. Self Hosted $600 Setup FeeYour get to manage the service on your own servers! Discover the easy to use DailyAiMade for you to create time saving automations in a few clicks! Let's ConnectWant to talk more about how DailAi can help your business? Or ready to start hosting your own private DailyAi.Studio? Name(required)First NameLast NameEmail(required)Message(required)SendSend \u00ad\u00ad" - } - ] + "content": "Using the surrounding context to continue this response thread" + }, + { + "role": "assistant", + "content": "test 2" + }, + { + "role": "user", + "content": "Using the surrounding context to continue this response thread" + }, + { + "role": "assistant", + "content": "test 3" } ], "tools": [ @@ -52,8 +45,8 @@ } }, { - "name": "search_and_summarize", - "description": "Used to embed users prompt, search database and return summarized results.", + "name": "retrieve_related", + "description": "Used to embed users prompt, search local database and return summarized results.\n DOES NOT SEARCH THE WEB. This is only used for local database search.", "input_schema": { "type": "object", "properties": { @@ -128,6 +121,38 @@ "url" ] } + }, + { + "name": "search_the_web", + "description": "Search the web for a topic", + "input_schema": { + "type": "object", + "properties": { + "search_phrase": { + "description": "1-5 words to search for", + "type": "string" + } + }, + "required": [ + "search_phrase" + ] + } + }, + { + "name": "create_document", + "description": "Create a document in the collection of this local system", + "input_schema": { + "type": "object", + "properties": { + "content": { + "description": "the content to use for the document", + "type": "string" + } + }, + "required": [ + "content" + ] + } } ] } \ No newline at end of file diff --git a/tests/fixtures/orchestrate_messages_fist_send.json b/tests/fixtures/orchestrate_messages_fist_send.json index 95fcdae0..4785c481 100644 --- a/tests/fixtures/orchestrate_messages_fist_send.json +++ b/tests/fixtures/orchestrate_messages_fist_send.json @@ -1,10 +1,10 @@ [ { - "content": "\nyou are helping me search the web for info and getting just the info I want out of it\n\nSearch for news on Ollama and then for any articles that have to do with Ollama write a TLDR about the article with a link to the article.\n\nTitle: \nSummary: 1-2 lines\nURL: \n\nIf a site does not have info just return 'false' the word so it will be ignored.", + "content": "Get the content from the url https:\/\/dailyai.studio\n\nThen do a summary of the content breaking it down into\nthree points that would make sense to a real-estate agent\n", "role": "user", "is_ai": false, "show": true, - "tool": null, + "tool": "", "tool_id": "", "args": [], "meta_data": null