ChatBot.structured_prompt
Configure the chatbot with a structured prompt built from keyword sections.
USAGE
**sections) ChatBot.structured_prompt(
This is a convenience method for quickly building attention-optimized prompts without using the full prompt builder API. It automatically structures the provided sections according to attention-based principles.
Parameters
****sections** : = {}
-
Keyword arguments defining prompt sections.
Returns
ChatBot
-
Returns self for method chaining
Recognized Keyword Arguments
persona
: behavioral role (e.g.,"senior developer"
)task
: primary task descriptionconstraints
: list of requirements or constraintsformat
: list of output formatting requirementsexamples
: dict of input/output examplesfocus
: primary goal to emphasize
Examples
Quick structured prompt creation
import talk_box as tb
= (
bot
tb.ChatBot()"gpt-4-turbo")
.model(
.structured_prompt(="senior software architect",
persona="Analyze codebase architecture and identify improvements",
task=[
constraints"Focus on security vulnerabilities",
"Identify performance bottlenecks",
"Suggest specific fixes"
],format=[
"Use bullet points for findings",
"Include code examples",
"Prioritize by severity"
],="actionable recommendations for immediate implementation"
focus
) )
Combining with other configuration
= (
expert_bot
tb.ChatBot()"gpt-4-turbo")
.model(0.2)
.temperature(
.structured_prompt(="expert debugger",
persona="Identify root cause of performance issues",
task=["Provide reproducible test cases"],
constraints="finding the root cause, not just symptoms"
focus
)1500)
.max_tokens( )