jina.clients.base

Module containing the Base Client for Jina.

class jina.clients.base.BaseClient(args)[source]

Bases: object

A base client for connecting to the Flow Gateway.

Note

BaseClient does not provide train, index, search interfaces. Please use Client or AsyncClient.

Parameters

args (Namespace) – the Namespace from argparse

property mode

Get the mode for this client (index, query etc.).

Return type

str

Returns

Mode of the client.

static check_input(inputs=None, **kwargs)[source]

Validate the inputs and print the first request if success.

Parameters
  • inputs (Union[Document, Iterable[Union[~DocumentContentType, ~DocumentSourceType, Document, Tuple[~DocumentContentType, ~DocumentContentType], Tuple[~DocumentSourceType, ~DocumentSourceType]]], AsyncIterable[Union[~DocumentContentType, ~DocumentSourceType, Document, Tuple[~DocumentContentType, ~DocumentContentType], Tuple[~DocumentSourceType, ~DocumentSourceType]]], Callable[…, Union[Document, Iterable[Union[~DocumentContentType, ~DocumentSourceType, Document, Tuple[~DocumentContentType, ~DocumentContentType], Tuple[~DocumentSourceType, ~DocumentSourceType]]], AsyncIterable[Union[~DocumentContentType, ~DocumentSourceType, Document, Tuple[~DocumentContentType, ~DocumentContentType], Tuple[~DocumentSourceType, ~DocumentSourceType]]]]], None]) – the inputs

  • kwargs – keyword arguments

Return type

None

property inputs

An iterator of bytes, each element represents a Document’s raw content.

inputs defined in the protobuf

Return type

Union[Document, Iterable[Union[~DocumentContentType, ~DocumentSourceType, Document, Tuple[~DocumentContentType, ~DocumentContentType], Tuple[~DocumentSourceType, ~DocumentSourceType]]], AsyncIterable[Union[~DocumentContentType, ~DocumentSourceType, Document, Tuple[~DocumentContentType, ~DocumentContentType], Tuple[~DocumentSourceType, ~DocumentSourceType]]], Callable[…, Union[Document, Iterable[Union[~DocumentContentType, ~DocumentSourceType, Document, Tuple[~DocumentContentType, ~DocumentContentType], Tuple[~DocumentSourceType, ~DocumentSourceType]]], AsyncIterable[Union[~DocumentContentType, ~DocumentSourceType, Document, Tuple[~DocumentContentType, ~DocumentContentType], Tuple[~DocumentSourceType, ~DocumentSourceType]]]]]]

Returns

inputs

index()[source]

Issue ‘index’ request to the Flow.

search()[source]

Issue ‘search’ request to the Flow.

train()[source]

Issue ‘train’ request to the Flow.

static add_default_kwargs(kwargs)[source]

Add the default kwargs to the instance.

Parameters

kwargs (Dict) – the kwargs to add