Browse Source
AI rule node: correct method name for schema adapter
pull/13371/head
Dmytro Skarzhynets
11 months ago
No known key found for this signature in database
GPG Key ID: 2B51652F224037DF
2 changed files with
2 additions and
2 deletions
-
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/ai/Langchain4jJsonSchemaAdapter.java
-
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/ai/TbAiNode.java
|
|
|
@ -46,7 +46,7 @@ final class Langchain4jJsonSchemaAdapter { |
|
|
|
* @param rootSchemaNode a valid JSON Schema as a Jackson {@link ObjectNode} |
|
|
|
* @return the corresponding Langchain4j {@link JsonSchema} |
|
|
|
*/ |
|
|
|
public static JsonSchema fromJsonNode(ObjectNode rootSchemaNode) { |
|
|
|
public static JsonSchema fromObjectNode(ObjectNode rootSchemaNode) { |
|
|
|
return JsonSchema.builder() |
|
|
|
.name(rootSchemaNode.get("title").textValue()) |
|
|
|
.rootElement(parse(rootSchemaNode)) |
|
|
|
|
|
|
|
@ -84,7 +84,7 @@ public final class TbAiNode extends TbAbstractExternalNode implements TbNode { |
|
|
|
if (config.getResponseFormatType() == ResponseFormatType.JSON) { |
|
|
|
responseFormat = ResponseFormat.builder() |
|
|
|
.type(config.getResponseFormatType()) |
|
|
|
.jsonSchema(config.getJsonSchema() != null ? Langchain4jJsonSchemaAdapter.fromJsonNode(config.getJsonSchema()) : null) |
|
|
|
.jsonSchema(config.getJsonSchema() != null ? Langchain4jJsonSchemaAdapter.fromObjectNode(config.getJsonSchema()) : null) |
|
|
|
.build(); |
|
|
|
} |
|
|
|
|
|
|
|
|