1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! The system prompt, put together for each model call from two parts:
//! the agent's own [`SystemPrompt`](super::agent::SystemPrompt) and the
//! [`PromptSection`]s, the app's and the agent's own ([`SectionOf`]).
//! Nothing in it depends on the turn, so it stays the same from call to
//! call and the provider's prompt cache keeps it. A section whose text
//! changes costs the whole conversation's cache once per change, so what
//! changes goes in a message instead (`DeliveryMode::Inform`); a section
//! that changes rarely sorts before one that changes more often. A request
//! carries it in parts, rig-core's `SystemPrompt`
//! ([`ModelRequest::prompt`](super::turn::ModelRequest::prompt)), until
//! Start sends it as one system message.
use *;
use *;
/// A part of every agent's system prompt, on an entity of its own, or of one
/// agent's with a [`SectionOf`] that agent. A plugin spawns one and changes its
/// `text` when what it describes changes (with `set_if_neq`, so an unchanged
/// section is not marked changed); an empty `text`, or Bevy's `Disabled` on the
/// entity, leaves the section out. Sections are sent in `order`, then `tag`,
/// each between `<tag>` and `</tag>`.
/// On a [`PromptSection`]: it is part of this agent's system prompt only.
/// Despawning the agent despawns it. A restored agent is a new entity, so
/// a plugin spawns the sections of its agents again, such as when the
/// saved component they come from is added.
;
/// The prompt sections of this agent alone.
;