|
28 | 28 | (let [req-id 0 |
29 | 29 | resp (eca/request! (fixture/chat-prompt-request |
30 | 30 | {:request-id req-id |
31 | | - :model "gpt-5" |
| 31 | + :model "gpt-4.1" |
32 | 32 | :message "Tell me a joke!"})) |
33 | 33 | chat-id (reset! chat-id* (:chatId resp))] |
34 | 34 |
|
35 | 35 | (is (match? |
36 | 36 | {:chatId (m/pred string?) |
37 | | - :model "gpt-5" |
| 37 | + :model "gpt-4.1" |
38 | 38 | :status "success"} |
39 | 39 | resp)) |
40 | 40 |
|
|
61 | 61 | resp (eca/request! (fixture/chat-prompt-request |
62 | 62 | {:chat-id @chat-id* |
63 | 63 | :request-id req-id |
64 | | - :model "gpt-5" |
| 64 | + :model "gpt-4.1" |
65 | 65 | :message "Who's there?"})) |
66 | 66 | chat-id @chat-id*] |
67 | 67 |
|
68 | 68 | (is (match? |
69 | 69 | {:chatId (m/pred string?) |
70 | | - :model "gpt-5" |
| 70 | + :model "gpt-4.1" |
71 | 71 | :status "success"} |
72 | 72 | resp)) |
73 | 73 |
|
|
94 | 94 | resp (eca/request! (fixture/chat-prompt-request |
95 | 95 | {:chat-id @chat-id* |
96 | 96 | :request-id req-id |
97 | | - :model "gpt-5" |
| 97 | + :model "gpt-4.1" |
98 | 98 | :message "What foo?"})) |
99 | 99 | chat-id @chat-id*] |
100 | 100 |
|
101 | 101 | (is (match? |
102 | 102 | {:chatId (m/pred string?) |
103 | | - :model "gpt-5" |
| 103 | + :model "gpt-4.1" |
104 | 104 | :status "success"} |
105 | 105 | resp)) |
106 | 106 |
|
|
125 | 125 | {:role "assistant" :content [{:type "output_text" :text "Foo"}]} |
126 | 126 | {:role "user" :content [{:type "input_text" :text "What foo?"}]}]} |
127 | 127 | llm.mocks/*last-req-body*)))))) |
| 128 | + |
| 129 | +(deftest reasoning-text |
| 130 | + (eca/start-process!) |
| 131 | + |
| 132 | + (eca/request! (fixture/initialize-request)) |
| 133 | + (eca/notify! (fixture/initialized-notification)) |
| 134 | + (let [chat-id* (atom nil)] |
| 135 | + (testing "We send a hello message" |
| 136 | + (llm.mocks/set-case! :reasoning-0) |
| 137 | + (let [req-id 0 |
| 138 | + resp (eca/request! (fixture/chat-prompt-request |
| 139 | + {:request-id req-id |
| 140 | + :model "gpt-5" |
| 141 | + :message "hello!"})) |
| 142 | + chat-id (reset! chat-id* (:chatId resp))] |
| 143 | + |
| 144 | + (is (match? |
| 145 | + {:chatId (m/pred string?) |
| 146 | + :model "gpt-5" |
| 147 | + :status "success"} |
| 148 | + resp)) |
| 149 | + |
| 150 | + (match-content chat-id req-id "user" {:type "text" :text "hello!\n"}) |
| 151 | + (match-content chat-id req-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
| 152 | + (match-content chat-id req-id "system" {:type "progress" :state "running" :text "Generating"}) |
| 153 | + (match-content chat-id req-id "assistant" {:type "reasonStarted" :id "123"}) |
| 154 | + (match-content chat-id req-id "assistant" {:type "reasonText" :id "123" :text "I should say"}) |
| 155 | + (match-content chat-id req-id "assistant" {:type "reasonText" :id "123" :text " hello"}) |
| 156 | + (match-content chat-id req-id "assistant" {:type "reasonFinished" :id "123"}) |
| 157 | + (match-content chat-id req-id "assistant" {:type "text" :text "hello"}) |
| 158 | + (match-content chat-id req-id "assistant" {:type "text" :text " there!"}) |
| 159 | + (match-content chat-id req-id "system" {:type "usage" |
| 160 | + :messageInputTokens 5 |
| 161 | + :messageOutputTokens 30 |
| 162 | + :sessionTokens 35 |
| 163 | + :messageCost (m/pred string?) |
| 164 | + :sessionCost (m/pred string?)}) |
| 165 | + (match-content chat-id req-id "system" {:type "progress" :state "finished"}) |
| 166 | + (is (match? |
| 167 | + {:input [{:role "user" :content [{:type "input_text" :text "hello!"}]}] |
| 168 | + :instructions (m/pred string?)} |
| 169 | + llm.mocks/*last-req-body*)))) |
| 170 | + |
| 171 | + (testing "We reply" |
| 172 | + (llm.mocks/set-case! :reasoning-1) |
| 173 | + (let [req-id 1 |
| 174 | + resp (eca/request! (fixture/chat-prompt-request |
| 175 | + {:request-id req-id |
| 176 | + :chat-id @chat-id* |
| 177 | + :model "gpt-5" |
| 178 | + :message "how are you?"})) |
| 179 | + chat-id @chat-id*] |
| 180 | + |
| 181 | + (is (match? |
| 182 | + {:chatId (m/pred string?) |
| 183 | + :model "gpt-5" |
| 184 | + :status "success"} |
| 185 | + resp)) |
| 186 | + |
| 187 | + (match-content chat-id req-id "user" {:type "text" :text "how are you?\n"}) |
| 188 | + (match-content chat-id req-id "system" {:type "progress" :state "running" :text "Waiting model"}) |
| 189 | + (match-content chat-id req-id "system" {:type "progress" :state "running" :text "Generating"}) |
| 190 | + (match-content chat-id req-id "assistant" {:type "reasonStarted" :id "234"}) |
| 191 | + (match-content chat-id req-id "assistant" {:type "reasonText" :id "234" :text "I should say"}) |
| 192 | + (match-content chat-id req-id "assistant" {:type "reasonText" :id "234" :text " fine"}) |
| 193 | + (match-content chat-id req-id "assistant" {:type "reasonFinished" :id "234"}) |
| 194 | + (match-content chat-id req-id "assistant" {:type "text" :text "I'm "}) |
| 195 | + (match-content chat-id req-id "assistant" {:type "text" :text " fine"}) |
| 196 | + (match-content chat-id req-id "system" {:type "usage" |
| 197 | + :messageInputTokens 10 |
| 198 | + :messageOutputTokens 20 |
| 199 | + :sessionTokens 65 |
| 200 | + :messageCost (m/pred string?) |
| 201 | + :sessionCost (m/pred string?)}) |
| 202 | + (match-content chat-id req-id "system" {:type "progress" :state "finished"}) |
| 203 | + (is (match? |
| 204 | + {:input [{:role "user" :content [{:type "input_text" :text "hello!"}]} |
| 205 | + {:type "reasoning" |
| 206 | + :id "123" |
| 207 | + :summary [{:type "summary_text" :text "I should say hello"}] |
| 208 | + :encrypted_content "enc-123"} |
| 209 | + {:role "assistant" :content [{:type "output_text" :text "hello there!"}]} |
| 210 | + {:role "user" :content [{:type "input_text" :text "how are you?"}]}] |
| 211 | + :instructions (m/pred string?)} |
| 212 | + llm.mocks/*last-req-body*)))))) |
0 commit comments