framework-ify. proper agent runtime + adopt ag-ui
CI / Test + coverage (pull_request) Successful in 1m41s
CI / Test + coverage (pull_request) Successful in 1m41s
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
(ns tbd.agent.instructions-test
|
||||
(:require [clojure.string :as str]
|
||||
[clojure.test :refer [deftest is]]
|
||||
[tbd.agent.instructions :as instructions]
|
||||
[tbd.agent.prompt :as prompt]))
|
||||
|
||||
(defn- flat
|
||||
"`text` on one line: the prompts are wrapped in the source, where they wrap is not the point."
|
||||
[text]
|
||||
(str/replace text #"\s+" " "))
|
||||
|
||||
(deftest chat-and-guide-share-the-instructions
|
||||
(doseq [text (map flat [(instructions/chat) prompt/guide])]
|
||||
(is (str/includes? text "Act, don't offer"))
|
||||
(is (str/includes? text "in this same turn"))
|
||||
(is (str/includes? text "Work it out yourself:"))
|
||||
(is (str/includes? text "Say something was done only if a tool result says it was"))
|
||||
(is (str/includes? text "Tic-tac-toe: check whose turn it is"))
|
||||
(is (str/includes? text "Examples: "))))
|
||||
|
||||
(deftest chat-is-framed-as-the-in-page-chatbot
|
||||
(let [text (instructions/chat)]
|
||||
(is (str/includes? text "under your message"))
|
||||
(is (str/includes? text "Chain calls without stopping"))
|
||||
(is (str/includes? text "navigate there, then") "the chatbot's tools follow the page it is on")))
|
||||
|
||||
(deftest chat-system-message-adds-page-and-tools
|
||||
(is (= (instructions/chat) (instructions/chat-system-message nil nil)))
|
||||
(let [text (instructions/chat-system-message "todos" [{:name "create_todo"} {:name "list_todos"}])]
|
||||
(is (str/includes? text "on the \"todos\" page"))
|
||||
(is (str/includes? text "Its tools: create_todo, list_todos"))))
|
||||
|
||||
(deftest a2a-has-no-in-page-framing
|
||||
(let [text (instructions/a2a)]
|
||||
(is (str/includes? text "Act, don't offer"))
|
||||
(is (str/includes? text "Agent2Agent protocol"))
|
||||
(is (str/includes? text "no page open"))
|
||||
(is (not (str/includes? text "under your message")))))
|
||||
Reference in New Issue
Block a user