airflow.providers.weaviate.hooks.weaviate

Module Contents

Classes

WeaviateHook

Interact with Weaviate database to store vectors. This hook uses the conn_id.

class airflow.providers.weaviate.hooks.weaviate.WeaviateHook(conn_id=default_conn_name, *args, **kwargs)[source]

Bases: airflow.hooks.base.BaseHook

Interact with Weaviate database to store vectors. This hook uses the conn_id.

Parameters

conn_id (str) – The connection id to use when connecting to Weaviate. <howto/connection:weaviate>

conn_name_attr = 'conn_id'[source]
default_conn_name = 'weaviate_default'[source]
conn_type = 'weaviate'[source]
hook_name = 'Weaviate'[source]
static get_connection_form_widgets()[source]

Returns connection widgets to add to connection form.

static get_ui_field_behaviour()[source]

Returns custom field behaviour.

get_client()[source]
test_connection()[source]
create_class(class_json)[source]

Create a new class.

create_schema(schema_json)[source]

Create a new Schema.

Instead of adding classes one by one , you can upload a full schema in JSON format at once.

Parameters

schema_json (dict[str, Any]) – The schema to create

batch_data(class_name, data, batch_config_params=None)[source]
delete_class(class_name)[source]

Delete an existing class.

query_with_vector(embeddings, class_name, *properties, certainty=0.7, limit=1)[source]

Query weaviate database with near vectors.

This method uses a vector search using a Get query. we are using a with_near_vector to provide weaviate with a query with vector itself. This is needed for query a Weaviate class with a custom, external vectorizer. Weaviate then converts this into a vector through the inference API (OpenAI in this particular example) and uses that vector as the basis for a vector search.

query_without_vector(search_text, class_name, *properties, limit=1)[source]

Query using near text.

This method uses a vector search using a Get query. we are using a nearText operator to provide weaviate with a query search_text. Weaviate then converts this into a vector through the inference API (OpenAI in this particular example) and uses that vector as the basis for a vector search.

Was this entry helpful?