WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit db64ef1

Browse files
danmichaeljonesDan Jones
andauthored
Update response model with sort_property (#75)
Co-authored-by: Dan Jones <[email protected]>
1 parent 82c0804 commit db64ef1

File tree

6 files changed

+28
-1
lines changed

6 files changed

+28
-1
lines changed

test/query_agent/test_query_model.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,18 @@ def json(self) -> dict:
561561
"value": 0.0,
562562
},
563563
"collection": "test_collection",
564-
}
564+
"sort_property": None,
565+
},
566+
{
567+
"query": None,
568+
"filters": None,
569+
"collection": "test_collection",
570+
"sort_property": {
571+
"property_name": "test_property",
572+
"order": "ascending",
573+
"tie_break": None,
574+
},
575+
},
565576
],
566577
"usage": {
567578
"model_units": 1,

test/test_imports.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def test_class_exports():
8080
QueryResult,
8181
QueryResultWithCollection,
8282
QueryResultWithCollectionNormalized,
83+
QuerySort,
8384
QueryWithCollection,
8485
SearchModeResponseBase,
8586
Source,
@@ -142,6 +143,7 @@ def test_class_exports():
142143
QueryAgentResponse,
143144
QueryResult,
144145
QueryResultWithCollection,
146+
QuerySort,
145147
QueryWithCollection,
146148
SearchModeResponseBase,
147149
Source,
@@ -222,6 +224,7 @@ def test_class_exports():
222224
"FilterAndOr",
223225
"QueryResultWithCollectionNormalized",
224226
"AggregationResultWithCollectionNormalized",
227+
"QuerySort",
225228
]
226229

227230
assert hasattr(

weaviate_agents/classes/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
QueryResult,
3838
QueryResultWithCollection,
3939
QueryResultWithCollectionNormalized,
40+
QuerySort,
4041
QueryWithCollection,
4142
SearchModeResponseBase,
4243
Source,
@@ -110,4 +111,5 @@
110111
"FilterAndOr",
111112
"QueryResultWithCollectionNormalized",
112113
"AggregationResultWithCollectionNormalized",
114+
"QuerySort",
113115
]

weaviate_agents/classes/query.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
QueryResult,
2929
QueryResultWithCollection,
3030
QueryResultWithCollectionNormalized,
31+
QuerySort,
3132
QueryWithCollection,
3233
SearchModeResponseBase,
3334
Source,
@@ -82,4 +83,5 @@
8283
"FilterAndOr",
8384
"QueryResultWithCollectionNormalized",
8485
"AggregationResultWithCollectionNormalized",
86+
"QuerySort",
8587
]

weaviate_agents/query/classes/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
QueryResult,
3030
QueryResultWithCollection,
3131
QueryResultWithCollectionNormalized,
32+
QuerySort,
3233
QueryWithCollection,
3334
SearchModeResponseBase,
3435
Source,
@@ -82,4 +83,5 @@
8283
"FilterAndOr",
8384
"QueryResultWithCollectionNormalized",
8485
"AggregationResultWithCollectionNormalized",
86+
"QuerySort",
8587
]

weaviate_agents/query/classes/response.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,17 @@ class FilterAndOr(BaseModel):
391391
filters: list[Union[PropertyFilter, FilterAndOr]]
392392

393393

394+
class QuerySort(BaseModel):
395+
property_name: str
396+
order: Literal["ascending", "descending"]
397+
tie_break: Union[QuerySort, None]
398+
399+
394400
class QueryResultWithCollectionNormalized(BaseModel):
395401
query: Union[str, None]
396402
filters: Union[PropertyFilter, FilterAndOr, None]
397403
collection: str
404+
sort_property: Union[QuerySort, None] = None
398405

399406

400407
class AggregationResultWithCollectionNormalized(BaseModel):

0 commit comments

Comments
 (0)