File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 (is (match?
2323 {:contents [{:type :text
2424 :error true
25- :content " /foo/qux is not a valid path" }]}
25+ :content ( str ( h/file-path " /foo/qux" ) " is not a valid path" ) }]}
2626 (with-redefs [fs/canonicalize (constantly (h/file-path " /foo/qux" ))
2727 fs/exists? (constantly false )]
2828 ((get-in f.tools.filesystem/definitions [" list_directory" :handler ])
3232 (is (match?
3333 {:contents [{:type :text
3434 :error true
35- :content " Access denied - path /foo/qux outside allowed directories" }]}
35+ :content ( format " Access denied - path %s outside allowed directories" ( h/file-path " /foo/qux " )) }]}
3636 (with-redefs [fs/canonicalize (constantly (h/file-path " /foo/qux" ))
3737 fs/exists? (constantly true )]
3838 ((get-in f.tools.filesystem/definitions [" list_directory" :handler ])
6161 (is (match?
6262 {:contents [{:type :text
6363 :error true
64- :content " File /foo/qux is not readable" }]}
64+ :content ( format " File %s is not readable" ( h/file-path " /foo/qux " )) }]}
6565 (with-redefs [fs/exists? (constantly true )
6666 fs/readable? (constantly false )
6767 f.tools.filesystem/allowed-path? (constantly true )]
Original file line number Diff line number Diff line change 77(deftest ->messages-with-history-test
88 (testing " no previous history"
99 (is (match?
10- [{:role " user" :content " Hey" :cache_control {:type " ephemeral" }}]
10+ [{:role " user" :content [{ :type :text :text " Hey" :cache_control {:type " ephemeral" }}] }]
1111 (#'llm-providers.anthropic/->messages-with-history [] " Hey" ))))
1212 (testing " With basic text history"
1313 (is (match?
1414 [{:role " user" :content " Count with me: 1" }
1515 {:role " assistant" :content " 2" }
16- {:role " user" :content " 3" :cache_control {:type " ephemeral" }}]
16+ {:role " user" :content [{ :type :text :text " 3" :cache_control {:type " ephemeral" }}] }]
1717 (#'llm-providers.anthropic/->messages-with-history
1818 [{:role " user" :content " Count with me: 1" }
1919 {:role " assistant" :content " 2" }]
3030 :tool-use-id " call-1"
3131 :content " Allowed directories: /foo/bar\n " }]}
3232 {:role " assistant" :content " I see /foo/bar" }
33- {:role " user" :content " Thanks" :cache_control {:type " ephemeral" }}]
33+ {:role " user" :content [{ :type :text :text " Thanks" :cache_control {:type " ephemeral" }}] }]
3434 (#'llm-providers.anthropic/->messages-with-history
3535 [{:role " user" :content " List the files you are allowed" }
3636 {:role " assistant" :content " Ok!" }
You can’t perform that action at this time.
0 commit comments