CommBus (CommBus v0.1.0)

Copy Markdown View Source

Conversational context assembly for LLM interactions.

Summary

Functions

Assemble prompt sections with injected context entries.

Fit entries within a token budget using priority ordering.

Render a Mustache template with metadata.

Render a Mustache template with provided values.

Scan conversation history for entries that match keyword triggers.

Functions

assemble_prompt(conversation, entries, opts \\ [])

@spec assemble_prompt(CommBus.Conversation.t(), [CommBus.Entry.t()], keyword()) ::
  map()

Assemble prompt sections with injected context entries.

fit_budget(entries, limit)

@spec fit_budget([CommBus.Entry.t()], non_neg_integer()) :: [CommBus.Entry.t()]

Fit entries within a token budget using priority ordering.

render_template(template, values, opts \\ [])

@spec render_template(String.t(), map(), keyword()) ::
  {:ok, CommBus.Template.RenderResult.t()}
  | {:error, CommBus.Template.RenderError.t()}

Render a Mustache template with metadata.

resolve_placeholders(template, values, opts \\ [])

@spec resolve_placeholders(String.t(), map(), keyword()) ::
  {:ok, String.t()} | {:error, term()}

Render a Mustache template with provided values.

scan_triggers(messages, entries, opts \\ [])

@spec scan_triggers([CommBus.Message.t()], [CommBus.Entry.t()], keyword()) :: [
  CommBus.Entry.t()
]

Scan conversation history for entries that match keyword triggers.