Skip to content

Commit

Permalink
fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LangChain4j committed Dec 2, 2024
1 parent 4fb7f47 commit 0e30adf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void testCustomizableApi(ChatCompletionModel model) throws Exception {
void testTools(ChatCompletionModel model) throws Exception {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down Expand Up @@ -158,7 +158,7 @@ void testTools(ChatCompletionModel model) throws Exception {
void testFunctions(ChatCompletionModel model) throws Exception {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down Expand Up @@ -214,7 +214,7 @@ void testFunctions(ChatCompletionModel model) throws Exception {
void testToolChoice(ChatCompletionModel model) throws Exception {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down Expand Up @@ -276,7 +276,7 @@ void testToolChoice(ChatCompletionModel model) throws Exception {
void testFunctionChoice(ChatCompletionModel model) throws Exception {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void testCustomizableApi(ChatCompletionModel model) throws Exception {
void testTools(ChatCompletionModel model) throws Exception {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand All @@ -167,7 +167,7 @@ void testTools(ChatCompletionModel model) throws Exception {
client.chatCompletion(request)
.onPartialResponse(partialResponse -> {
Delta delta = partialResponse.choices().get(0).delta();
assertThat(delta.content()).isNull();
assertThat(delta.content()).isNullOrEmpty();
assertThat(delta.functionCall()).isNull();

if (delta.toolCalls() != null) {
Expand Down Expand Up @@ -265,7 +265,7 @@ void testTools(ChatCompletionModel model) throws Exception {
void testFunctions(ChatCompletionModel model) throws Exception {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand All @@ -281,7 +281,7 @@ void testFunctions(ChatCompletionModel model) throws Exception {
client.chatCompletion(request)
.onPartialResponse(partialResponse -> {
Delta delta = partialResponse.choices().get(0).delta();
assertThat(delta.content()).isNull();
assertThat(delta.content()).isNullOrEmpty();
assertThat(delta.toolCalls()).isNull();

if (delta.functionCall() != null) {
Expand Down Expand Up @@ -359,7 +359,7 @@ void testFunctions(ChatCompletionModel model) throws Exception {
void testToolChoice(ChatCompletionModel model) throws Exception {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down Expand Up @@ -474,7 +474,7 @@ void testToolChoice(ChatCompletionModel model) throws Exception {
void testFunctionChoice(ChatCompletionModel model) throws Exception {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/dev/ai4j/openai4j/chat/ChatCompletionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void testCustomizableApi(ChatCompletionModel model) {
void testTools(ChatCompletionModel model) {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down Expand Up @@ -308,7 +308,7 @@ void testToolWithoutParameters() {
void testFunctions(ChatCompletionModel model) {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down Expand Up @@ -357,7 +357,7 @@ void testFunctions(ChatCompletionModel model) {
void testToolChoice(ChatCompletionModel model) {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down Expand Up @@ -412,7 +412,7 @@ void testToolChoice(ChatCompletionModel model) {
void testFunctionChoice(ChatCompletionModel model) {

// given
UserMessage userMessage = UserMessage.from("What is the weather in Boston?");
UserMessage userMessage = UserMessage.from("What is the weather in Boston in Celsius?");

ChatCompletionRequest request = ChatCompletionRequest.builder()
.model(model)
Expand Down

0 comments on commit 0e30adf

Please sign in to comment.