File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
src/Providers/Ollama/Maps Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ protected function mapToolResultMessage(ToolResultMessage $message): void
6262 foreach ($ message ->toolResults as $ toolResult ) {
6363 $ this ->mappedMessages [] = [
6464 'role ' => 'tool ' ,
65+ 'tool_name ' => $ toolResult ->toolName ,
6566 'content ' => is_string ($ toolResult ->result )
6667 ? $ toolResult ->result
6768 : (json_encode ($ toolResult ->result ) ?: '' ),
@@ -94,7 +95,7 @@ protected function mapAssistantMessage(AssistantMessage $message): void
9495 'tool_calls ' => $ message ->toolCalls ? array_map (fn (ToolCall $ toolCall ): array => [
9596 'function ' => [
9697 'name ' => $ toolCall ->name ,
97- 'arguments ' => $ toolCall ->arguments (),
98+ 'arguments ' => ( object ) $ toolCall ->arguments (),
9899 ],
99100 ], $ message ->toolCalls ) : null ,
100101 ]);
Original file line number Diff line number Diff line change 8383 $ messageMap = new MessageMap ([$ assistantMessage ]);
8484 $ result = $ messageMap ->map ();
8585
86- expect ($ result )->toBe ([
86+ expect ($ result )->toEqual ([
8787 [
8888 'role ' => 'assistant ' ,
8989 'content ' => 'Assistant response ' ,
9090 'tool_calls ' => [[
9191 'function ' => [
9292 'name ' => 'search ' ,
93- 'arguments ' => [
93+ 'arguments ' => ( object ) [
9494 'query ' => 'What is Prism? ' ,
9595 ],
9696 ],
114114 expect ($ result )->toBe ([
115115 [
116116 'role ' => 'tool ' ,
117+ 'tool_name ' => 'test-tool ' ,
117118 'content ' => 'Tool execution result ' ,
118119 ],
119120 ]);
134135 expect ($ result )->toBe ([
135136 [
136137 'role ' => 'tool ' ,
138+ 'tool_name ' => 'test-tool ' ,
137139 'content ' => '{"key":"value"} ' ,
138140 ],
139141 ]);
You can’t perform that action at this time.
0 commit comments