Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ public static String generateForMethodInput(Method method, SchemaOption... schem
required.add(parameterName);
}
ObjectNode parameterNode = SUBTYPE_SCHEMA_GENERATOR.generateSchema(parameterType);
// Remove OpenAPI format as some LLMs (like Mistral) don't handle them.
parameterNode.remove("format");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the parameterNode doesn't contain "format", this operation just returns null and hence we don't need explicit check on the existence of this property.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to find out what other cases the OpenAPI format can be used in the context of ChatClient request.

String parameterDescription = getMethodParameterDescription(method, i);
if (StringUtils.hasText(parameterDescription)) {
parameterNode.put("description", parameterDescription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ void generateSchemaForMethodWithSimpleParameters() throws Exception {
"type": "string"
},
"age": {
"type": "integer",
"format": "int32"
"type": "integer"
}
},
"required": [
Expand Down Expand Up @@ -265,8 +264,7 @@ void generateSchemaForMethodWithUpperCaseTypes() throws Exception {
"type": "STRING"
},
"age": {
"type": "INTEGER",
"format": "int32"
"type": "INTEGER"
}
},
"required": [
Expand Down Expand Up @@ -348,16 +346,13 @@ void generateSchemaForMethodWithTimeParameters() throws Exception {
"type": "object",
"properties": {
"duration": {
"type": "string",
"format": "duration"
"type": "string"
},
"localDateTime": {
"type": "string",
"format": "date-time"
"type": "string"
},
"instant": {
"type": "string",
"format": "date-time"
"type": "string"
}
},
"required": [
Expand Down Expand Up @@ -387,8 +382,7 @@ void generateSchemaForMethodWithToolContext() throws Exception {
"type": "string"
},
"expectedDelivery": {
"type": "string",
"format": "date-time"
"type": "string"
}
},
"required": [
Expand Down