Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbanda committed Nov 14, 2023
1 parent 4a5a702 commit 1526674
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ class MessageJsonSpec extends Matchers with AnyWordSpecLike {
arguments = "{\n \"location\": \"Boston, MA\"\n}"
)

val message = AssistantToolMessage(tool_calls = Seq(("get_current_weather_1", toolCallSpec)))
val message =
AssistantToolMessage(tool_calls = Seq(("get_current_weather_1", toolCallSpec)))
val json = toJson(message)
val jsonKeys = json.keySet

Expand All @@ -245,13 +246,18 @@ class MessageJsonSpec extends Matchers with AnyWordSpecLike {

json("role") shouldBe JsString("assistant")
json("tool_calls").asOpt[JsArray] shouldBe defined
json("tool_calls") shouldBe JsArray(Seq(
Json.obj(
"id" -> JsString(toolId),
"type" -> JsString("function"),
"function" -> Json.obj("name" -> JsString(toolCallSpec.name), "arguments" -> JsString(toolCallSpec.arguments))
json("tool_calls") shouldBe JsArray(
Seq(
Json.obj(
"id" -> JsString(toolId),
"type" -> JsString("function"),
"function" -> Json.obj(
"name" -> JsString(toolCallSpec.name),
"arguments" -> JsString(toolCallSpec.arguments)
)
)
)
))
)
}
}

Expand Down Expand Up @@ -310,7 +316,10 @@ class MessageJsonSpec extends Matchers with AnyWordSpecLike {

json("role") shouldBe JsString("assistant")
json("function_call").asOpt[JsObject] shouldBe defined
json("function_call") shouldBe Json.obj("name" -> JsString(functionCallSpec.name), "arguments" -> JsString(functionCallSpec.arguments))
json("function_call") shouldBe Json.obj(
"name" -> JsString(functionCallSpec.name),
"arguments" -> JsString(functionCallSpec.arguments)
)
}
}

Expand Down

0 comments on commit 1526674

Please sign in to comment.