1111import static com .github .tomakehurst .wiremock .client .WireMock .verify ;
1212import static com .github .tomakehurst .wiremock .stubbing .Scenario .STARTED ;
1313import static org .assertj .core .api .Assertions .assertThat ;
14- import static org .assertj .core .api .Assertions .assertThatThrownBy ;
1514import static org .mockito .ArgumentMatchers .any ;
1615import static org .mockito .Mockito .doReturn ;
1716import static org .mockito .Mockito .mock ;
@@ -88,16 +87,6 @@ void testCompletion() {
8887 assertThat (result .getResult ().getOutput ().getText ()).isNotEmpty ();
8988 }
9089
91- @ Test
92- void testThrowsOnMissingChatOptions () {
93- assertThatThrownBy (() -> client .call (new Prompt ("test" )))
94- .isExactlyInstanceOf (IllegalArgumentException .class )
95- .hasMessageContaining ("Please add OrchestrationChatOptions to the Prompt" );
96- assertThatThrownBy (() -> client .stream (new Prompt ("test" )))
97- .isExactlyInstanceOf (IllegalArgumentException .class )
98- .hasMessageContaining ("Please add OrchestrationChatOptions to the Prompt" );
99- }
100-
10190 @ Test
10291 void testStreamCompletion () throws IOException {
10392 try (val inputStream = spy (fileLoader .apply ("streamChatCompletion.txt" ))) {
@@ -117,15 +106,13 @@ void testStreamCompletion() throws IOException {
117106 Flux <ChatResponse > flux = client .stream (prompt );
118107 val deltaList = flux .toStream ().toList ();
119108
120- assertThat (deltaList ).hasSize (3 );
109+ assertThat (deltaList ).hasSize (5 );
121110 // the first delta doesn't have any content
122111 assertThat (deltaList .get (0 ).getResult ().getOutput ().getText ()).isEqualTo ("" );
123- assertThat (deltaList .get (1 ).getResult ().getOutput ().getText ()).isEqualTo ("Sure" );
124- assertThat (deltaList .get (2 ).getResult ().getOutput ().getText ()).isEqualTo ("!" );
125-
126- assertThat (deltaList .get (0 ).getResult ().getMetadata ().getFinishReason ()).isEqualTo ("" );
127- assertThat (deltaList .get (1 ).getResult ().getMetadata ().getFinishReason ()).isEqualTo ("" );
128- assertThat (deltaList .get (2 ).getResult ().getMetadata ().getFinishReason ()).isEqualTo ("stop" );
112+ assertThat (deltaList .get (1 ).getResult ().getOutput ().getText ()).isEqualTo ("" );
113+ assertThat (deltaList .get (2 ).getResult ().getOutput ().getText ()).isEqualTo ("Sure" );
114+ assertThat (deltaList .get (3 ).getResult ().getOutput ().getText ()).isEqualTo ("!" );
115+ assertThat (deltaList .get (4 ).getResult ().getOutput ().getText ()).isEqualTo ("" );
129116
130117 Mockito .verify (inputStream , times (1 )).close ();
131118 }
@@ -217,7 +204,7 @@ void testChatMemory() throws IOException {
217204 .willSetStateTo ("Second Call" ));
218205
219206 stubFor (
220- post (urlPathEqualTo ("/v2/completion " ))
207+ post (urlPathEqualTo ("/chat/completions " ))
221208 .inScenario ("Chat Memory" )
222209 .whenScenarioStateIs ("Second Call" )
223210 .willReturn (
0 commit comments