llm_weaver/
architecture.rs

1/// The following diagram shows a very high level slimmed down overview of the
2/// architecture of the library and how an application might use it.
3///
4/// Only the traits [`Loom`](crate::Loom) and [`Config`](crate::Config) are expanded to show some of
5/// their main associated types.
6#[cfg_attr(doc, aquamarine::aquamarine)]
7/// ```mermaid
8/// graph TB
9///     subgraph Chat Application
10///         App
11///         chat_gpt[Chat GPT]
12///         bard[Bard]
13///     end
14///     App-. impl .- Loom
15///     App-. impl .- Config
16///     chat_gpt[Chat GPT]-. impl .- llm
17///     bard[Bard]-. impl .- llm
18///     subgraph LLM Weaver
19///         llm>Llm]
20///         subgraph Config
21///             prompt_model[PromptModel]-- prompt --> chat_gpt
22///             summary_model[SummaryModel]-- prompt --> bard
23///             tapestry_chest_type[Chest]
24///         end        
25///         subgraph Loom
26///             weave-- save prompt and response --> tapestry_chest_type
27///             weave-- generate summary --> summary_model
28///             weave-- generate response --> prompt_model
29///         end
30///         tapestry_chest_handler>TapestryChestHandler]
31///         tapestry_chest[TapestryChest]-. default impl .- tapestry_chest_handler
32///         tapestry_chest_type --> tapestry_chest
33///         tapestry_chest --> redis
34///         redis[Redis]
35///     end
36/// ```
37///
38/// The application must implement the [`Loom`](crate::Loom) and [`Config`](crate::Config) traits in
39/// order to utilize the library. This includes but is not limited to providing the types that
40/// implement the [`Llm`](crate::Llm) trait which defines the LLMs which will be used to
41/// prompt and generate summaries.
42///
43/// The [`Config`](crate::Config) trait also requires the application to supply an implementation
44/// for [`Chest`](crate::Config::Chest) which is responsible for storing and retrieving the
45/// [`TapestryFragment`](crate::TapestryFragment)s, but is not required since llm_weaver provides a
46/// default implementation that uses Redis as the storage backend.
47pub struct Diagram;