Skip to content

Use Conversational Interfaces

The Conversational interface tells the QType UI to render a chat instead of just an "execute flow" button.

Note that, if you set the interface to Conversational, QType will validate that the input and outputs are of type ChatMessage. If you set the interface to Conversational and this is not true, and error will be thrown.

QType YAML

flows:
  - type: Flow
    id: simple_chat_example
    interface:
      type: Conversational
    variables:
      - id: user_message
        type: ChatMessage
      - id: response_message
        type: ChatMessage
    inputs:
      - user_message
    outputs:
      - response_message

Web UI

When you serve a conversational flow with qtype serve, the UI renders a chat interface:

Chat interface showing conversation with memory

Explanation

  • interface.type: Conversational: Configures the flow to be served as a chat interface in the web UI rather than a simple form
  • ChatMessage type: Domain type that structures messages with content blocks, role metadata, and conversation context
  • Reset on refresh: Starting a new browser session creates a new conversation with fresh memory

Complete Example

id: 02_conversational_chat
description: A simple stateful chat flow with AWS Bedrock
models:
  - type: Model
    id: nova_lite
    provider: aws-bedrock
    model_id: amazon.nova-lite-v1:0
    inference_params:
      temperature: 0.7
      max_tokens: 512
memories:
  - id: chat_memory
    token_limit: 10000
flows:
  - type: Flow
    id: simple_chat_example
    interface:
      type: Conversational
    variables:
      - id: user_message
        type: ChatMessage
      - id: response_message
        type: ChatMessage
    inputs:
      - user_message
    outputs:
      - response_message
    steps:
      - id: llm_inference_step
        type: LLMInference
        model: nova_lite
        system_message: "You are a helpful assistant."
        memory: chat_memory
        inputs:
          - user_message
        outputs:
          - response_message

Start the chat interface:

qtype serve 02_conversational_chat.qtype.yaml

Visit http://localhost:8000/ui to interact with the chatbot.

See Also