Package dev.langchain4j.agent.tool
Class JsonSchemaProperty
java.lang.Object
dev.langchain4j.agent.tool.JsonSchemaProperty
Represents a property in a JSON schema.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonSchemaPropertyA property with key "type" and value "array".static final JsonSchemaPropertyA property with key "type" and value "boolean".static final JsonSchemaPropertyA property with key "type" and value "integer".static final JsonSchemaPropertyA property with key "type" and value "null".static final JsonSchemaPropertyA property with key "type" and value "number".static final JsonSchemaPropertyA property with key "type" and value "object".static final JsonSchemaPropertyA property with key "type" and value "string". -
Constructor Summary
ConstructorsConstructorDescriptionJsonSchemaProperty(String key, Object value) Construct a property with key and value. -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonSchemaPropertydescription(String value) Construct a property with key "description" and value.static JsonSchemaPropertyConstruct a property with key "enum" and all enum values taken from enumClass.static JsonSchemaPropertyConstruct a property with key "enum" and value enumValues.static JsonSchemaPropertyConstruct a property with key "enum" and value enumValues.booleanstatic JsonSchemaPropertyConstruct a property with key and value.inthashCode()static JsonSchemaPropertyitems(JsonSchemaProperty type) Wraps the given type in a property with key "items".key()Get the key.static JsonSchemaPropertyConstruct a property with key and value.toString()static JsonSchemaPropertyConstruct a property with key "type" and value.value()Get the value.
-
Field Details
-
STRING
A property with key "type" and value "string". -
INTEGER
A property with key "type" and value "integer". -
NUMBER
A property with key "type" and value "number". -
OBJECT
A property with key "type" and value "object". -
ARRAY
A property with key "type" and value "array". -
BOOLEAN
A property with key "type" and value "boolean". -
NULL
A property with key "type" and value "null".
-
-
Constructor Details
-
JsonSchemaProperty
Construct a property with key and value.- Parameters:
key- the key.value- the value.
-
-
Method Details
-
key
Get the key.- Returns:
- the key.
-
value
Get the value.- Returns:
- the value.
-
equals
-
hashCode
public int hashCode() -
toString
-
from
Construct a property with key and value.Equivalent to
new JsonSchemaProperty(key, value).- Parameters:
key- the key.value- the value.- Returns:
- a property with key and value.
-
property
Construct a property with key and value.Equivalent to
new JsonSchemaProperty(key, value).- Parameters:
key- the key.value- the value.- Returns:
- a property with key and value.
-
type
Construct a property with key "type" and value.Equivalent to
new JsonSchemaProperty("type", value).- Parameters:
value- the value.- Returns:
- a property with key and value.
-
description
Construct a property with key "description" and value.Equivalent to
new JsonSchemaProperty("description", value).- Parameters:
value- the value.- Returns:
- a property with key and value.
-
enums
Construct a property with key "enum" and value enumValues.- Parameters:
enumValues- enum values as strings. For example:enums("CELSIUS", "FAHRENHEIT")- Returns:
- a property with key "enum" and value enumValues
-
enums
Construct a property with key "enum" and value enumValues.Verifies that each value is a java class.
- Parameters:
enumValues- enum values. For example:enums(TemperatureUnit.CELSIUS, TemperatureUnit.FAHRENHEIT)- Returns:
- a property with key "enum" and value enumValues
-
enums
Construct a property with key "enum" and all enum values taken from enumClass.- Parameters:
enumClass- enum class. For example:enums(TemperatureUnit.class)- Returns:
- a property with key "enum" and values taken from enumClass
-
items
Wraps the given type in a property with key "items".- Parameters:
type- the type- Returns:
- a property with key "items" and value type.
-