Primer
  • Factored Cognition Primer
  • Intro
    • Factored Cognition
    • Before We Start
  • Chapters
    • Hello World
    • Question Answering
      • Q&A without context
      • Q&A about short texts
    • Debate
      • Representing debates
      • From debates to prompts
      • The debate recipe
    • Long Texts
      • Loading paper text
      • Finding relevant paragraphs
      • Answering given paragraphs
    • Amplification
      • Asking subquestions
      • Answering subquestions
      • One-step amplification
      • Recursive amplification
    • Verifiers
      • Checking answers
      • Checking reasoning steps
    • Tool Use
      • Web search
      • Interpreters
    • Deduction
      • Chain of Thought
    • Action Selection
      • One-shot action selection
      • Iterative action selection
    • Amplification Revisited
  • Appendix
    • What’s next?
  • Links
    • We’re Hiring
    • Our Slack Community
    • ICE on Github
Powered by GitBook
On this page
Edit on GitHub
  1. Chapters
  2. Debate

From debates to prompts

Rendering a debate to a string

A prompt is a debate with some instructions and a prefix for a new response. We create it like this:

debate/prompt.py
from fvalues import F

from ice.recipes.primer.debate.utils import *


def render_debate_prompt(agent_name: str, debate: Debate, turns_left: int) -> str:
    prompt = F(
        f"""
You are {agent_name}. There are {turns_left} turns left in the debate. You are trying to win the debate using reason and evidence. Don't repeat yourself. No more than 1-2 sentences per turn.

{render_debate(debate, agent_name)}
You: "
"""
    ).strip()
    return prompt

When we apply it to the debate above, we get:

>>> print(render_debate_prompt("Bob", my_debate, 5))
You are Bob. There are 5 turns left in the debate. You are trying to win the debate using reason and evidence. Don't repeat yourself. No more than 1-2 sentences per turn.

Alice: "I think we should legalize all drugs."
You: "I'm against."
Alice: "The war on drugs has been a failure. It's time to try something new."
You: "
PreviousRepresenting debatesNextThe debate recipe

Last updated 2 years ago