Package dev.langchain4j.agent.tool
Class JsonSchemaProperty
java.lang.Object
dev.langchain4j.agent.tool.JsonSchemaProperty
Represents a property in a JSON schema.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final JsonSchemaProperty
A property with key "type" and value "array".static final JsonSchemaProperty
A property with key "type" and value "boolean".static final JsonSchemaProperty
A property with key "type" and value "integer".static final JsonSchemaProperty
A property with key "type" and value "null".static final JsonSchemaProperty
A property with key "type" and value "number".static final JsonSchemaProperty
A property with key "type" and value "object".static final JsonSchemaProperty
A property with key "type" and value "string". -
Constructor Summary
ConstructorDescriptionJsonSchemaProperty
(String key, Object value) Construct a property with key and value. -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonSchemaProperty
description
(String value) Construct a property with key "description" and value.static JsonSchemaProperty
Construct a property with key "enum" and all enum values taken from enumClass.static JsonSchemaProperty
Construct a property with key "enum" and value enumValues.static JsonSchemaProperty
Construct a property with key "enum" and value enumValues.boolean
static JsonSchemaProperty
Construct a property with key and value.int
hashCode()
static JsonSchemaProperty
items
(JsonSchemaProperty type) Wraps the given type in a property with key "items".key()
Get the key.static JsonSchemaProperty
static JsonSchemaProperty
Construct a property with key and value.toString()
static JsonSchemaProperty
Construct 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.
-
objectItems
-