VectorWave
API Reference
Complete reference for @vectorize options, environment variables, and utility classes.
@vectorize Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
semantic_cache | bool | False | Enable semantic caching for similar inputs |
cache_threshold | float | 0.9 | Cosine similarity threshold for cache hits (0.0 — 1.0) |
semantic_cache_filters | Dict | None | Static filters for semantic cache lookups |
semantic_cache_scope | List[str] | None | Function parameter names to use as dynamic cache filters |
capture_return_value | bool | False | Store function return values in Weaviate |
capture_inputs | bool | False | Auto-capture all function parameters |
attributes_to_capture | List[str] | None | Specific attributes to log |
replay | bool | False | Enable replay-based regression testing |
auto | bool | False | Auto-generate function descriptions via LLM |
search_description | str | None | Custom description for vector search optimization |
sequence_narrative | str | None | Story/narrative for context understanding |
**execution_tags | kwargs | — | Custom tags defined in .weaviate_properties (e.g. team="ml-team") |
Usage
@vectorize(
semantic_cache=True,
cache_threshold=0.95,
capture_return_value=True,
capture_inputs=True,
replay=True,
auto=True,
team="ml-team", # custom tag (defined in .weaviate_properties)
)
async def generate_response(query: str):
return await llm.complete(query)
@trace_span
Decorator for child span tracing. Must be used within a @vectorize parent context.
from vectorwave import trace_span
@trace_span
def child_function(data):
return process(data)
Automatically inherits trace_id from the parent @vectorize call.
Optional Parameters
@trace_span also accepts keyword arguments for fine-grained control:
| Parameter | Type | Default | Description |
|---|---|---|---|
attributes_to_capture | List[str] | None | Specific attributes to log for this span |
capture_return_value | bool | False | Store the span's return value |
force_sync | bool | False | Force synchronous DB write (bypass async logging) |
@trace_span(capture_return_value=True, attributes_to_capture=["score"])
def rank_results(results, score=0.5):
return sorted(results, key=lambda x: x["score"])
Environment Variables
Connection
| Variable | Required | Default | Description |
|---|---|---|---|
WEAVIATE_HOST | No | localhost | Weaviate hostname |
WEAVIATE_PORT | No | 8080 | Weaviate HTTP port |
WEAVIATE_GRPC_PORT | No | 50051 | Weaviate gRPC port |
WEAVIATE_API_KEY | For WCS | — | Weaviate Cloud API key |
Vectorizer
| Variable | Required | Default | Description |
|---|---|---|---|
VECTORIZER | No | weaviate_module | Embedding provider: weaviate_module, openai_client, huggingface, or none |
OPENAI_API_KEY | For AI features | — | OpenAI API key for embeddings, auto-docs, healing, RAG |
HF_MODEL_NAME | No | sentence-transformers/all-MiniLM-L6-v2 | HuggingFace model for huggingface vectorizer |
WEAVIATE_VECTORIZER_MODULE | No | text2vec-openai | Weaviate built-in vectorizer module name |
WEAVIATE_GENERATIVE_MODULE | No | generative-openai | Weaviate generative module name |
GitHub (Self-Healing)
| Variable | Required | Default | Description |
|---|---|---|---|
GITHUB_TOKEN | For auto-PR | — | GitHub personal access token |
GITHUB_REPO_NAME | For auto-PR | — | GitHub repository (format: org/repo) |
GITHUB_BASE_BRANCH | No | main | Base branch for auto-PR |
Drift Detection and Alerting
| Variable | Required | Default | Description |
|---|---|---|---|
DRIFT_DETECTION_ENABLED | No | False | Enable drift detection |
DRIFT_DISTANCE_THRESHOLD | No | 0.25 | Distance threshold for drift alerts |
DRIFT_NEIGHBOR_AMOUNT | No | 5 | Number of neighbors for KNN drift check |
ALERTER_STRATEGY | No | none | Alert strategy: none or webhook |
ALERTER_WEBHOOK_URL | For alerts | — | Webhook URL for alerts (Discord, Slack, etc.) |
ALERTER_MIN_LEVEL | No | ERROR | Minimum alert level |
Performance Tuning
| Variable | Required | Default | Description |
|---|---|---|---|
BATCH_THRESHOLD | No | 20 | Number of objects before batch flush |
FLUSH_INTERVAL_SECONDS | No | 2.0 | Time interval for batch flush (seconds) |
ASYNC_LOGGING | No | False | Enable async database logging for lower latency |
File Paths
| Variable | Required | Default | Description |
|---|---|---|---|
CUSTOM_PROPERTIES_FILE_PATH | No | .weaviate_properties | Custom schema properties file |
IGNORE_ERROR_FILE_PATH | No | .vtwignore | Error suppression file |
FAILURE_MAPPING_FILE_PATH | No | .vectorwave_errors.json | Error code mapping file |
Data and Tags
| Variable | Required | Default | Description |
|---|---|---|---|
SENSITIVE_FIELD_NAMES | No | password,api_key,token,secret,auth_token | Comma-separated field names to mask in logs |
RECOMMENDATION_STEADY_MARGIN | No | 0.05 | Golden Dataset recommendation STEADY margin |
RECOMMENDATION_DISCOVERY_MARGIN | No | 0.15 | Golden Dataset recommendation DISCOVERY margin |
VECTORWAVE_TAGS_* | No | — | Global tags (e.g., VECTORWAVE_TAGS_ENV=production) |
Core Functions
initialize_database()
Creates four Weaviate collections (VectorWaveFunctions, VectorWaveExecutions, VectorWaveGoldenDataset, VectorWaveTokenUsage). Must be called once before first use.
from vectorwave import initialize_database
initialize_database()
update_database_schema()
Performs zero-downtime schema migration when upgrading VectorWave.
from vectorwave import update_database_schema
update_database_schema()
search_functions(query, limit)
Vector search over stored function metadata.
from vectorwave import search_functions
results = search_functions(query="authentication", limit=5)
search_executions(limit, filters, sort_by, sort_ascending)
Search execution logs with filtering and sorting. Unlike search_functions, this uses filter-based lookup rather than vector search.
from vectorwave import search_executions
# Recent errors
results = search_executions(
limit=10,
filters={"status": "ERROR", "duration_ms__gte": 100},
sort_by="timestamp_utc",
sort_ascending=False,
)
Filter operators: exact match (default), __not_equal, __gte, __gt, __lte, __lt, __like.
search_functions_hybrid(query, limit, filters, alpha)
Hybrid search (keyword + vector) over function definitions.
from vectorwave import search_functions_hybrid
results = search_functions_hybrid(
query="calculate loyalty points",
limit=5,
alpha=0.5, # 0.0 = pure keyword, 1.0 = pure vector
)
search_errors_by_message(query, limit, filters)
Semantic search over error messages. Uses vector similarity to find errors matching a natural language description.
from vectorwave import search_errors_by_message
results = search_errors_by_message(
query="timeout connecting to database",
limit=10,
filters={"function_name": "generate_response"},
)
generate_and_register_metadata()
Triggers LLM-based metadata generation for all registered functions that have auto=True. Useful for batch-generating descriptions after initial setup.
from vectorwave import generate_and_register_metadata
generate_and_register_metadata()
search_and_answer(query)
RAG-powered Q&A over your codebase.
from vectorwave import search_and_answer
answer = search_and_answer("How does the auth flow work?")
analyze_trace_log(trace_id, question)
Analyze a specific trace with a natural language question.
from vectorwave import analyze_trace_log
analysis = analyze_trace_log(
trace_id="abc-123",
question="Why was this trace slow?",
)
VectorWaveHealer
Constructor
from vectorwave import VectorWaveHealer
healer = VectorWaveHealer(
model="gpt-4-turbo", # LLM model (only parameter)
)
diagnose_and_heal()
result = healer.diagnose_and_heal(
function_name="generate_response",
lookback_minutes=60, # Search errors in last N minutes
create_pr=True, # Create GitHub PR with fix
)
# Returns: str (LLM-suggested fix code or error message)
VectorWaveReplayer
Constructor
from vectorwave import VectorWaveReplayer
replayer = VectorWaveReplayer()
replay()
results = replayer.replay(
function_full_name="app.generate_response",
limit=20, # Max executions to replay
update_baseline=False, # Update baseline values on mismatch
)
# Returns: { function, total, passed, failed, updated, failures }
For semantic comparison, use SemanticReplayer:
from vectorwave import SemanticReplayer
semantic_replayer = SemanticReplayer()
results = semantic_replayer.replay(
function_full_name="app.generate_response",
limit=20,
similarity_threshold=0.85, # Vector similarity threshold
semantic_eval=True, # Use LLM-based semantic evaluation
)
VectorWaveDatasetManager
Constructor
from vectorwave import VectorWaveDatasetManager
dm = VectorWaveDatasetManager()
register_as_golden()
dm.register_as_golden(
log_uuid="abc-123",
note="Verified by QA",
tags=["v2", "production"],
)
recommend_candidates()
candidates = dm.recommend_candidates(
function_name="generate_response",
limit=5,
)
VectorWaveAutoInjector
Auto-injection uses class methods — no instance creation needed.
configure()
from vectorwave import VectorWaveAutoInjector
# Set default configuration for all inject calls
VectorWaveAutoInjector.configure(
auto=True,
capture_return_value=True,
team="ai-team",
)
inject()
# Inject @vectorize into all functions in a module
VectorWaveAutoInjector.inject(
target_module_path="app.services.ai",
recursive=False, # Recursively scan submodules
team="ai-team", # Override config per inject call
)
Webhook Alerting
Alerts are configured via environment variables, not a function call:
# .env
ALERTER_STRATEGY=webhook # Enable webhook alerts
ALERTER_WEBHOOK_URL=https://discord.com/api/webhooks/... # Webhook endpoint
ALERTER_MIN_LEVEL=ERROR # Minimum alert level
DRIFT_DETECTION_ENABLED=True # Enable drift alerts
DRIFT_DISTANCE_THRESHOLD=0.25 # Drift threshold
Alert payloads are sent automatically when errors or drift events occur.