Mnemosyne.Pipeline.Prompts.MergeSemantic (mnemosyne v0.2.0)

Copy Markdown View Source

Prompt for deciding whether two similar semantic memories should be merged, and synthesizing the merged statement when they should.

Follows the PlugMem update operation: the LLM classifies the pair into one of three relationships and produces a merged statement. Pairs that are only weakly related are kept separate to avoid stitching unrelated facts together.

Returns structured output via chat_structured/3 using a Zoi schema.

Summary

Functions

Builds the system and user messages for the semantic merge prompt.

Parses the merge decision from the LLM response.

Returns the Zoi schema for structured LLM output validation.

Functions

build_messages(variables)

@spec build_messages(map()) :: [map()]

Builds the system and user messages for the semantic merge prompt.

parse_response(arg1)

@spec parse_response(map()) ::
  {:ok, {:merge, String.t()} | :keep_both}
  | {:error, Mnemosyne.Errors.Invalid.PromptError.t()}

Parses the merge decision from the LLM response.

schema()

@spec schema() :: Zoi.Type.t()

Returns the Zoi schema for structured LLM output validation.