embed#

langchain_experimental.rl_chain.helpers.embed(to_embed: str | _Embed | Dict | List[str | _Embed] | List[Dict], model: Any, namespace: str | None = None) List[Dict[str, str | List[str]]][source]#

Embed the actions or context using the SentenceTransformer model (or a model that has an encode function).

langchain_experimental.rl_chain.helpers.to_embed#

(Union[Union(str, _Embed(str)), Dict, List[Union(str, _Embed(str))], List[Dict]], required) The text to be embedded, either a string, a list of strings or a dictionary or a list of dictionaries.

langchain_experimental.rl_chain.helpers.namespace#

(str, optional) The default namespace to use when dictionary or list of dictionaries not provided.

langchain_experimental.rl_chain.helpers.model#

(Any, required) The model to use for embedding

Returns:

A list of dictionaries where each dictionary has the namespace as the key and the embedded string as the value

Return type:

List[Dict[str, str]]

Parameters:
  • to_embed (str | _Embed | Dict | List[str | _Embed] | List[Dict])

  • model (Any)

  • namespace (str | None)