langchain_experimental.rl_chain.pick_best_chain.PickBestFeatureEmbedder

class langchain_experimental.rl_chain.pick_best_chain.PickBestFeatureEmbedder(auto_embed: bool, model: Optional[Any] = None, *args: Any, **kwargs: Any)[source]

Embed the BasedOn and ToSelectFrom inputs into a format that can be used by the learning policy.

Parameters
  • auto_embed (bool) –

  • model (Optional[Any]) –

  • args (Any) –

  • kwargs (Any) –

model name

The type of embeddings to be used for feature representation. Defaults to BERT SentenceTransformer.

Type

Any, optional

Methods

__init__(auto_embed[, model])

format(event)

format_auto_embed_off(event)

Converts the BasedOn and ToSelectFrom into a format that can be used by VW

format_auto_embed_on(event)

get_context_and_action_embeddings(event)

get_indexed_dot_product(context_emb, action_embs)

get_label(event)

__init__(auto_embed: bool, model: Optional[Any] = None, *args: Any, **kwargs: Any)[source]
Parameters
  • auto_embed (bool) –

  • model (Optional[Any]) –

  • args (Any) –

  • kwargs (Any) –

format(event: PickBestEvent) str[source]
Parameters

event (PickBestEvent) –

Return type

str

format_auto_embed_off(event: PickBestEvent) str[source]

Converts the BasedOn and ToSelectFrom into a format that can be used by VW

Parameters

event (PickBestEvent) –

Return type

str

format_auto_embed_on(event: PickBestEvent) str[source]
Parameters

event (PickBestEvent) –

Return type

str

get_context_and_action_embeddings(event: PickBestEvent) tuple[source]
Parameters

event (PickBestEvent) –

Return type

tuple

get_indexed_dot_product(context_emb: List, action_embs: List) Dict[source]
Parameters
  • context_emb (List) –

  • action_embs (List) –

Return type

Dict

get_label(event: PickBestEvent) tuple[source]
Parameters

event (PickBestEvent) –

Return type

tuple