A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://weaviate.io/developers/weaviate/client-libraries/python below:

Website Navigation


Python | Weaviate Documentation

Changes in v4.4b9 weaviate.connect_to_x methods

The timeout argument in now a part of the additional_config argument. It takes the class weaviate.config.AdditionalConfig as input.

Queries

All optional arguments to methods in the query namespace now are enforced as keyword arguments.

There is now runtime logic for parsing query arguments enforcing the correct type.

Batch processing

Introduction of three distinct algorithms using different batching styles under-the-hood:

client.batch.dynamic() as batch is a drop-in replacement for the previous client.batch as batch, which is now deprecated and will be removed on release.

with client.batch.dynamic() as batch:
...

is equivalent to:

with client.batch as batch:
...

client.batch.fixed_size() as batch is a way to configure your batching algorithm to only use a fixed size.

with client.batch.dynamic() as batch:
...

is equivalent to:

client.batch.configure_fixed_size()
with client.batch as batch:
...

client.batch.rate_limit() as batch is a new way to help avoid hitting third-party vectorization API rate limits. By specifying request_per_minute in the rate_limit() method, you can force the batching algorithm to send objects to Weaviate at the speed your third-party API is capable of processing objects.

These methods now return completely localized context managers. This means that failed_objects and failed_references of one batch won't be included in any subsequent calls.

Finally, if the background thread responsible for sending the batches raises an exception this is now re-raised in the main thread rather than silently erroring.

Filters

The argument prop in Filter.by_property has been renamed to name

Ref counting is now achievable using Filter.by_ref_count(ref) rather than Filter([ref])

Changes in v4.4b8 Reference filters

Reference filters have a simplified syntax. The new syntax looks like this:

Filter.by_ref("ref").by_property("target_property")
Changes in v4.4b7 Library imports

Importing directly from weaviate is deprecated. Use import weaviate.classes as wvc instead.

Close client connections

Starting in v4.4b7, you have to explicitly close your client connections. There are two ways to close client connections.

Use client.close() to explicitly close your client connections.

import weaviate
client = weaviate.connect_to_local()

print(client.is_ready())

client.close()

Use a context manager to close client connections for you.

import weaviate

with weaviate.connect_to_local() as client:
print(client.is_ready())


Batch processing

The v4.4b7 client introduces changes to client.batch.

Updated client.batch parameters

Old value Value in v4.4b7 from_object_uuid: UUID from_uuid: UUID from_object_collection: str from_collection: str from_property_name: str from_property: str to_object_uuid: UUID to: Union[WeaviateReference, List[UUID]] to_object_collection: Optional[str] = None tenant: Optional[str] = None tenant: Optional[str] = None Filter syntax

Filter syntax is updated in v4.4b7.

NOTE: The filter reference syntax is simplified in 4.4b8.

Old syntax New syntax in v4.4b7 Filter(path=property) Filter.by_property(property) Filter(path=["ref", "target_class", "target_property"]) Filter.by_ref().link_on("ref").by_property("target_property") FilterMetadata.ByXX Filter.by_id()
Filter.by_creation_time()
Filter.by_update_time()

The pre-4.4b7 filter syntax is deprecated. The new, v4.4b7 syntax looks like this.

import weaviate
import datetime
import weaviate.classes as wvc

client = weaviate.connect_to_local()

jeopardy = client.collections.get("JeopardyQuestion")
response = jeopardy.query.fetch_objects(
filters=wvc.query.Filter.by_property("round").equal("Double Jeopardy!") &
wvc.query.Filter.by_creation_time().greater_or_equal(datetime.datetime(2005, 1, 1)) |
wvc.query.Filter.by_creation_time().greater_or_equal(datetime.datetime(2000, 12, 31)),
limit=3
)


client.close()
reference_add_many updated

The reference_add_many syntax is updated; DataReferenceOneToMany is now DataReference.

collection.data.reference_add_many(
[
DataReference(
from_property="ref",
from_uuid=uuid_from,
to_uuid=*one or a list of UUIDs*,
)
]
)
References

Multi-target references updated. These are the new functions:

Use ReferenceToMulti for multi-target references.

Older client changes References Reorganization of classes/parameters Data types

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4