Merge branch 'main' of https://github.com/jina-ai/vectordb into feat-push

This commit is contained in:
Joan Fontanals Martinez 2023-07-25 04:47:40 +02:00
commit e80f89a85d
5 changed files with 39 additions and 15 deletions

View File

@ -13,6 +13,7 @@
<a name=release-note-0-0-1></a>
## Release Note (`0.0.1`)
@ -256,3 +257,26 @@
- [[```0357cfea```](https://github.com/jina-ai/jina/commit/0357cfead576b237675f1d1f38360a391deb9a3a)] __-__ fix docarray version in deploy (#49) (*Joan Fontanals*)
- [[```44856718```](https://github.com/jina-ai/jina/commit/44856718e7ce838cfd7e02f15f82c0d90b815694)] __-__ __version__: the next version will be 0.0.16 (*Jina Dev Bot*)
<a name=release-note-0-0-17></a>
## Release Note (`0.0.17`)
> Release time: 2023-07-25 02:37:14
🙇 We'd like to thank all contributors for this new release! In particular,
Joan Fontanals, Jina Dev Bot, 🙇
### 🐞 Bug fixes
- [[```a48f341c```](https://github.com/jina-ai/jina/commit/a48f341c8f5fc13ae70144fca9f73ec6de1764d0)] __-__ fix applying serve and deploy on instance (#53) (*Joan Fontanals*)
### 🏁 Unit Test and CICD
- [[```e0c9921c```](https://github.com/jina-ai/jina/commit/e0c9921c3b720d799bf6f99582a6d2eeb5c1ffee)] __-__ optout telemetry in test (#50) (*Joan Fontanals*)
### 🍹 Other Improvements
- [[```be1f72da```](https://github.com/jina-ai/jina/commit/be1f72da50c06982ed9abcedcb5db75dc9faf32f)] __-__ __version__: the next version will be 0.0.17 (*Jina Dev Bot*)

View File

@ -30,7 +30,7 @@ def docs_to_index():
def test_hnswlib_vectordb_batch(docs_to_index, replicas, shards, protocol, tmpdir):
query = docs_to_index[:10]
port = random_port()
with HNSWVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, protocol=protocol, port=port,
with HNSWVectorDB[MyDoc](workspace=str(tmpdir)).serve(workspace=str(tmpdir), replicas=replicas, shards=shards, protocol=protocol, port=port,
uses_with={'ef': 5000}, timeout_ready=10000) as db:
db.index(inputs=docs_to_index)
if replicas > 1:
@ -72,7 +72,7 @@ def test_hnswlib_vectordb_delete(docs_to_index, replicas, shards, protocol, tmpd
query = docs_to_index[0]
port = random_port()
delete = MyDoc(id=query.id, text='', embedding=np.random.rand(128))
with HNSWVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, protocol=protocol, port=port,
with HNSWVectorDB[MyDoc](workspace=str(tmpdir)).serve(workspace=str(tmpdir), replicas=replicas, shards=shards, protocol=protocol, port=port,
uses_with={'ef': 5000}, timeout_ready=10000) as db:
db.index(inputs=docs_to_index)
if replicas > 1:
@ -102,7 +102,7 @@ def test_hnswlib_vectordb_udpate_text(docs_to_index, replicas, shards, protocol,
query = docs_to_index[0]
port = random_port()
update = MyDoc(id=query.id, text=query.text + '_changed', embedding=query.embedding)
with HNSWVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, protocol=protocol, port=port,
with HNSWVectorDB[MyDoc]().serve(workspace=str(tmpdir), replicas=replicas, shards=shards, protocol=protocol, port=port,
uses_with={'ef': 5000}, timeout_ready=10000) as db:
db.index(inputs=docs_to_index)
if replicas > 1:
@ -144,7 +144,7 @@ def test_hnswlib_vectordb_restore(docs_to_index, replicas, shards, protocol, tmp
assert res.text == res.matches[0].text
assert res.scores[0] < 0.001 # some precision issues, should be 0.0
with HNSWVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
with HNSWVectorDB[MyDoc]().serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
protocol=protocol, uses_with={'ef': 5000}, timeout_ready=10000) as new_db:
time.sleep(2)
resp = new_db.search(docs=query)

View File

@ -30,7 +30,7 @@ def docs_to_index():
def test_inmemory_vectordb_batch(docs_to_index, replicas, shards, protocol, tmpdir):
query = docs_to_index[:10]
port = random_port()
with InMemoryExactNNVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
with InMemoryExactNNVectorDB[MyDoc](workspace=str(tmpdir)).serve(replicas=replicas, shards=shards, port=port,
protocol=protocol, timeout_ready=10000) as db:
db.index(inputs=docs_to_index)
if replicas > 1:
@ -52,7 +52,7 @@ def test_inmemory_vectordb_batch(docs_to_index, replicas, shards, protocol, tmpd
def test_inmemory_vectordb_single_query(docs_to_index, limit, replicas, shards, protocol, tmpdir):
query = docs_to_index[100]
port = random_port()
with InMemoryExactNNVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
with InMemoryExactNNVectorDB[MyDoc](workspace=str(tmpdir)).serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
protocol=protocol, timeout_ready=10000) as db:
db.index(inputs=docs_to_index)
if replicas > 1:
@ -72,7 +72,7 @@ def test_inmemory_vectordb_delete(docs_to_index, replicas, shards, protocol, tmp
query = docs_to_index[0]
port = random_port()
delete = MyDoc(id=query.id, text='', embedding=np.random.rand(128))
with InMemoryExactNNVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
with InMemoryExactNNVectorDB[MyDoc]().serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
protocol=protocol, timeout_ready=10000) as db:
db.index(inputs=docs_to_index)
if replicas > 1:
@ -102,7 +102,7 @@ def test_inmemory_vectordb_udpate_text(docs_to_index, replicas, shards, protocol
query = docs_to_index[0]
port = random_port()
update = MyDoc(id=query.id, text=query.text + '_changed', embedding=query.embedding)
with InMemoryExactNNVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
with InMemoryExactNNVectorDB[MyDoc]().serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
protocol=protocol, timeout_ready=10000) as db:
db.index(inputs=docs_to_index)
if replicas > 1:
@ -131,7 +131,7 @@ def test_inmemory_vectordb_restore(docs_to_index, replicas, shards, protocol, tm
query = docs_to_index[:100]
port = random_port()
with InMemoryExactNNVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
with InMemoryExactNNVectorDB[MyDoc](workspace=str(tmpdir)).serve(replicas=replicas, shards=shards, port=port,
protocol=protocol, timeout_ready=10000) as db:
db.index(docs=docs_to_index)
if replicas > 1:
@ -144,7 +144,7 @@ def test_inmemory_vectordb_restore(docs_to_index, replicas, shards, protocol, tm
assert res.text == res.matches[0].text
assert res.scores[0] > 0.99 # some precision issues, should be 1
with InMemoryExactNNVectorDB[MyDoc].serve(workspace=str(tmpdir), replicas=replicas, shards=shards, port=port,
with InMemoryExactNNVectorDB[MyDoc](workspace=str(tmpdir)).serve(replicas=replicas, shards=shards, port=port,
protocol=protocol, timeout_ready=10000) as new_db:
time.sleep(2)
resp = new_db.search(docs=query)

View File

@ -12,7 +12,7 @@ def _ignore_warnings():
_ignore_warnings()
__version__ = '0.0.17'
__version__ = '0.0.18'
from vectordb.client import Client
from vectordb.db.hnsw_vectordb import HNSWVectorDB

View File

@ -85,7 +85,7 @@ class VectorDB(Generic[TSchema]):
ServedExecutor = type(f'{executor_cls_name.replace("[", "").replace("]", "")}', (cls._executor_cls,),
{})
uses = ServedExecutor
polling = {'/index': 'ANY', '/search': 'ALL', '/update': 'ALL', '/delete': 'ALL'}
polling = {'/index': 'ANY', '/search': 'ALL', '/update': 'ALL', '/delete': 'ALL', '/push': 'ANY', '/build': 'ALL'}
if to_deploy and replicas > 1:
import warnings
warnings.warn(
@ -163,9 +163,9 @@ class VectorDB(Generic[TSchema]):
**kwargs):
protocol = protocol or 'grpc'
protocol_list = [p.lower() for p in protocol] if isinstance(protocol, list) else [protocol.lower()]
uses_with = kwargs.get('uses_with', {})
uses_with = kwargs.pop('uses_with', {})
uses_with.update(self._uses_with)
workspace = kwargs.get('workspace', self._workspace)
workspace = kwargs.pop('workspace', self._workspace)
ctxt_manager = self._get_jina_object(to_deploy=False, port=port, protocol=protocol, workspace=workspace,
uses_with=uses_with, **kwargs)
port = port[0] if isinstance(port, list) else port
@ -178,7 +178,7 @@ class VectorDB(Generic[TSchema]):
import os
import yaml
from yaml.loader import SafeLoader
uses_with = kwargs.get('uses_with', {})
uses_with = kwargs.pop('uses_with', {})
uses_with.update(self._uses_with)
jina_obj = self._get_jina_object(to_deploy=True, uses_with=uses_with, **kwargs)