LangChain.Anchor.Behavior behaviour (langchainex v0.2.3)

An Anchor is a point at the end of a chain where the AI confirms with (hopefully) a human that the result of the chain is 'in alignment' before moving on. AI programming differs from traditional programming because it's inherently hard to predict what it will actually do at run-time. This means that best practice is to anchor your chains so that at runtime a human (or at least a traditional hard-coded computer program) can confirm the AI isn't doing something harmful or WOPRish.

Anchors are implemented as a behavior so that you can implement your own anchor, in addition to the CLI and Web anchors in this library. By design they should be predictable and rigorous in terms of output. Don't get creative and try to add natural-language processing to an anchor, because the whole point of an anchor is to eliminate ambiguity about what's going on.

Link to this section Summary

Link to this section Callbacks

Link to this callback

get_confirmation()

@callback get_confirmation() :: :yes | :no
Link to this callback

present_information(action_type, info)

@callback present_information(action_type :: atom(), info :: String.t()) :: any()