ChatBot.structured_prompt
Configure the chatbot with a structured prompt built from keyword sections.
USAGE
ChatBot.structured_prompt(**sections)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()
.model("gpt-4-turbo")
.structured_prompt(
persona="senior software architect",
task="Analyze codebase architecture and identify improvements",
constraints=[
"Focus on security vulnerabilities",
"Identify performance bottlenecks",
"Suggest specific fixes"
],
format=[
"Use bullet points for findings",
"Include code examples",
"Prioritize by severity"
],
focus="actionable recommendations for immediate implementation"
)
)Combining with other configuration
expert_bot = (
tb.ChatBot()
.model("gpt-4-turbo")
.temperature(0.2)
.structured_prompt(
persona="expert debugger",
task="Identify root cause of performance issues",
constraints=["Provide reproducible test cases"],
focus="finding the root cause, not just symptoms"
)
.max_tokens(1500)
)