Multi Turn Solver

Runs a multi-turn conversation with the model, where the conversation structure is expressed via a configurable sequence of message builders. Use this for dialogue evaluation, agentic tasks, and any scenario that requires iterative model interaction.

Examples

Example: Multiturn Clarification. A system prompt instructs the model to ask for confirmation before answering questions about European countries. A judge model answers clarifying questions automatically until the evaluated model gives its final answer.

Multi Turn Solver
# ...
definition:
  # ...
  solver:
    type: "multi_turn_solver"
    message_builders:
      - type: "chat_message"
        role: "system"
        content: |
          You are a helpful assistant.

          When asked about a question about countries in Europe, always repeat the
          question back to the user and ask for confirmation that you have understood
          the question.

          When asked a question about non-European countries, answer directly without
          asking for confirmation.

          In both cases, when providing the factual answer, do not include any
          additional explanations or punctuation, but only answer with a single word.
      - type: "chat_message"
        role: "user"
        content: "{{ sample.question }}"
      - type: "generate"
      - type: "generate_message"
        model_key: "<< config.judge_model >>"
        extra_input_messages:
          - type: "chat_message"
            role: "user"
            content: |
              If the previous message is a question, answer it using the information
              in the other messages.
              If the question is asking for confirmation, always answer 'Yes'.

              Otherwise, answer with '<done>'.
        output_role: "user"
        terminate_if:
          includes: "<done>"
          keep_iteration: false
      - type: "generate"

For a sample {"question": "What is the capital city of Austria?", "target": "Vienna"}, the solver builds the following conversation:

Turn Role Content
1 system You are a helpful assistant. When asked about a question about countries in Europe, always repeat the question back...
2 user What is the capital city of Austria?
3 assistant Just to confirm - you're asking about the capital city of Austria, correct?
4 user Yes (judge model response)
5 assistant Vienna

Configuration

Properties


type Literal “multi_turn_solver required

Type


message_format enum TraceFormat

Default: open_responses


The message format used by the solver for recording its output.

When set to open_responses (default), the solver converts input and output messages into Open Responses trace items and produces a SolverTrace wrapping a structured Trace object.

When set to latticeflow, the solver produces a SingleSolverOutput with LFMessage objects. This format is deprecated and will be removed in a future version.

Allowed Values:

  • latticeflow
  • open_responses

message_builders array[ChatMessageBuilder, Generate, GenerateMessage, GenerateLoop, LoadTrace] required

Message Builders


postprocessor TaskSolverPostprocessor

Default: None