Noizu.Weaviate.Api.Schema (Noizu Weaviate v0.1.0)

Noizu.Weaviate.Api.Schema is a module that provides functionality for interacting with the Weaviate schema API. This module offers various functions for configuring classes, properties, vector indices, inverted index, stopwords, and replication in the Weaviate schema.

Usage

To use this module, you need to call the respective function with the required parameters.

Example:

class_name = "Product"
class_config = %{class_name: class_name, description: "A class for representing products in Weaviate"}

{:ok, response} = Noizu.Weaviate.Api.Schema.configure_class(class_name, class_config)

Summary

Functions

Adds a property to a class in the Weaviate schema.

Configures a class in the Weaviate schema.

Configures inverted index for a class in the Weaviate schema.

Configures replication in the Weaviate schema.

Configures stopwords for a class in the Weaviate schema.

Configures vector indices for a class in the Weaviate schema.

Functions

Link to this function

add_property(class_name, property, options \\ nil)

@spec add_property(String.t(), WeaviateStructs.Property.t(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Adds a property to a class in the Weaviate schema.

Parameters

  • class_name (required) - The name of the class.
  • property (required) - The property to add.

Example

class_name = "Product"
property = %{
  name: "price",
  description: "The price of the product",
  data_type: "number"
}

{:ok, response} = Noizu.Weaviate.Api.Schema.add_property(class_name, property)
Link to this function

configure_class(class_name, class_config, options \\ nil)

@spec configure_class(String.t(), WeaviateStructs.Class.t(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Configures a class in the Weaviate schema.

Parameters

  • class_name (required) - The name of the class.
  • class_config (required) - The configuration settings for the class.

Example

class_name = "Product"
class_config = %{
  name: class_name,
  description: "A class for representing products in Weaviate"
}

{:ok, response} = Noizu.Weaviate.Api.Schema.configure_class(class_name, class_config)
Link to this function

configure_inverted_index(class_name, inverted_index, options \\ nil)

@spec configure_inverted_index(String.t(), map(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Configures inverted index for a class in the Weaviate schema.

Parameters

  • class_name (required) - The name of the class.
  • inverted_index (required) - The configuration settings for the inverted index.

Example

class_name = "Product"
inverted_index = %{
  cleanupIntervalSeconds: 600,
  maximumCleanupDurationSeconds: 1800
}

{:ok, response} = Noizu.Weaviate.Api.Schema.configure_inverted_index(class_name, inverted_index)
Link to this function

configure_replication(class_name, replication_config, options \\ nil)

@spec configure_replication(String.t(), map(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Configures replication in the Weaviate schema.

Parameters

  • class_name (required) - The name of the class.
  • replication_config (required) - The replication configuration settings.

Example

class_name = "Product"
replication_config = %{
  f: 2
}

{:ok, response} = Noizu.Weaviate.Api.Schema.configure_replication(class_name, replication_config)
Link to this function

configure_stopwords(class_name, stopwords_config, options \\ nil)

@spec configure_stopwords(String.t(), map(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Configures stopwords for a class in the Weaviate schema.

Parameters

  • class_name (required) - The name of the class.
  • stopwords_config (required) - The configuration settings for the stopwords.

Example

class_name = "Product"
stopwords_config = %{
  remove: ["is", "the", "and"],
  additional: ["a", "an", "in"]
}

{:ok, response} = Noizu.Weaviate.Api.Schema.configure_stopwords(class_name, stopwords_config)
Link to this function

configure_vector_indices(class_name, vector_indices, options \\ nil)

@spec configure_vector_indices(String.t(), map(), options :: any()) ::
  {:ok, any()} | {:error, any()}

Configures vector indices for a class in the Weaviate schema.

Parameters

  • class_name (required) - The name of the class.
  • vector_indices (required) - The configuration settings for the vector indices.

Example

class_name = "Product"
vector_indices = %{
  indexType: "hnsw",
  ...
}

{:ok, response} = Noizu.Weaviate.Api.Schema.configure_vector_indices(class_name, vector_indices)