Skip to content

Releases: weaviate/weaviate-python-client

v3.2.0

02 Sep 09:48

Choose a tag to compare

Fixes/updates in weaviate.wcs.WCS class:

  • Fixed progress bar for weaviate.wcs.WCS.create, it is being updated in Notebooks too, instead of printing each iteration on new line.
  • Method weaviate.wcs.WCS.create now prints the creation status above the bar.

Updates in weaviate.gql sub-package:

  • New key-value autocorrect: <bool> introduced for the weaviate.gql.filter.NearText and weaviate.gql.filter.Ask filters.
    The autocorrect is enabled only if Weaviate server has the text-spellcheck module enabled. If autocorrect is True the query is corrected before the query is made. Usage example:
# with 'nearText' filter
client.query\
    .get('Article', ['title', 'author'])\
    .near_text(
        {
            'concepts': ['Ecconomy'],
            'autocorrect': True
        }
    )
    # the concept should be corrected to 'Economy'
# with 'ask' filter
client.query\
    .get('Article', ['title', 'author'])\
    .with_ask(
        {
            'question': 'When was the last financial crysis?',
            'autocorrect': True
        }
    )
    # the question should be corrected to 'When was the last financial crisis?'
  • New method weaviate.gql.get.GetBuilder.with_additional is added to GET the _additional properties. Usage example:
# single additional property with this GraphQL query
'''
{
    Get {
        Article {
            title
            author
            _additional {
                id
            }
        }
    }
}
'''
client.query\
    .get('Article', ['title', 'author'])\
    .with_additional('id']) # argument as `str`
# multiple additional property with this GraphQL query
'''
{
    Get {
        Article {
            title
            author
            _additional {
                id
                certainty
            }
        }
    }
}
'''
client.query\
    .get('Article', ['title', 'author'])\
    .with_additional(['id', 'certainty']) # argument as `List[str]`
# additional properties as clause with this GraphQL query
'''
{
    Get {
        Article {
            title
            author
            _additional {
                classification {
                    basedOn
                    classifiedFields
                    completed
                    id
                    scope
                }
            }
        }
    }
}
'''
client.query\
    .get('Article', ['title', 'author'])\
    .with_additional(
        {
            'classification' : ['basedOn', 'classifiedFields', 'completed', 'id']
        }
    ) # argument as `dict[str, List[str]]`
# or with this GraphQL query
'''
{
    Get {
        Article {
            title
            author
            _additional {
                classification {
                    completed
                }
            }
        }
    }
}
'''
client.query\
    .get('Article', ['title', 'author'])\
    .with_additional(
        {
            'classification' : 'completed'
        }
    ) # argument as `Dict[str, str]`

Consider the following GraphQL clause:

'''
{
    Get {
        Article {
            title
            author
            _additional {
                token (
                    properties: ["content"]
                    limit: 10
                    certainty: 0.8
                ) {
                    certainty
                    endPosition
                    entity
                    property
                    startPosition
                    word
                }
            }
        }
    }
}
'''

# Then the python translation of this is the following:
clause = {
    'token': [ # if only one, can be passes as `str`
        'certainty',
        'endPosition',
        'entity',
        'property',
        'startPosition',
        'word',
    ]
}
settings = {
    'properties': ["content"],  # is required
    'limit': 10,                # optional, int
    'certainty': 0.8            # optional, float
}
client.query\
    .get('Article', ['title', 'author'])\
    .with_additional(
        (clause, settings)
    ) # argument as `Tuple[Dict[str, List[str]], Dict[str, Any]]`

If the desired clause does not match any example above, then the clause can always be
converted to string before passing it to the .with_additional() method.

v3.1.1

24 Aug 14:21
c7fdf29

Choose a tag to compare

Fixes in WCS class:

  • Make WCS’s methods’ argument cluster_name case insensitive (lowercased inside the method) to match Weaviate Cloud Service’ naming convention, this fixes the error when Weaviate Cloud Service lowercases the cluster_name but the users are not aware of this and get the exception KeyError.

v3.1.0

17 Aug 13:36

Choose a tag to compare

  • New weaviate.batch.Batch methods:

    • weaviate.batch.Batch.pop_object / weaviate.batch.Batch.pop_reference to remove and return an added object/reference from theweaviate.batch.Batch at position index (by default -1).
    • weaviate.batch.Batch.empty_objects / weaviate.batch.Batch.empty_references to remove all the existing objects/references from the weaviate.batch.Batch instance.
    • weaviate.batch.Batch.is_empty_objects /weaviate.batch.Batch.is_empty_references to check there are any objects/reference in the weaviate.batch.Batch instance.
  • Fixes in weaviate.wcs.WCS class:

    • Authentication only with weaviate.auth.AuthClientPassword.
    • The weaviate.wcs.WCS.create argument module is renamed to modules and can also be a list of modules to enable for the WCS cluster. The argument can be used on the PROD WCS too.
    • The weaviate.wcs.WCS.get_cluster_config does not raise an exception if the cluster does not exist but returns a empty configuration.
    • The weaviate.wcs.WCS.delete_cluster does not raise an exception if the cluster does not exist.
  • Add phoneNumber to the Weaviate's primitive types. Thanks to GitHub user @cdpierse.

  • Bug fix in weaviate.connect.Connection.

  • Fix ConnectionError handling.

  • Optimization in weaviate.batch.requests and weaviate.connect.connection.

v3.0.0

17 Aug 08:35

Choose a tag to compare

  • weaviate.tools module is REMOVED.
    • Batcher class is REMOVED.
    • WCS class is moved from the weaviate.tools to the new module weaviate.wcs
    • weaviate.tools.generate_uuid is REMOVED.
  • weaviate.util.generate_uuid5 is ADDED.
  • New weaviate.batch.Batch class implementation to replace the old one. This implementation uses the BatchRequest
    objects under the hood, which means that there is no need to create BatchRequest's anymore. This new class implementation
    allows 3 different batch creations methods: manual, auto-create and auto-create with dynamic batching.
    See the weaviate.batch.Batch documentation for more information.
  • BatchRequest classes (ObjectsBatchRequest and ReferenceBatchRequest) are hidden from the user and should not be
    used anymore. This is due to the new weaviate.batch.Batch class implementation.
  • New weaviate.schema.Schema field is ADDED, "shardingConfig". It can bu used with Weaviate version >= 1.6.0.
  • New method weaviate.schema.Schema.update_config used to update mutable schema configuration (like efConstruction, ...).

Weaviate python client compatible with Weaviate v1.4.x

03 Jun 08:52

Choose a tag to compare

Changelog: weaviate-python-client v2.5.x

The new version is compatible with Weaviate v1.4.0.

weaviate.gql.get.GetBuilder

  • New method with_near_image(content: dict, encode: bool = True) is added for the GET query. E.g.:
    content = {
      "image": "IMAGE_PATH/image.png",
      "certainty": 0.7,
    }
    client.query.get("Article", "coverImage").with_near_image(content=content, encode=True).do()

weaviate.util

  • New function image_encoder_b64 to encode a image to base64, the argument is the image path OR the file object in "br" mode.
weaviate.util.image_encoder_b64(
    image_or_image_path: Union[str, BufferedReader]
) -> str
  • New function image_decoder_b64 to decode a image from base64 to bytes stream, the argument is the base64 encoded image string.
weaviate.util.image_decoder_b64(
    encoded_image: str
) -> bytes

New features for QnA module and WCS cluster creation

23 Apr 09:20

Choose a tag to compare

Changelog: weaviate-python-client v2.4.x

The new version is compatible with Weaviate v1.3.0.

  • New method with_ask is added for the GET query. E.g.:
    ask = {
      "question": "Who is the king of the Netherlands?",
      "certainty": 0.7,
      "properties": ["summary"]
    }
    client.query.get("Article", ["title", "_additional {hasAnswer certainty property result startPosition endPosition}"]).with_ask(ask).do()
  • New with_auth argument for WCS.create that enables/disables the authentication of the to be created Weaviate instance.
WCS.create(self,
            cluster_name: str=None,
            cluster_type: str='sandbox',
            with_auth: bool=False, # <- NEW
            module: Optional[Union[str, dict]]=None,
            config: dict=None,
            wait_for_completion: bool=True
        ) -> str

New features for WCS and Batcher, Removal of RDF

26 Mar 15:45

Choose a tag to compare

Changelog: weaviate-python-client v2.3.x

  • Bug fixes.
  • Fixes for some functions/methods docstrings.
  • Updated dependences to newer versions.

weaviate.rdf

weaviate.rdf was removed.

weaviate.tools

  • ADDED Batcher.add method to add either Data Objects or References, based on the kwargs values.

  • WCS.create has a new argument module used to specify the module the weaviate should use. It is supported only for the DEV environment at the moment.

  • WCS.create shows a progress bar if wait_for_complition is set to True.

v2.2.0

17 Feb 10:13

Choose a tag to compare

Changelog: weaviate-python-client v2.2.x

weaviate.gql

  • ADDED NearObject filter.
  • ADDED GetBuilder.with_near_object(content: dict) method.

weaviate.tools

  • ADDED new Object WCS to create/delete WCS clusters from python.
    • WCS(auth_client_secret: AuthCredentials, dev: bool=False)
      dev is for development URL.
    • WCS.create(cluster_name: str=None, cluster_type: str='sandbox', config: dict=None, wait_for_completion: bool=True) -> str:
      Create a cluster. Returns the cluster URL.
    • WCS.is_ready(self, cluster_name: str) -> bool:
      Check if cluster is created and ready to use.
    • WCS.get_clusters(self, email: str) -> Optional[List[str]]:
      Lists all weaviate clusters registerd with the email.
    • WCS.get_cluster_config(self, cluster_name: str) -> dict:
      Get details of a cluster.
    • WCS.delete(self, cluster_name: str) -> None:
      Delete the WCS instance.

v2.1.0

08 Feb 14:08

Choose a tag to compare

Changelog: weaviate-python-client v2.1.x


  • __version__ global variable is introduced.

weaviate.util

  • get_valid_uuid(...) raises ValueError instead of returning None.
  • get_vector(vector: Sequence) -> list; is ADDED.

    Get weaviate compatible format of the embedding vector.
  • get_uuid_from_weaviate_url is REMOVED because get_valid_uuid implements it.
  • _get_valid_timeout_config(timeout_config: Union[Tuple[int, int], List[int]]) is ADDED.

    Validate and return TimeOut configuration.

weaviate.client_config

  • ClientConfig class is REMOVED.

weaviate.client

  • Client._init_(..., client_config: ClientConfig=None) -> Client._init_(..., timeout_config: Optional[Tuple[int, int]]=None)

    Due to removal of ClientConfig.
  • ADDED setter/getter for Client.timeout_config.

weaviate.data.references

  • _validate_and_get_uuid() is REMOVED.

weaviate.data

  • DataObject.create(..., vector_weights: dict[str]=None) -> DataObject.create(..., vector: Sequence=None).
  • DataObject.merge(...) -> DataObject.update(..., vector: Sequence=None).
  • DataObject.update(...) -> DataObject.replace(..., vector: Sequence=None).
  • DataObject.validate(...) -> DataObject.validate(..., vector: Sequence=None).
  • DataObject.get(...) -> DataObject.get(..., uuid: str=None).

    Now get can act as DataObject.get_by_id(...) too.
  • DataObject._get_object_response() is REMOVED.

weaviate.connect

  • ADDED setter/getter for Connection.timeout_config.

weaviate.batch

  • Batch.add_references() is REMOVED.
  • BatchRequest._len_() is ADDED.
  • BatchRequest.add() is ADDED.
  • ReferenceBatchRequest.add_reference() is REMOVED.
  • ObjectsBatchRequest.add(...) -> ObjectsBatchRequest.add(..., vector: Sequence=None)
  • ObjectsBatchRequest.add_object() is REMOVED.

weaviate python client compatible with weaviate v1.x.x

11 Jan 16:45

Choose a tag to compare

Changelog: weaviate-python-client v2.0.x

weaviate.batch

  • Batch.create_things() -> Batch.create_objects() (or Batch.create() )

    Due to removal of semantic kind (“things/actions”).

  • Batch.create_actions() -> Batch.create_objects() (or Batch.create() )

    Due to removal of semantic kind (“things/actions”).

  • Batch.add_reference() is DEPRECATED -> Batch.create_references() (or Batch.create())

    Deprecated to make the name consistent with object creation method.

  • Batch.create() ADDED

    This method creates either objects or references.

  • ReferenceBatchRequest.get_batch_size() REMOVED

    Use len(<ReferenceBatchRequest>).

  • ReferenceBatchRequest.get_reference() DEPRECATED -> ReferenceBatchRequest.add()

    Due to redundancy on name level.

  • ActionsBatchReference -> ObjectsBatchRequest

    Due to removal of semantic kind (“things/actions”).

  • ThingsBatchReference -> ObjectsBatchRequest

    Due to removal of semantic kind (“things/actions”).

  • ObjectsBatchRequest.get_objects() DEPRECATED -> ObjectsBatchRequest.add()

    Due to redundancy on name level.

weaviate.classification

  • Classification.schedule.with_settings() ADDED

    Set additional settings for your classification.

  • SOURCE_WHERE_FILTER, TRAINING_SET_WHERE_FILTER, TARGET_WHERE_FILTER global variables were REMOVED.

    These global variables were not used anywhere.

weaviate.data.references

  • Reference.delete(..., from_semantic_type, to_semantic_type) arguments were REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • Reference.update(..., from_semantic_type, to_semantic_type) arguments were REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • Reference.add(..., from_semantic_type, to_semantic_type) arguments were REMOVED.

    Due to removal of semantic kind (“things/actions”).

weaviate.data

  • DataObject.create(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • DataObject.merge(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • DataObject.update(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • DataObject.get_by_id(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • DataObject.get_by_id(..., underscore_properties) -> DataObject.get_by_id(..., additional_properties).

    All underscore properties are now clustered into a single field additional.

  • DataObject.get(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • DataObject.get(..., underscore_properties) -> DataObject.get(..., additional_properties).

    All underscore properties are now clustered into a single field additional.

  • DataObject.delete(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • DataObject.exists(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • DataObject.validate(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

weaviate.gql

  • Query.METHOD .thing(...).with_XXX() -> Query.METHOD(...).with_XXX()

    Due to removal of semantic kind (“things/actions”).

  • Query.METHOD .action(...).with_XXX() -> Query.METHOD(...).with_XXX()

    Due to removal of semantic kind (“things/actions”).

  • build.Builder -> get.GetBuilder

    The module and the class was renamed to reflect the GraphQL functionality.

  • get.GetBuilder.with_explore() -> get.GetBuilder.with_near_text() [this means that it can be accessed as Query.get(...).with_near_text()]

    Due to the renaming of explore to nearText.

  • get.GetBuilder.with_near_vector() is ADDED [this means that it can be accessed as Query.get(...).with_near_vector()]

    Due to the addition of a new method nearVector.

  • filter.Explore -> filter.NearText

    Due to the renaming of explore to nearText.

  • filter.NearVector is ADDED

    Due to the addition of a new method nearVector.

weaviate.schema.properties

  • Property.create(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

weaviate.schema

  • Schema.create_class(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • Schema.delete_class(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

weaviate.tools

  • Batcher.add_data_object(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • Batcher.add_reference(..., from_semantic_type, to_semantic_type) arguments were REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • Batcher.add_reference(from_thing_class_name, from_thing_uuid, to_thing_uuid, ...) -> Batcher.add_reference(from_object_class_name, from_object_uuid, to_object_uuid, ...).

    Due to removal of semantic kind (“things/actions”).

weaviate.exceptions

  • ThingAlreadyExistsException -> ObjectAlreadyExistsException.

    Due to removal of semantic kind (“things/actions”).

weaviate.util

  • generate_local_beacon(..., semantic_type) argument was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • is_weaviate_entity_url -> is_weaviate_object_url.

    Due to removal of semantic kind (“things/actions”).

  • ParsedUUID was REMOVED.

    Was used only to check if UUID is valid and return it, now the get_valid_uuid can be used instead

  • is_semantic_type was REMOVED.

    Due to removal of semantic kind (“things/actions”).

  • get_valid_uuid was ADDED.

    Replacement for the ParsedUUID class.