code: def run_chatbot(chatbot: Chatbot) -> None:
      dialog = []
  
      print("\nYou can end the chat by typing 'bye'.\n")
  
      while (prompt := input("You> ")) != "bye":
          message = ChatMessage(role="user", content=prompt)
  
          dialog.append(message)
  
          print("\nMistral> ", end="")
  
          hook = StdOutPrintHook(chatbot.text_decoder)
  
          with chatbot.generator.register_step_hook(hook):
              response, _ = chatbot(dialog)
  
          print("\n")
  
          dialog.append(response)
  
      print("\nMistral> Bye!")
  
file_path: fairseq2/recipes/mistral/chatbot.py
imports: from argparse import ArgumentParser
  from pathlib import Path
  from typing import Optional
  import torch
  from fairseq2.assets import asset_store
  from fairseq2.generation import Chatbot, ChatMessage, SamplingSequenceGenerator, TopPSampler
  from fairseq2.generation.utils import StdOutPrintHook
  from fairseq2.models.mistral import MistralChatbot, load_mistral_config, load_mistral_model, load_mistral_tokenizer
label_desc: Use image node_id 2 for calling a global function with example usage: run_chatbot(chatbot) without return types