|
10 | 10 |
|
11 | 11 | (eca/clean-after-test) |
12 | 12 |
|
13 | | -;; (deftest simple-text |
14 | | -;; (eca/start-process!) |
| 13 | +(deftest simple-text |
| 14 | + (eca/start-process!) |
15 | 15 |
|
16 | | -;; (eca/request! (fixture/initialize-request)) |
17 | | -;; (eca/notify! (fixture/initialized-notification)) |
18 | | -;; (let [chat-id* (atom nil)] |
19 | | -;; (testing "We send a simple hello message" |
20 | | -;; (llm.mocks/set-case! :simple-text-0) |
21 | | -;; (let [resp (eca/request! (fixture/chat-prompt-request |
22 | | -;; {:model "openai/gpt-4.1" |
23 | | -;; :message "Tell me a joke!"})) |
24 | | -;; chat-id (reset! chat-id* (:chatId resp))] |
| 16 | + (eca/request! (fixture/initialize-request)) |
| 17 | + (eca/notify! (fixture/initialized-notification)) |
| 18 | + (let [chat-id* (atom nil)] |
| 19 | + (testing "We send a simple hello message" |
| 20 | + (llm.mocks/set-case! :simple-text-0) |
| 21 | + (let [resp (eca/request! (fixture/chat-prompt-request |
| 22 | + {:model "openai/gpt-4.1" |
| 23 | + :message "Tell me a joke!"})) |
| 24 | + chat-id (reset! chat-id* (:chatId resp))] |
25 | 25 |
|
26 | | -;; (is (match? |
27 | | -;; {:chatId (m/pred string?) |
28 | | -;; :model "openai/gpt-4.1" |
29 | | -;; :status "prompting"} |
30 | | -;; resp)) |
| 26 | + (is (match? |
| 27 | + {:chatId (m/pred string?) |
| 28 | + :model "openai/gpt-4.1" |
| 29 | + :status "prompting"} |
| 30 | + resp)) |
31 | 31 |
|
32 | | -;; (match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"}) |
33 | | -;; (match-content chat-id "system" {:type "metadata" :title "Some Cool Title"}) |
34 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
35 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
36 | | -;; (match-content chat-id "assistant" {:type "text" :text "Knock"}) |
37 | | -;; (match-content chat-id "assistant" {:type "text" :text " knock!"}) |
38 | | -;; (match-content chat-id "system" {:type "usage" |
39 | | -;; :sessionTokens 30 |
40 | | -;; :lastMessageCost (m/pred string?) |
41 | | -;; :sessionCost (m/pred string?)}) |
42 | | -;; (match-content chat-id "system" {:type "progress" :state "finished"}) |
43 | | -;; (is (match? |
44 | | -;; {:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]}] |
45 | | -;; :instructions (m/pred string?)} |
46 | | -;; (llm.mocks/get-req-body :simple-text-0))))) |
| 32 | + (match-content chat-id "user" {:type "text" :text "Tell me a joke!\n"}) |
| 33 | + (match-content chat-id "system" {:type "metadata" :title "Some Cool Title"}) |
| 34 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
| 35 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
| 36 | + (match-content chat-id "assistant" {:type "text" :text "Knock"}) |
| 37 | + (match-content chat-id "assistant" {:type "text" :text " knock!"}) |
| 38 | + (match-content chat-id "system" {:type "usage" |
| 39 | + :sessionTokens 30 |
| 40 | + :lastMessageCost (m/pred string?) |
| 41 | + :sessionCost (m/pred string?)}) |
| 42 | + (match-content chat-id "system" {:type "progress" :state "finished"}) |
| 43 | + (is (match? |
| 44 | + {:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]}] |
| 45 | + :instructions (m/pred string?)} |
| 46 | + (llm.mocks/get-req-body :simple-text-0))))) |
47 | 47 |
|
48 | | -;; (testing "We reply" |
49 | | -;; (llm.mocks/set-case! :simple-text-1) |
50 | | -;; (let [resp (eca/request! (fixture/chat-prompt-request |
51 | | -;; {:chat-id @chat-id* |
52 | | -;; :model "openai/gpt-4.1" |
53 | | -;; :message "Who's there?"})) |
54 | | -;; chat-id @chat-id*] |
| 48 | + (testing "We reply" |
| 49 | + (llm.mocks/set-case! :simple-text-1) |
| 50 | + (let [resp (eca/request! (fixture/chat-prompt-request |
| 51 | + {:chat-id @chat-id* |
| 52 | + :model "openai/gpt-4.1" |
| 53 | + :message "Who's there?"})) |
| 54 | + chat-id @chat-id*] |
55 | 55 |
|
56 | | -;; (is (match? |
57 | | -;; {:chatId (m/pred string?) |
58 | | -;; :model "openai/gpt-4.1" |
59 | | -;; :status "prompting"} |
60 | | -;; resp)) |
| 56 | + (is (match? |
| 57 | + {:chatId (m/pred string?) |
| 58 | + :model "openai/gpt-4.1" |
| 59 | + :status "prompting"} |
| 60 | + resp)) |
61 | 61 |
|
62 | | -;; (match-content chat-id "user" {:type "text" :text "Who's there?\n"}) |
63 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
64 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
65 | | -;; (match-content chat-id "assistant" {:type "text" :text "Foo"}) |
66 | | -;; (match-content chat-id "system" {:type "usage" |
67 | | -;; :sessionTokens 15 |
68 | | -;; :lastMessageCost (m/pred string?) |
69 | | -;; :sessionCost (m/pred string?)}) |
70 | | -;; (match-content chat-id "system" {:type "progress" :state "finished"}) |
71 | | -;; (is (match? |
72 | | -;; {:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]} |
73 | | -;; {:role "assistant" :content [{:type "output_text" :text "Knock knock!"}]} |
74 | | -;; {:role "user" :content [{:type "input_text" :text "Who's there?"}]}]} |
75 | | -;; (llm.mocks/get-req-body :simple-text-1))))) |
| 62 | + (match-content chat-id "user" {:type "text" :text "Who's there?\n"}) |
| 63 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
| 64 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
| 65 | + (match-content chat-id "assistant" {:type "text" :text "Foo"}) |
| 66 | + (match-content chat-id "system" {:type "usage" |
| 67 | + :sessionTokens 15 |
| 68 | + :lastMessageCost (m/pred string?) |
| 69 | + :sessionCost (m/pred string?)}) |
| 70 | + (match-content chat-id "system" {:type "progress" :state "finished"}) |
| 71 | + (is (match? |
| 72 | + {:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]} |
| 73 | + {:role "assistant" :content [{:type "output_text" :text "Knock knock!"}]} |
| 74 | + {:role "user" :content [{:type "input_text" :text "Who's there?"}]}]} |
| 75 | + (llm.mocks/get-req-body :simple-text-1))))) |
76 | 76 |
|
77 | | -;; (testing "model reply again keeping context" |
78 | | -;; (llm.mocks/set-case! :simple-text-2) |
79 | | -;; (let [resp (eca/request! (fixture/chat-prompt-request |
80 | | -;; {:chat-id @chat-id* |
81 | | -;; :model "openai/gpt-4.1" |
82 | | -;; :message "What foo?"})) |
83 | | -;; chat-id @chat-id*] |
| 77 | + (testing "model reply again keeping context" |
| 78 | + (llm.mocks/set-case! :simple-text-2) |
| 79 | + (let [resp (eca/request! (fixture/chat-prompt-request |
| 80 | + {:chat-id @chat-id* |
| 81 | + :model "openai/gpt-4.1" |
| 82 | + :message "What foo?"})) |
| 83 | + chat-id @chat-id*] |
84 | 84 |
|
85 | | -;; (is (match? |
86 | | -;; {:chatId (m/pred string?) |
87 | | -;; :model "openai/gpt-4.1" |
88 | | -;; :status "prompting"} |
89 | | -;; resp)) |
| 85 | + (is (match? |
| 86 | + {:chatId (m/pred string?) |
| 87 | + :model "openai/gpt-4.1" |
| 88 | + :status "prompting"} |
| 89 | + resp)) |
90 | 90 |
|
91 | | -;; (match-content chat-id "user" {:type "text" :text "What foo?\n"}) |
92 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
93 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
94 | | -;; (match-content chat-id "assistant" {:type "text" :text "Foo"}) |
95 | | -;; (match-content chat-id "assistant" {:type "text" :text " bar!"}) |
96 | | -;; (match-content chat-id "assistant" {:type "text" :text "\n\n"}) |
97 | | -;; (match-content chat-id "assistant" {:type "text" :text "Ha!"}) |
98 | | -;; (match-content chat-id "system" {:type "usage" |
99 | | -;; :sessionTokens 20 |
100 | | -;; :lastMessageCost (m/pred string?) |
101 | | -;; :sessionCost (m/pred string?)}) |
102 | | -;; (match-content chat-id "system" {:type "progress" :state "finished"}) |
103 | | -;; (is (match? |
104 | | -;; {:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]} |
105 | | -;; {:role "assistant" :content [{:type "output_text" :text "Knock knock!"}]} |
106 | | -;; {:role "user" :content [{:type "input_text" :text "Who's there?"}]} |
107 | | -;; {:role "assistant" :content [{:type "output_text" :text "Foo"}]} |
108 | | -;; {:role "user" :content [{:type "input_text" :text "What foo?"}]}]} |
109 | | -;; (llm.mocks/get-req-body :simple-text-2))))))) |
| 91 | + (match-content chat-id "user" {:type "text" :text "What foo?\n"}) |
| 92 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
| 93 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
| 94 | + (match-content chat-id "assistant" {:type "text" :text "Foo"}) |
| 95 | + (match-content chat-id "assistant" {:type "text" :text " bar!"}) |
| 96 | + (match-content chat-id "assistant" {:type "text" :text "\n\n"}) |
| 97 | + (match-content chat-id "assistant" {:type "text" :text "Ha!"}) |
| 98 | + (match-content chat-id "system" {:type "usage" |
| 99 | + :sessionTokens 20 |
| 100 | + :lastMessageCost (m/pred string?) |
| 101 | + :sessionCost (m/pred string?)}) |
| 102 | + (match-content chat-id "system" {:type "progress" :state "finished"}) |
| 103 | + (is (match? |
| 104 | + {:input [{:role "user" :content [{:type "input_text" :text "Tell me a joke!"}]} |
| 105 | + {:role "assistant" :content [{:type "output_text" :text "Knock knock!"}]} |
| 106 | + {:role "user" :content [{:type "input_text" :text "Who's there?"}]} |
| 107 | + {:role "assistant" :content [{:type "output_text" :text "Foo"}]} |
| 108 | + {:role "user" :content [{:type "input_text" :text "What foo?"}]}]} |
| 109 | + (llm.mocks/get-req-body :simple-text-2))))))) |
110 | 110 |
|
111 | | -;; (deftest reasoning-text |
112 | | -;; (eca/start-process!) |
| 111 | +(deftest reasoning-text |
| 112 | + (eca/start-process!) |
113 | 113 |
|
114 | | -;; (eca/request! (fixture/initialize-request)) |
115 | | -;; (eca/notify! (fixture/initialized-notification)) |
116 | | -;; (let [chat-id* (atom nil)] |
117 | | -;; (testing "We send a hello message" |
118 | | -;; (llm.mocks/set-case! :reasoning-0) |
119 | | -;; (let [resp (eca/request! (fixture/chat-prompt-request |
120 | | -;; {:model "openai/gpt-5" |
121 | | -;; :message "hello!"})) |
122 | | -;; chat-id (reset! chat-id* (:chatId resp))] |
| 114 | + (eca/request! (fixture/initialize-request)) |
| 115 | + (eca/notify! (fixture/initialized-notification)) |
| 116 | + (let [chat-id* (atom nil)] |
| 117 | + (testing "We send a hello message" |
| 118 | + (llm.mocks/set-case! :reasoning-0) |
| 119 | + (let [resp (eca/request! (fixture/chat-prompt-request |
| 120 | + {:model "openai/gpt-5" |
| 121 | + :message "hello!"})) |
| 122 | + chat-id (reset! chat-id* (:chatId resp))] |
123 | 123 |
|
124 | | -;; (is (match? |
125 | | -;; {:chatId (m/pred string?) |
126 | | -;; :model "openai/gpt-5" |
127 | | -;; :status "prompting"} |
128 | | -;; resp)) |
| 124 | + (is (match? |
| 125 | + {:chatId (m/pred string?) |
| 126 | + :model "openai/gpt-5" |
| 127 | + :status "prompting"} |
| 128 | + resp)) |
129 | 129 |
|
130 | | -;; (match-content chat-id "user" {:type "text" :text "hello!\n"}) |
131 | | -;; (match-content chat-id "system" {:type "metadata" :title "Some Cool Title"}) |
132 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
133 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
134 | | -;; (match-content chat-id "assistant" {:type "reasonStarted" :id "123"}) |
135 | | -;; (match-content chat-id "assistant" {:type "reasonText" :id "123" :text "I should say"}) |
136 | | -;; (match-content chat-id "assistant" {:type "reasonText" :id "123" :text " hello"}) |
137 | | -;; (match-content chat-id "assistant" {:type "reasonFinished" :id "123" :totalTimeMs (m/pred number?)}) |
138 | | -;; (match-content chat-id "assistant" {:type "text" :text "hello"}) |
139 | | -;; (match-content chat-id "assistant" {:type "text" :text " there!"}) |
140 | | -;; (match-content chat-id "system" {:type "usage" |
141 | | -;; :sessionTokens 35 |
142 | | -;; :lastMessageCost (m/pred string?) |
143 | | -;; :sessionCost (m/pred string?)}) |
144 | | -;; (match-content chat-id "system" {:type "progress" :state "finished"}) |
145 | | -;; (is (match? |
146 | | -;; {:input [{:role "user" :content [{:type "input_text" :text "hello!"}]}] |
147 | | -;; :instructions (m/pred string?)} |
148 | | -;; (llm.mocks/get-req-body :reasoning-0))))) |
| 130 | + (match-content chat-id "user" {:type "text" :text "hello!\n"}) |
| 131 | + (match-content chat-id "system" {:type "metadata" :title "Some Cool Title"}) |
| 132 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
| 133 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
| 134 | + (match-content chat-id "assistant" {:type "reasonStarted" :id "123"}) |
| 135 | + (match-content chat-id "assistant" {:type "reasonText" :id "123" :text "I should say"}) |
| 136 | + (match-content chat-id "assistant" {:type "reasonText" :id "123" :text " hello"}) |
| 137 | + (match-content chat-id "assistant" {:type "reasonFinished" :id "123" :totalTimeMs (m/pred number?)}) |
| 138 | + (match-content chat-id "assistant" {:type "text" :text "hello"}) |
| 139 | + (match-content chat-id "assistant" {:type "text" :text " there!"}) |
| 140 | + (match-content chat-id "system" {:type "usage" |
| 141 | + :sessionTokens 35 |
| 142 | + :lastMessageCost (m/pred string?) |
| 143 | + :sessionCost (m/pred string?)}) |
| 144 | + (match-content chat-id "system" {:type "progress" :state "finished"}) |
| 145 | + (is (match? |
| 146 | + {:input [{:role "user" :content [{:type "input_text" :text "hello!"}]}] |
| 147 | + :instructions (m/pred string?)} |
| 148 | + (llm.mocks/get-req-body :reasoning-0))))) |
149 | 149 |
|
150 | | -;; (testing "We reply" |
151 | | -;; (llm.mocks/set-case! :reasoning-1) |
152 | | -;; (let [resp (eca/request! (fixture/chat-prompt-request |
153 | | -;; {:chat-id @chat-id* |
154 | | -;; :model "openai/gpt-5" |
155 | | -;; :message "how are you?"})) |
156 | | -;; chat-id @chat-id*] |
| 150 | + (testing "We reply" |
| 151 | + (llm.mocks/set-case! :reasoning-1) |
| 152 | + (let [resp (eca/request! (fixture/chat-prompt-request |
| 153 | + {:chat-id @chat-id* |
| 154 | + :model "openai/gpt-5" |
| 155 | + :message "how are you?"})) |
| 156 | + chat-id @chat-id*] |
157 | 157 |
|
158 | | -;; (is (match? |
159 | | -;; {:chatId (m/pred string?) |
160 | | -;; :model "openai/gpt-5" |
161 | | -;; :status "prompting"} |
162 | | -;; resp)) |
| 158 | + (is (match? |
| 159 | + {:chatId (m/pred string?) |
| 160 | + :model "openai/gpt-5" |
| 161 | + :status "prompting"} |
| 162 | + resp)) |
163 | 163 |
|
164 | | -;; (match-content chat-id "user" {:type "text" :text "how are you?\n"}) |
165 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
166 | | -;; (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
167 | | -;; (match-content chat-id "assistant" {:type "reasonStarted" :id "234"}) |
168 | | -;; (match-content chat-id "assistant" {:type "reasonText" :id "234" :text "I should say"}) |
169 | | -;; (match-content chat-id "assistant" {:type "reasonText" :id "234" :text " fine"}) |
170 | | -;; (match-content chat-id "assistant" {:type "reasonFinished" :id "234" :totalTimeMs (m/pred number?)}) |
171 | | -;; (match-content chat-id "assistant" {:type "text" :text "I'm "}) |
172 | | -;; (match-content chat-id "assistant" {:type "text" :text " fine"}) |
173 | | -;; (match-content chat-id "system" {:type "usage" |
174 | | -;; :sessionTokens 30 |
175 | | -;; :lastMessageCost (m/pred string?) |
176 | | -;; :sessionCost (m/pred string?)}) |
177 | | -;; (match-content chat-id "system" {:type "progress" :state "finished"}) |
178 | | -;; (is (match? |
179 | | -;; {:input [{:role "user" :content [{:type "input_text" :text "hello!"}]} |
180 | | -;; {:type "reasoning" |
181 | | -;; :id "123" |
182 | | -;; :summary [{:type "summary_text" :text "I should say hello"}] |
183 | | -;; :encrypted_content "enc-123"} |
184 | | -;; {:role "assistant" :content [{:type "output_text" :text "hello there!"}]} |
185 | | -;; {:role "user" :content [{:type "input_text" :text "how are you?"}]}] |
186 | | -;; :instructions (m/pred string?)} |
187 | | -;; (llm.mocks/get-req-body :reasoning-1))))))) |
| 164 | + (match-content chat-id "user" {:type "text" :text "how are you?\n"}) |
| 165 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
| 166 | + (match-content chat-id "system" {:type "progress" :state "running" :text "Generating"}) |
| 167 | + (match-content chat-id "assistant" {:type "reasonStarted" :id "234"}) |
| 168 | + (match-content chat-id "assistant" {:type "reasonText" :id "234" :text "I should say"}) |
| 169 | + (match-content chat-id "assistant" {:type "reasonText" :id "234" :text " fine"}) |
| 170 | + (match-content chat-id "assistant" {:type "reasonFinished" :id "234" :totalTimeMs (m/pred number?)}) |
| 171 | + (match-content chat-id "assistant" {:type "text" :text "I'm "}) |
| 172 | + (match-content chat-id "assistant" {:type "text" :text " fine"}) |
| 173 | + (match-content chat-id "system" {:type "usage" |
| 174 | + :sessionTokens 30 |
| 175 | + :lastMessageCost (m/pred string?) |
| 176 | + :sessionCost (m/pred string?)}) |
| 177 | + (match-content chat-id "system" {:type "progress" :state "finished"}) |
| 178 | + (is (match? |
| 179 | + {:input [{:role "user" :content [{:type "input_text" :text "hello!"}]} |
| 180 | + {:type "reasoning" |
| 181 | + :id "123" |
| 182 | + :summary [{:type "summary_text" :text "I should say hello"}] |
| 183 | + :encrypted_content "enc-123"} |
| 184 | + {:role "assistant" :content [{:type "output_text" :text "hello there!"}]} |
| 185 | + {:role "user" :content [{:type "input_text" :text "how are you?"}]}] |
| 186 | + :instructions (m/pred string?)} |
| 187 | + (llm.mocks/get-req-body :reasoning-1))))))) |
188 | 188 |
|
189 | 189 | (deftest tool-calling |
190 | 190 | (eca/start-process!) |
|
0 commit comments