diff --git a/qdrant_client/embed/_inspection_cache.py b/qdrant_client/embed/_inspection_cache.py index 8083d177d..c7c6f2f67 100644 --- a/qdrant_client/embed/_inspection_cache.py +++ b/qdrant_client/embed/_inspection_cache.py @@ -220,6 +220,21 @@ "StartReshardingOperation": [], "StrictModeMultivector": [], "StrictModeSparse": [], + "AbsExpression": [], + "DivExpression": [], + "DivParams": [], + "ExpExpression": [], + "FormulaQuery": [], + "GeoDistance": [], + "GeoDistanceParams": [], + "LnExpression": [], + "Log10Expression": [], + "MultExpression": [], + "NegExpression": [], + "PowExpression": [], + "PowParams": [], + "SqrtExpression": [], + "SumExpression": [], } DEFS = { "AbortShardTransfer": { @@ -448,7 +463,7 @@ "geo_bounding_box": { "anyOf": [{"$ref": "#/$defs/GeoBoundingBox"}, {"type": "null"}], "default": None, - "description": "Check if points geo location lies in a given area", + "description": "Check if points geolocation lies in a given area", }, "geo_radius": { "anyOf": [{"$ref": "#/$defs/GeoRadius"}, {"type": "null"}], @@ -465,6 +480,18 @@ "default": None, "description": "Check number of values of the field", }, + "is_empty": { + "anyOf": [{"type": "boolean"}, {"type": "null"}], + "default": None, + "description": "Check that the field is empty, alternative syntax for `is_empty: \\"field_name\\"`", + "title": "Is Empty", + }, + "is_null": { + "anyOf": [{"type": "boolean"}, {"type": "null"}], + "default": None, + "description": "Check that the field is null, alternative syntax for `is_null: \\"field_name\\"`", + "title": "Is Null", + }, }, "required": ["key"], "title": "FieldCondition", @@ -482,6 +509,7 @@ {"$ref": "#/$defs/IsEmptyCondition"}, {"$ref": "#/$defs/IsNullCondition"}, {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, {"$ref": "#/$defs/NestedCondition"}, {"$ref": "#/$defs/Filter"}, ] @@ -492,6 +520,7 @@ {"$ref": "#/$defs/IsEmptyCondition"}, {"$ref": "#/$defs/IsNullCondition"}, {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, {"$ref": "#/$defs/NestedCondition"}, {"$ref": "#/$defs/Filter"}, {"type": "null"}, @@ -514,6 +543,7 @@ {"$ref": "#/$defs/IsEmptyCondition"}, {"$ref": "#/$defs/IsNullCondition"}, {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, {"$ref": "#/$defs/NestedCondition"}, {"$ref": "#/$defs/Filter"}, ] @@ -524,6 +554,7 @@ {"$ref": "#/$defs/IsEmptyCondition"}, {"$ref": "#/$defs/IsNullCondition"}, {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, {"$ref": "#/$defs/NestedCondition"}, {"$ref": "#/$defs/Filter"}, {"type": "null"}, @@ -541,6 +572,7 @@ {"$ref": "#/$defs/IsEmptyCondition"}, {"$ref": "#/$defs/IsNullCondition"}, {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, {"$ref": "#/$defs/NestedCondition"}, {"$ref": "#/$defs/Filter"}, ] @@ -551,6 +583,7 @@ {"$ref": "#/$defs/IsEmptyCondition"}, {"$ref": "#/$defs/IsNullCondition"}, {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, {"$ref": "#/$defs/NestedCondition"}, {"$ref": "#/$defs/Filter"}, {"type": "null"}, @@ -591,11 +624,11 @@ "description": "Geo filter request Matches coordinates inside the rectangle, described by coordinates of lop-left and bottom-right edges", "properties": { "top_left": { - "allOf": [{"$ref": "#/$defs/GeoPoint"}], + "$ref": "#/$defs/GeoPoint", "description": "Geo filter request Matches coordinates inside the rectangle, described by coordinates of lop-left and bottom-right edges", }, "bottom_right": { - "allOf": [{"$ref": "#/$defs/GeoPoint"}], + "$ref": "#/$defs/GeoPoint", "description": "Geo filter request Matches coordinates inside the rectangle, described by coordinates of lop-left and bottom-right edges", }, }, @@ -634,7 +667,7 @@ "description": "Geo filter request Matches coordinates inside the polygon, defined by `exterior` and `interiors`", "properties": { "exterior": { - "allOf": [{"$ref": "#/$defs/GeoLineString"}], + "$ref": "#/$defs/GeoLineString", "description": "Geo filter request Matches coordinates inside the polygon, defined by `exterior` and `interiors`", }, "interiors": { @@ -656,7 +689,7 @@ "description": "Geo filter request Matches coordinates inside the circle of `radius` and center with coordinates `center`", "properties": { "center": { - "allOf": [{"$ref": "#/$defs/GeoPoint"}], + "$ref": "#/$defs/GeoPoint", "description": "Geo filter request Matches coordinates inside the circle of `radius` and center with coordinates `center`", }, "radius": { @@ -689,7 +722,7 @@ "description": "Select points with empty payload for a specified field", "properties": { "is_empty": { - "allOf": [{"$ref": "#/$defs/PayloadField"}], + "$ref": "#/$defs/PayloadField", "description": "Select points with empty payload for a specified field", } }, @@ -702,7 +735,7 @@ "description": "Select points with null payload for a specified field", "properties": { "is_null": { - "allOf": [{"$ref": "#/$defs/PayloadField"}], + "$ref": "#/$defs/PayloadField", "description": "Select points with null payload for a specified field", } }, @@ -783,6 +816,7 @@ {"$ref": "#/$defs/IsEmptyCondition"}, {"$ref": "#/$defs/IsNullCondition"}, {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, {"$ref": "#/$defs/NestedCondition"}, {"$ref": "#/$defs/Filter"}, ] @@ -806,7 +840,7 @@ "type": "string", }, "filter": { - "allOf": [{"$ref": "#/$defs/Filter"}], + "$ref": "#/$defs/Filter", "description": "Select points with payload for a specified nested field", }, }, @@ -816,7 +850,7 @@ }, "NestedCondition": { "additionalProperties": False, - "properties": {"nested": {"allOf": [{"$ref": "#/$defs/Nested"}], "description": ""}}, + "properties": {"nested": {"$ref": "#/$defs/Nested", "description": ""}}, "required": ["nested"], "title": "NestedCondition", "type": "object", @@ -3093,6 +3127,459 @@ "title": "StartResharding", "type": "object", }, + "AbsExpression": { + "additionalProperties": False, + "properties": { + "abs": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Abs", + } + }, + "required": ["abs"], + "title": "AbsExpression", + "type": "object", + }, + "DivExpression": { + "additionalProperties": False, + "properties": {"div": {"$ref": "#/$defs/DivParams", "description": ""}}, + "required": ["div"], + "title": "DivExpression", + "type": "object", + }, + "DivParams": { + "additionalProperties": False, + "properties": { + "left": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Left", + }, + "right": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Right", + }, + "by_zero_default": { + "anyOf": [{"type": "number"}, {"type": "null"}], + "default": None, + "description": "", + "title": "By Zero Default", + }, + }, + "required": ["left", "right"], + "title": "DivParams", + "type": "object", + }, + "ExpExpression": { + "additionalProperties": False, + "properties": { + "exp": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Exp", + } + }, + "required": ["exp"], + "title": "ExpExpression", + "type": "object", + }, + "GeoDistance": { + "additionalProperties": False, + "properties": {"geo_distance": {"$ref": "#/$defs/GeoDistanceParams", "description": ""}}, + "required": ["geo_distance"], + "title": "GeoDistance", + "type": "object", + }, + "GeoDistanceParams": { + "additionalProperties": False, + "properties": { + "origin": {"$ref": "#/$defs/GeoPoint", "description": ""}, + "to": { + "description": "Payload field with the destination geo point", + "title": "To", + "type": "string", + }, + }, + "required": ["origin", "to"], + "title": "GeoDistanceParams", + "type": "object", + }, + "HasVectorCondition": { + "additionalProperties": False, + "description": "Filter points which have specific vector assigned", + "properties": { + "has_vector": { + "description": "Filter points which have specific vector assigned", + "title": "Has Vector", + "type": "string", + } + }, + "required": ["has_vector"], + "title": "HasVectorCondition", + "type": "object", + }, + "LnExpression": { + "additionalProperties": False, + "properties": { + "ln": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Ln", + } + }, + "required": ["ln"], + "title": "LnExpression", + "type": "object", + }, + "Log10Expression": { + "additionalProperties": False, + "properties": { + "log10": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Log10", + } + }, + "required": ["log10"], + "title": "Log10Expression", + "type": "object", + }, + "MultExpression": { + "additionalProperties": False, + "properties": { + "mult": { + "description": "", + "items": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ] + }, + "title": "Mult", + "type": "array", + } + }, + "required": ["mult"], + "title": "MultExpression", + "type": "object", + }, + "NegExpression": { + "additionalProperties": False, + "properties": { + "neg": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Neg", + } + }, + "required": ["neg"], + "title": "NegExpression", + "type": "object", + }, + "PowExpression": { + "additionalProperties": False, + "properties": {"pow": {"$ref": "#/$defs/PowParams", "description": ""}}, + "required": ["pow"], + "title": "PowExpression", + "type": "object", + }, + "PowParams": { + "additionalProperties": False, + "properties": { + "base": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Base", + }, + "exponent": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Exponent", + }, + }, + "required": ["base", "exponent"], + "title": "PowParams", + "type": "object", + }, + "SqrtExpression": { + "additionalProperties": False, + "properties": { + "sqrt": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ], + "description": "", + "title": "Sqrt", + } + }, + "required": ["sqrt"], + "title": "SqrtExpression", + "type": "object", + }, + "SumExpression": { + "additionalProperties": False, + "properties": { + "sum": { + "description": "", + "items": { + "anyOf": [ + {"type": "number"}, + {"type": "string"}, + {"$ref": "#/$defs/FieldCondition"}, + {"$ref": "#/$defs/IsEmptyCondition"}, + {"$ref": "#/$defs/IsNullCondition"}, + {"$ref": "#/$defs/HasIdCondition"}, + {"$ref": "#/$defs/HasVectorCondition"}, + {"$ref": "#/$defs/NestedCondition"}, + {"$ref": "#/$defs/Filter"}, + {"$ref": "#/$defs/MultExpression"}, + {"$ref": "#/$defs/SumExpression"}, + {"$ref": "#/$defs/NegExpression"}, + {"$ref": "#/$defs/AbsExpression"}, + {"$ref": "#/$defs/DivExpression"}, + {"$ref": "#/$defs/SqrtExpression"}, + {"$ref": "#/$defs/PowExpression"}, + {"$ref": "#/$defs/ExpExpression"}, + {"$ref": "#/$defs/Log10Expression"}, + {"$ref": "#/$defs/LnExpression"}, + {"$ref": "#/$defs/GeoDistance"}, + ] + }, + "title": "Sum", + "type": "array", + } + }, + "required": ["sum"], + "title": "SumExpression", + "type": "object", + }, } RECURSIVE_REFS = ["Filter", "MinShould", "Nested", "NestedCondition", "Prefetch"] INCLUDED_RECURSIVE_REFS = ["Prefetch"] diff --git a/qdrant_client/embed/schema_parser.py b/qdrant_client/embed/schema_parser.py index 534c417df..9a34397dd 100644 --- a/qdrant_client/embed/schema_parser.py +++ b/qdrant_client/embed/schema_parser.py @@ -121,7 +121,7 @@ def _replace_refs( schemes[k] = self._replace_refs(schema=v, parent=k, seen_refs=copy(seen_refs)) else: schemes[k] = self._replace_refs( - schema=v, parent=parent, seen_refs=copy(seen_refs) + schema=v, parent=k, seen_refs=copy(seen_refs) ) return schemes elif isinstance(schema, list):