| 69 | |
| 70 | |
| 71 | def test_search(vec_db): |
| 72 | id = str(uuid.uuid4()) |
| 73 | mock_response = type( |
| 74 | "QueryResponse", |
| 75 | (object,), |
| 76 | { |
| 77 | "points": [ |
| 78 | type( |
| 79 | "obj", |
| 80 | (object,), |
| 81 | { |
| 82 | "id": id, |
| 83 | "vector": [0.1, 0.2, 0.3], |
| 84 | "payload": {"tag": "search"}, |
| 85 | "score": 0.9, |
| 86 | }, |
| 87 | ) |
| 88 | ] |
| 89 | }, |
| 90 | )() |
| 91 | vec_db.client.query_points.return_value = mock_response |
| 92 | results = vec_db.search([0.1, 0.2, 0.3], top_k=1) |
| 93 | assert len(results) == 1 |
| 94 | assert isinstance(results[0], VecDBItem) |
| 95 | assert results[0].score == 0.9 |
| 96 | |
| 97 | |
| 98 | def test_update_vector(vec_db): |