11import { LLMock } from "@copilotkit/aimock"
2- import type { ChatCompletionRequest , ChatMessage } from "@copilotkit/aimock"
2+
3+ import { toolResultContains } from "./fixture-utils"
34
45type SearchFilesFixture = {
56 userMessagePattern : string
@@ -11,20 +12,6 @@ type SearchFilesFixture = {
1112 id : string
1213}
1314
14- function toolResultContains ( req : ChatCompletionRequest , toolCallId : string , expected : string [ ] ) {
15- const messages = Array . isArray ( req ?. messages ) ? req . messages : [ ]
16- const toolMessage = messages . find (
17- ( message : ChatMessage ) => message ?. role === "tool" && message . tool_call_id === toolCallId ,
18- )
19-
20- const content = toolMessage ?. content
21- if ( typeof content !== "string" ) {
22- return false
23- }
24-
25- return expected . every ( ( text ) => content . includes ( text ) )
26- }
27-
2815export function addSearchFilesResultFixtures ( mock : InstanceType < typeof LLMock > ) {
2916 const fixtures : SearchFilesFixture [ ] = [
3017 {
@@ -102,7 +89,7 @@ export function addSearchFilesResultFixtures(mock: InstanceType<typeof LLMock>)
10289 toolName : "search_files" ,
10390 arguments : '{"path":"search-files-tool-fixture","regex":"nonExistentPattern12345"}' ,
10491 toolCallId : "call_search_files_no_match_001" ,
105- expected : [ "Found 0 results. " ] ,
92+ expected : [ "No results found " ] ,
10693 result : "No matches were found for `nonExistentPattern12345` in the search fixture directory." ,
10794 id : "call_search_files_no_match_002" ,
10895 } ,
0 commit comments