Spaces:
Running
Running
Update custom_utils.py
Browse files- custom_utils.py +2 -2
custom_utils.py
CHANGED
@@ -100,7 +100,7 @@ def process_records(data_frame):
|
|
100 |
print("Validation error:", e)
|
101 |
return []
|
102 |
|
103 |
-
def vector_search(openai_api_key, user_query, db, collection, additional_stages=[], vector_index="
|
104 |
"""
|
105 |
Perform a vector search in the MongoDB collection based on the user query.
|
106 |
|
@@ -130,12 +130,12 @@ def vector_search(openai_api_key, user_query, db, collection, additional_stages=
|
|
130 |
"limit": 20, # return top 20 matches
|
131 |
"filter": {
|
132 |
"$and": [
|
|
|
133 |
{"bedrooms": {"$eq": 1}}
|
134 |
]
|
135 |
},
|
136 |
}
|
137 |
}
|
138 |
-
# {"accommodates": {"$eq": 2}},
|
139 |
|
140 |
# Define the aggregate pipeline with the vector search stage and additional stages
|
141 |
pipeline = [vector_search_stage] + additional_stages
|
|
|
100 |
print("Validation error:", e)
|
101 |
return []
|
102 |
|
103 |
+
def vector_search(openai_api_key, user_query, db, collection, additional_stages=[], vector_index="vector_index"):
|
104 |
"""
|
105 |
Perform a vector search in the MongoDB collection based on the user query.
|
106 |
|
|
|
130 |
"limit": 20, # return top 20 matches
|
131 |
"filter": {
|
132 |
"$and": [
|
133 |
+
{"accommodates": {"$eq": 2}},
|
134 |
{"bedrooms": {"$eq": 1}}
|
135 |
]
|
136 |
},
|
137 |
}
|
138 |
}
|
|
|
139 |
|
140 |
# Define the aggregate pipeline with the vector search stage and additional stages
|
141 |
pipeline = [vector_search_stage] + additional_stages
|