pub struct Composer { /* private fields */ }Expand description
Builds the ordered response blocks of one turn (spec §18.1).
Implementations§
Source§impl Composer
impl Composer
Sourcepub fn new(
workflows: Arc<WorkflowRegistry>,
router: Arc<dyn ProviderRouter>,
narration: NarrationConfig,
) -> Self
pub fn new( workflows: Arc<WorkflowRegistry>, router: Arc<dyn ProviderRouter>, narration: NarrationConfig, ) -> Self
A composer whose narration tasks run over router with the shipped profiles.
Sourcepub fn with_tasks(self, engine: TaskEngine) -> Self
pub fn with_tasks(self, engine: TaskEngine) -> Self
Runs the narration tasks on engine: its profiles, prompts and records.
Sourcepub fn carries(&self, part: &ContentPart) -> bool
pub fn carries(&self, part: &ContentPart) -> bool
Whether a model that answers can be shown part.
Sourcepub fn with_knowledge(self, knowledge: Arc<dyn KnowledgeProvider>) -> Self
pub fn with_knowledge(self, knowledge: Arc<dyn KnowledgeProvider>) -> Self
Attaches a knowledge provider (spec §19.2).
Sourcepub fn with_copy(self, copy: CompositionCopy) -> Self
pub fn with_copy(self, copy: CompositionCopy) -> Self
Replaces the copy composition writes itself. English and Italian by default; a
LocalizedText adds languages with with, and the copy’s translated a whole
language at once.
Sourcepub fn with_ask_copy(self, copy: AskCopy) -> Self
pub fn with_ask_copy(self, copy: AskCopy) -> Self
Replaces the questions code writes when no model does.
Sourcepub const fn with_max_chunks(self, max_chunks: Option<usize>) -> Self
pub const fn with_max_chunks(self, max_chunks: Option<usize>) -> Self
Sets how many knowledge chunks one answer may retrieve.
Sourcepub fn ledger_receipts(
&self,
groups: &[LedgerReceiptGroup],
locale: &Locale,
) -> Result<Vec<OperationalReceipt>, OrchestratorError>
pub fn ledger_receipts( &self, groups: &[LedgerReceiptGroup], locale: &Locale, ) -> Result<Vec<OperationalReceipt>, OrchestratorError>
Renders receipts from a ledger read, carrying every erasure through.
§Errors
OrchestratorError::Erasure when a workflow cannot read back its own events.
Sourcepub fn receipts(
&self,
events: &[EventBatch],
locale: &Locale,
) -> Result<Vec<OperationalReceipt>, OrchestratorError>
pub fn receipts( &self, events: &[EventBatch], locale: &Locale, ) -> Result<Vec<OperationalReceipt>, OrchestratorError>
Renders the receipts of a turn from the events that just committed (§17.3, I16). Deterministic, so a regenerated response is the one that was lost.
§Errors
OrchestratorError::Erasure when a workflow cannot read back its own events.
Sourcepub async fn compose(
&self,
input: CompositionInput<'_>,
) -> Result<Composition, OrchestratorError>
pub async fn compose( &self, input: CompositionInput<'_>, ) -> Result<Composition, OrchestratorError>
Composes the whole answer (spec §23 steps Q to T).
§Errors
OrchestratorError::Erasure when receipts cannot be rendered, and
OrchestratorError::Internal when the assembled turn fails
claim_guard::verify, a defect in this module.