docs: add docs to CB
Pretty much every class and method should have documentation now. ref: N25B-295
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
class LLMInstructions:
|
||||
"""
|
||||
Defines structured instructions that are sent along with each request
|
||||
to the LLM to guide its behavior (norms, goals, etc.).
|
||||
Helper class to construct the system instructions for the LLM.
|
||||
|
||||
It combines the base persona (Pepper robot) with dynamic norms and goals
|
||||
provided by the BDI system.
|
||||
|
||||
:ivar norms: A list of behavioral norms.
|
||||
:ivar goals: A list of specific conversational goals.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
@@ -17,14 +22,22 @@ class LLMInstructions:
|
||||
"Try to learn the user's name during conversation.",
|
||||
]
|
||||
|
||||
def __init__(self, norms: list[str] = None, goals: list[str] = None):
|
||||
def __init__(self, norms: list[str] | None = None, goals: list[str] | None = None):
|
||||
self.norms = norms or self.default_norms()
|
||||
self.goals = goals or self.default_goals()
|
||||
|
||||
def build_developer_instruction(self) -> str:
|
||||
"""
|
||||
Builds a multi-line formatted instruction string for the LLM.
|
||||
Includes only non-empty structured fields.
|
||||
Builds the final system prompt string.
|
||||
|
||||
The prompt includes:
|
||||
1. Persona definition.
|
||||
2. Constraint on response length.
|
||||
3. Instructions on how to handle goals (reach them in order, but prioritize natural flow).
|
||||
4. The specific list of norms.
|
||||
5. The specific list of goals.
|
||||
|
||||
:return: The formatted system prompt string.
|
||||
"""
|
||||
sections = [
|
||||
"You are a Pepper robot engaging in natural human conversation.",
|
||||
|
||||
Reference in New Issue
Block a user