cpal#

Causal program-aided language (CPAL) is a concept implemented in LangChain as a chain for causal modeling and narrative decomposition.

CPAL improves upon the program-aided language (PAL) by incorporating causal structure to prevent hallucination in language models, particularly when dealing with complex narratives and math problems with nested dependencies.

CPAL involves translating causal narratives into a stack of operations, setting hypothetical conditions for causal models, and decomposing narratives into story elements.

It allows for the creation of causal chains that define the relationships between different elements in a narrative, enabling the modeling and analysis of causal relationships within a given context.

Classes

cpal.base.CPALChain

Causal program-aided language (CPAL) chain implementation.

cpal.base.CausalChain

Translate the causal narrative into a stack of operations.

cpal.base.InterventionChain

Set the hypothetical conditions for the causal model.

cpal.base.NarrativeChain

Decompose the narrative into its story elements.

cpal.base.QueryChain

Query the outcome table using SQL.

cpal.constants.Constant(value[,Β names,Β ...])

Enum for constants used in the CPAL.

cpal.models.CausalModel

Casual data.

cpal.models.EntityModel

Entity in the story.

cpal.models.EntitySettingModel

Entity initial conditions.

cpal.models.InterventionModel

Intervention data of the story aka initial conditions.

cpal.models.NarrativeModel

Narrative input as three story elements.

cpal.models.QueryModel

Query data of the story.

cpal.models.ResultModel

Result of the story query.

cpal.models.StoryModel

Story data.

cpal.models.SystemSettingModel

System initial conditions.