WeaviateEx.Client.Config (WeaviateEx v0.7.4)
View SourceClient configuration for WeaviateEx.
Configuration Options
:base_url- HTTP base URL for schema operations (default: "http://localhost:8080"):grpc_host- gRPC host for data operations (default: derived from base_url or "localhost"):grpc_port- gRPC port (default: 50051):api_key- API key for authentication (optional):auth- Authentication config (WeaviateEx.Auth) for API key, bearer token, or OIDC:timeout- Default timeout in milliseconds (default: 60000):grpc_max_message_size- Max gRPC message size in bytes (default: 100MB):additional_headers- Extra headers to include in HTTP/gRPC requests (default: %{}) Common use cases: X-OpenAI-Api-Key, X-Cohere-Api-Key for vectorizer/generative modules:skip_wcs_headers- Skip auto-detection of WCS headers (default: false):connection- Connection pool settings (WeaviateEx.Config.Connectionor keyword list):proxy- Proxy settings (WeaviateEx.Config.Proxy, keyword list, or:env):finch_name- Finch instance name to use (default:WeaviateEx.Finch):token_manager- Existing OIDC TokenManager to attach (optional)
WCS Auto-Detection
When connecting to Weaviate Cloud Services (WCS) instances, the client automatically detects the cluster URL and adds appropriate headers. This is controlled by detecting known WCS domains in the base_url.
Examples
# Local Weaviate
Config.new(base_url: "http://localhost:8080")
# Weaviate Cloud
Config.new(
base_url: "https://my-cluster.weaviate.network",
grpc_host: "my-cluster.grpc.weaviate.network",
grpc_port: 443,
api_key: "your-api-key"
)
Summary
Functions
Adds WCS-specific headers if the host is a WCS instance.
Create config from keyword list.
Creates a new config with automatic WCS header detection.
Check if TLS should be used for gRPC connection.
Detects if the host is a Weaviate Cloud Services instance.
Types
@type t() :: %WeaviateEx.Client.Config{ additional_headers: %{optional(String.t()) => String.t()}, api_key: String.t() | nil, auth: WeaviateEx.Auth.t() | nil, base_url: String.t(), connection: WeaviateEx.Config.Connection.t() | nil, finch_name: atom(), finch_owner: boolean(), grpc_host: String.t(), grpc_max_message_size: integer(), grpc_port: integer(), proxy: WeaviateEx.Config.Proxy.t() | nil, timeout: integer(), timeout_config: WeaviateEx.Config.Timeout.t() | nil, token_manager: GenServer.server() | nil, token_manager_owner: boolean() }
Functions
Adds WCS-specific headers if the host is a WCS instance.
Returns the config with updated additional_headers including the
X-Weaviate-Cluster-URL header for WCS instances.
Examples
config = Config.new(base_url: "https://my-cluster.weaviate.network")
config = Config.maybe_add_wcs_headers(config)
# config.additional_headers now contains X-Weaviate-Cluster-URL
Create config from keyword list.
If grpc_host is not provided, it will be derived from base_url.
Examples
Config.new(base_url: "http://localhost:8080")
# => %Config{grpc_host: "localhost", grpc_port: 50051, ...}
Config.new(base_url: "https://my-cluster.weaviate.network")
# => %Config{grpc_host: "my-cluster.weaviate.network", grpc_port: 443, ...}
Creates a new config with automatic WCS header detection.
This is equivalent to calling new/1 followed by maybe_add_wcs_headers/1.
Options
All options from new/1 plus:
:skip_wcs_headers- Skip WCS header auto-detection (default: false)
Examples
config = Config.new_with_wcs_detection(base_url: "https://my-cluster.weaviate.network")
# WCS headers are automatically added
Check if TLS should be used for gRPC connection.
Returns true if the base_url uses HTTPS or grpc_port is 443.
Detects if the host is a Weaviate Cloud Services instance.
Examples
iex> Config.wcs_host?("https://my-cluster.weaviate.network")
true
iex> Config.wcs_host?("http://localhost:8080")
false