Skip to content

Commit

Permalink
Corrected cell output
Browse files Browse the repository at this point in the history
  • Loading branch information
jgpruitt committed May 10, 2024
1 parent cb2e9dc commit 0b5ecae
Show file tree
Hide file tree
Showing 4 changed files with 849 additions and 56 deletions.
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ Now, you can query for similar items:
vec.search([1.0, 9.0])
```

[[UUID('b8264900-0efb-11ef-8d89-e666703872d0'),
[[UUID('45ecb666-0f15-11ef-8d89-e666703872d0'),
{'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
0.00016793422934946456],
[UUID('b8264784-0efb-11ef-8d89-e666703872d0'),
[UUID('45ecb350-0f15-11ef-8d89-e666703872d0'),
{'animal': 'fox'},
'the brown fox',
array([1. , 1.3], dtype=float32),
Expand All @@ -131,7 +131,7 @@ constrained by a metadata filter.
vec.search([1.0, 9.0], limit=1, filter={"action": "jump"})
```

[[UUID('b8264900-0efb-11ef-8d89-e666703872d0'),
[[UUID('45ecb666-0f15-11ef-8d89-e666703872d0'),
{'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand All @@ -155,7 +155,7 @@ records = vec.search([1.0, 9.0], limit=1, filter={"action": "jump"})
(records[0]["id"],records[0]["metadata"], records[0]["contents"], records[0]["embedding"], records[0]["distance"])
```

(UUID('b8264900-0efb-11ef-8d89-e666703872d0'),
(UUID('45ecb666-0f15-11ef-8d89-e666703872d0'),
{'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand Down Expand Up @@ -218,12 +218,12 @@ The basic query looks like:
vec.search([1.0, 9.0])
```

[[UUID('be710926-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629b54-0f15-11ef-8d89-e666703872d0'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
0.00016793422934946456],
[UUID('be710836-0efb-11ef-8d89-e666703872d0'),
[UUID('4d629a50-0f15-11ef-8d89-e666703872d0'),
{'times': 1, 'action': 'sit', 'animal': 'fox'},
'the brown fox',
array([1. , 1.3], dtype=float32),
Expand All @@ -235,7 +235,7 @@ You could provide a limit for the number of items returned:
vec.search([1.0, 9.0], limit=1)
```

[[UUID('be710926-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629b54-0f15-11ef-8d89-e666703872d0'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand All @@ -260,7 +260,7 @@ unconstrained):
vec.search([1.0, 9.0], limit=1, filter={"action": "sit"})
```

[[UUID('be710836-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629a50-0f15-11ef-8d89-e666703872d0'),
{'times': 1, 'action': 'sit', 'animal': 'fox'},
'the brown fox',
array([1. , 1.3], dtype=float32),
Expand All @@ -273,12 +273,12 @@ returned if it matches any dict:
vec.search([1.0, 9.0], limit=2, filter=[{"action": "jump"}, {"animal": "fox"}])
```

[[UUID('be710926-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629b54-0f15-11ef-8d89-e666703872d0'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
0.00016793422934946456],
[UUID('be710836-0efb-11ef-8d89-e666703872d0'),
[UUID('4d629a50-0f15-11ef-8d89-e666703872d0'),
{'times': 1, 'action': 'sit', 'animal': 'fox'},
'the brown fox',
array([1. , 1.3], dtype=float32),
Expand All @@ -293,7 +293,7 @@ could use greater than and less than conditions on numeric values.
vec.search([1.0, 9.0], limit=2, predicates=client.Predicates("times", ">", 1))
```

[[UUID('be710926-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629b54-0f15-11ef-8d89-e666703872d0'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand All @@ -317,7 +317,7 @@ use the right type. Supported Python types are: `str`, `int`, and
vec.search([1.0, 9.0], limit=2, predicates=client.Predicates("action", "==", "jump"))
```

[[UUID('be710926-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629b54-0f15-11ef-8d89-e666703872d0'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand All @@ -331,7 +331,7 @@ combining using OR semantic). So you can do:
vec.search([1.0, 9.0], limit=2, predicates=client.Predicates("action", "==", "jump") & client.Predicates("times", ">", 1))
```

[[UUID('be710926-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629b54-0f15-11ef-8d89-e666703872d0'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand All @@ -354,7 +354,7 @@ my_predicates = client.Predicates("action", "==", "jump") & (client.Predicates("
vec.search([1.0, 9.0], limit=2, predicates=my_predicates)
```

[[UUID('be710926-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629b54-0f15-11ef-8d89-e666703872d0'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand All @@ -368,7 +368,7 @@ semantics. You can pass in multiple 3-tuples to
vec.search([1.0, 9.0], limit=2, predicates=client.Predicates(("action", "==", "jump"), ("times", ">", 10)))
```

[[UUID('be710926-0efb-11ef-8d89-e666703872d0'),
[[UUID('4d629b54-0f15-11ef-8d89-e666703872d0'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand Down Expand Up @@ -400,7 +400,7 @@ Then, you can filter using the timestamps by specifing a
tpvec.search([1.0, 9.0], limit=4, uuid_time_filter=client.UUIDTimeRange(specific_datetime, specific_datetime+timedelta(days=1)))
```

[[UUID('95899000-ef1d-11e7-80bf-4c3085146144'),
[[UUID('95899000-ef1d-11e7-990e-7d2f7e013038'),
{'times': 1, 'action': 'sit', 'animal': 'fox'},
'the brown fox',
array([1. , 1.3], dtype=float32),
Expand All @@ -416,12 +416,12 @@ unconstrained.
tpvec.search([1.0, 9.0], limit=4, uuid_time_filter=client.UUIDTimeRange(start_date=specific_datetime))
```

[[UUID('0e505000-0def-11e9-9795-29faf97f13af'),
[[UUID('0e505000-0def-11e9-8732-a154fea6fb50'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
0.00016793422934946456],
[UUID('95899000-ef1d-11e7-80bf-4c3085146144'),
[UUID('95899000-ef1d-11e7-990e-7d2f7e013038'),
{'times': 1, 'action': 'sit', 'animal': 'fox'},
'the brown fox',
array([1. , 1.3], dtype=float32),
Expand All @@ -438,7 +438,7 @@ One example:
tpvec.search([1.0, 9.0], limit=4, uuid_time_filter=client.UUIDTimeRange(start_date=specific_datetime, start_inclusive=False))
```

[[UUID('0e505000-0def-11e9-9795-29faf97f13af'),
[[UUID('0e505000-0def-11e9-8732-a154fea6fb50'),
{'times': 100, 'action': 'jump', 'animal': 'fox'},
'jumped over the',
array([ 1. , 10.8], dtype=float32),
Expand All @@ -460,7 +460,7 @@ filters and `__uuid_timestamp` for predicates. Some examples below:
tpvec.search([1.0, 9.0], limit=4, filter={ "__start_date": specific_datetime, "__end_date": specific_datetime+timedelta(days=1)})
```

[[UUID('95899000-ef1d-11e7-80bf-4c3085146144'),
[[UUID('95899000-ef1d-11e7-990e-7d2f7e013038'),
{'times': 1, 'action': 'sit', 'animal': 'fox'},
'the brown fox',
array([1. , 1.3], dtype=float32),
Expand All @@ -471,7 +471,7 @@ tpvec.search([1.0, 9.0], limit=4,
predicates=client.Predicates("__uuid_timestamp", ">", specific_datetime) & client.Predicates("__uuid_timestamp", "<", specific_datetime+timedelta(days=1)))
```

[[UUID('95899000-ef1d-11e7-80bf-4c3085146144'),
[[UUID('95899000-ef1d-11e7-990e-7d2f7e013038'),
{'times': 1, 'action': 'sit', 'animal': 'fox'},
'the brown fox',
array([1. , 1.3], dtype=float32),
Expand Down Expand Up @@ -953,8 +953,8 @@ res = vector_store.similarity_search_with_score("Blogs about cats")
res
```

[(Document(page_content='Author Matvey Arye, title: First Post, contents:some super interesting content about cats.', metadata={'id': '4a784000-4bc4-11eb-b675-16ace8ff7869', 'author': 'Matvey Arye', 'blog_id': 1, 'category': 'AI', 'published_time': '2021-01-01T00:00:00+00:00'}),
0.12654017574418686)]
[(Document(page_content='Author Matvey Arye, title: First Post, contents:some super interesting content about cats.', metadata={'id': '4a784000-4bc4-11eb-979c-e8748f6439f2', 'author': 'Matvey Arye', 'blog_id': 1, 'category': 'AI', 'published_time': '2021-01-01T00:00:00+00:00'}),
0.12657619616729976)]

## Development

Expand Down
Loading

0 comments on commit 0b5ecae

Please sign in to comment.