Docs /Templates/ sinapsis-vowpal-wabbit

CBExploreADFPredictEmbeddings

sinapsis-vowpal-wabbitcommunity

Python template · sinapsis_vowpal_wabbit.templates.cb_explore_adf_predict_embeddings

Overview

Template to perform action predictions using the Vowpal Wabbit CB_Explore_ADF approach.

Uses text instructions, enhanced with sentence embeddings.

Attributes: actions (list[str]): List of available action identifiers or labels that the model can predict or explore. model_path (str): File system path to the trained Vowpal Wabbit model that will be used for making predictions. inference_only (bool): Flag to determine the operation mode. When True, the model operates in inference-only mode without updates or learning. Defaults to True. threshold (float): Minimum confidence or score threshold for predictions. Predictions below this threshold may be filtered or handled differently. Defaults to 0. top_k (int): Number of top-ranked predictions or actions to return or consider in the output. Defaults to 3. sentence_transformer_params (SentenceTransformerParams): Configuration parameters for the SentenceTransformer model used to generate embeddings from text. Defaults to an empty SentenceTransformerParams instance if not provided or if an empty dict is passed.

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-vowpal-wabbit==1.0.0
uv pip install sinapsis-vowpal-wabbit==1.0.0
uv add sinapsis-vowpal-wabbit==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

top_k

Number of top-ranked predictions or actions to return or consider in the output. Defaults to 3.

int
Optional
Default: 3
actionsRequired

List of available action identifiers or labels that the model can predict or explore.

list[str]
Required
Default: null
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
threshold

Minimum confidence or score threshold for predictions. Predictions below this threshold may be filtered or handled differently. Defaults to 0.

float
Optional
Default: 0
model_pathRequired

File system path to the trained Vowpal Wabbit model that will be used for making predictions.

str
Required
Default: null
stop_words
list
Optional
Default: ["i","me","my","myself","we","our","ours","ourselves","you","you're","your","yours","yourself","yourselves","he","him","his","himself","she","her","hers","herself","it","its","itself","they","them","their","theirs","themselves","what","which","who","whom","this","that","these","those","am","is","are","was","were","be","been","being","have","has","had","having","do","does","did","doing","a","an","the","and","but","if","or","because","as","until","while","of","at","by","for","with","about","against","between","into","through","during","before","after","above","below","to","from","up","down","in","out","on","off","over","under","again","further","then","once","here","there","when","where","why","how"]
random_seed
int | None
Optional
Default: null
inference_only

Flag to determine the operation mode. When True, the model operates in inference-only mode without updates or learning. Defaults to True.

bool
Optional
Default: true
remove_stop_words

Flag indicating whether to remove stop words from text. Defaults to False.

bool
Optional
Default: false
clean_text_pattern
str
Optional
Default: "[^a-z0-9\\s]"
vw_workspace_params

Workspace parameters specific to the CB explore-adf algorithm. Defaults to an empty CBExploreADFWorkspaceParams instance if not provided or if an empty dict is passed.

CBExploreADFWorkspaceParams
Optional
Default: null
l1
float
Optional
Default: 0
l2
float
Optional
Default: 0
quiet
Whether to suppress output. Defaults to False. Raises: ValueError: If exploration_value is inconsistent with exploration_method: - If method is "first" or "bag" but value is not an integer - If method is "epsilon" but… Read full field description

Whether to suppress output. Defaults to False. Raises: ValueError: If exploration_value is inconsistent with exploration_method: - If method is "first" or "bag" but value is not an integer - If method is "epsilon" but value is not a float or outside [0.0, 1.0] Properties: vw_exploration_string: Generates the corresponding Vowpal Wabbit command line arguments for the configured exploration method and value.

bool
Optional
Default: false
adaptive

Whether to use adaptive exploration. Defaults to True.

bool
Optional
Default: true
ngram_size
int
Optional
Default: 2
normalized

Whether to use normalized weights. Defaults to True.

bool
Optional
Default: true
bit_precision
int
Optional
Default: 24
learning_rate
float | None
Optional
Default: null
ngram_namespaces
list[str]
Optional
Default: []
exploration_value

The value parameter for the chosen exploration method. - For "first" and "bag": Must be an integer (e.g., number of actions to explore) - For "epsilon": Must be a float between 0.0 and 1.0 (exploration probability) - For "softmax": Must be a float (lambda/temperature parameter) Defaults to 0.2.

int | float
Optional
Default: 0.2
cubic_interactions
list[str]
Optional
Default: []
exploration_method

The exploration strategy to use. Options are: - "first": Explores the first action - "epsilon": Epsilon-greedy exploration - "bag": Bagging/bootstrap exploration - "softmax": Softmax exploration with temperature parameter Defaults to "epsilon".

typing.Literal['first', 'epsilon', 'bag', 'softmax']
Optional
Default: "epsilon"
quadratic_interactions
list[str]
Optional
Default: []
remove_special_characters

Flag indicating whether to remove special characters from text. Defaults to True.

bool
Optional
Default: true
sentence_transformer_params

Configuration parameters for the SentenceTransformer model used to generate embeddings from text. Defaults to an empty SentenceTransformerParams instance if not provided or if an empty dict is passed.

SentenceTransformerParams
Optional
Default: null
device
str
Optional
Default: "cuda:0"
precision
typing.Literal['float32', 'int8', 'uint8', 'binary', 'ubinary']
Optional
Default: "float32"
batch_size
int
Optional
Default: 32
model_name
str
Optional
Default: "all-MiniLM-L6-v2"
normalize_embeddings
bool
Optional
Default: true

Configuration example

Generated from documented defaults. Replace any placeholders and complete required nested settings before running.

yaml
templates:
  - template_name: "CBExploreADFPredictEmbeddings"
    class_name: "CBExploreADFPredictEmbeddings"
    attributes:
      top_k: 3
      actions: "<required>"
      threshold: 0
      model_path: "<required>"
      stop_words: {}
      random_seed: null
      inference_only: true
      remove_stop_words: false
      clean_text_pattern: "[^a-z0-9\\s]"
      vw_workspace_params:
        l1: 0
        l2: 0
        quiet: false
        adaptive: true
        ngram_size: 2
        normalized: true
        bit_precision: 24
        learning_rate: null
        ngram_namespaces: []
        exploration_value: 0.2
        cubic_interactions: []
        exploration_method: "epsilon"
        quadratic_interactions: []
      remove_special_characters: true
      sentence_transformer_params:
        device: "cuda:0"
        precision: "float32"
        batch_size: 32
        model_name: "all-MiniLM-L6-v2"
        normalize_embeddings: true

Inheritance

Immediate parent: sinapsis_vowpal_wabbit.templates.cb_explore_adf_predict.CBExploreADFPredict

Environment variables

Environment definitions belong to their canonical Python modules.

No directly related environment variables listed.