langdash.classify package#

Submodules#

langdash.classify.token_qa module#

Classes:

TokenQA(prompt_chain, classes)

Helper class for performing text classification through generative language models.

class langdash.classify.token_qa.TokenQA(prompt_chain: LDChainCached, classes: Dict[str, str | List[str]])[source]#

Bases: object

Helper class for performing text classification through generative language models.

Parameters:
  • prompt_chain (LDChainCached) – Cached chain used for inference.

  • classes (Dict[str, Union[str, List[str]]]) – A dictionary of class to one or more tokens to be classified.

Methods:

query(query[, additional_args, return_result])

Perform a query using the language model.

query(query: str, additional_args: Dict[str, Any] | None = None, return_result: bool = False) → Dict[str, float] | Tuple[Dict[str, float], LDResult][source]#

Perform a query using the language model.

Parameters:
  • query (str) – The query.

  • additional_args (Optional[LDNodeArgs]) – Optional additional arguments to be submitted for inference. Defaults to None.

  • return_result (bool) – Whether or not to return the full result of inference.

Returns:

A dictionary of class to probability floats. If return_result is true, then a tuple with that dictionary and an LDResult object is returned.

Module contents#