jina-ai / serve

☁️ Build multimodal AI applications with cloud-native stack
https://jina.ai/serve
Apache License 2.0
21.13k stars 2.22k forks source link

release note 3.19.0 #5936

Closed JoanFM closed 1 year ago

JoanFM commented 1 year ago

Release Note (3.19.0)

This release contains 3 new features, 4 bug fixes, and 3 documentation improvements.

🆕 Features

Jina is now compatible with all versions of DocArray. Unpin version in requirements (#5941)

Jina is now fully compatible with docarray>=0.30, which uncaps the version requirement.

By default, Jina will install the latest DocArray version, however, it remains compatible with the older version. If you still want to use the old version and syntax, manually install docarray<0.30 or pin the requirement in your project.

from docarray import BaseDoc, DocList
from jina import Deployment, Executor, requests

class MyDoc(BaseDoc):
    text: str

class MyExec(Executor):
    @requests(on='/foo')
    def foo(self, docs: DocList[MyDoc], **kwargs):
        docs[0].text = 'hello world'

with Deployment().add(uses=MyExec) as d:
    docs = d.post(on='/foo', inputs=MyDoc(text='hello'), return_type=DocList[MyDoc])
    assert docs[0].text == 'hello world'

Use dynamic gateway Hubble image (#5935)

In order to make Flow compatible with both docarray>=0.30 and docarray<0.30 versions, Hubble provides utilities to adapt the jina and docarray versions to the user's system. This also requires that the gateway image used in K8s be rebuilt. To do this, we have created a Hubble image that dynamically adapts to the system's docarray version. This was necessary to provide support for all DocArray versions.

Add ìmage_pull_secrets argument to Flow to enable pulling from private registry in Kubernetes (#5952)

In order for Kubernetes to pull docker images from a private registry, users need to create secrets that are passed to the Deployments as ImagePullSecrets.

Jina now provides an image_pull_secrets argument for Deployments and Flows which will make sure that those secrets are used by Kubernetes after applying to_kubernetes_yaml

from jina import Flow

f = Flow(image_pull_secrets=['regcred']).add()
f.to_kubernetes_yaml(...)

🐞 Bug Fixes

Fix validation with default endpoint (#5956)

When using docarray>=0.30. Gateway would not start because an Executor binding to the /default endpoint was connected to another that did not bind to this special endpoint. It considered this to be an incompatible topology.

We have solved this problem and this is now possible:

from jina import Flow, Executor, requests

class Encoder(Executor):
    @requests
     def encode(**kwargs):
          pass

class Indexer(Executor):
    @requests['/index']
    def index(**kwargs):
         pass

    @requests['/search']
    def search(**kwargs):
         pass

f = Flow().add(uses=Encoder).add(uses=Indexer)

with f:
    f.block()

Apply return_type when return_responses=True (#5949)

When calling client.post with arguments return_type and return_responses=True, the return_type parameter was not properly applied. This is now fixed and when accessing the docs of the Response they will have the expected type.

from jina import Executor, Deployment, requests
from docarray import DocList, BaseDoc

class InputDoc(BaseDoc):
    text: str

class OutputDoc(BaseDoc):
    len: int

class LenExecutor(Executor):
    @requests
    def foo(self, docs: DocList[InputDoc], **kwargs) -> DocList[OutputDoc]:
        ret = DocList[OutputDoc]()
        for doc in docs:
            ret.append(OutputDoc(len=len(doc.text)))
        return ret

d = Deployment(uses=LenExecutor)

with d:
    resp = d.post(
        "/",
        inputs=InputDoc(text="five"),
        return_type=DocList[OutputDoc],
        return_responses=True,
    )
    assert isinstance(resp[0].docs[0], OutputDoc)

Fix generator detection (#5947)

Jina wrongly tagged async methods as generators which should be used for single Document streaming. Now this is fixed and async methods can safely be used in Executors with docarray>=0.30.

Fix Flow.plot method (#5934)

The plot method for Flow was producing the broken URL https://mermaid.ink/. This has now been fixed.

📗 Documentation Improvements

🤟 Contributors

We would like to thank all contributors to this release:

scott-martens commented 1 year ago

Reviewed. Fixed some wordings and grammar.