class_docstr: Multi-turn conversational pipeline.
  
  Example:
  
  ```python
  >>> from transformers import pipeline, Conversation
  # Any model with a chat template can be used in a ConversationalPipeline.
  
  >>> chatbot = pipeline(model="facebook/blenderbot-400M-distill")
  >>> # Conversation objects initialized with a string will treat it as a user message
  >>> conversation = Conversation("I'm looking for a movie - what's your favourite one?")
  >>> conversation = chatbot(conversation)
  >>> conversation.messages[-1]["content"]
  "I don't really have a favorite movie, but I do like action movies. What about you?"
  
  >>> conversation.add_message({"role": "user", "content": "That's interesting, why do you like action movies?"})
  >>> conversation = chatbot(conversation)
  >>> conversation.messages[-1]["content"]
  " I think it's just because they're so fast-paced and action-fantastic."
  ```
  
  Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)
  
  This conversational pipeline can currently be loaded from [`pipeline`] using the following task identifier:
  `"conversational"`.
  
  This pipeline can be used with any model that has a [chat
  template](https://huggingface.co/docs/transformers/chat_templating) set.
class_docstr_tok: ["Multi-turn","conversational","pipeline",".","Example",":","``","`","python",">",">",">","from","transformers","import","pipeline",",","Conversation","#","Any","model","with","a","chat","template","can","be","used","in","a","ConversationalPipeline",".",">",">",">","chatbot","=","pipeline","(","model=","''","facebook\/blenderbot-400M-distill","''",")",">",">",">","#","Conversation","objects","initialized","with","a","string","will","treat","it","as","a","user","message",">",">",">","conversation","=","Conversation","(","``","I","'m","looking","for","a","movie","-","what","'s","your","favourite","one","?","''",")",">",">",">","conversation","=","chatbot","(","conversation",")",">",">",">","conversation.messages","[","-1","]","[","``","content","''","]","''","I","do","n't","really","have","a","favorite","movie",",","but","I","do","like","action","movies",".","What","about","you","?","''",">",">",">","conversation.add_message","(","{","``","role","''",":","``","user","''",",","``","content","''",":","``","That","'s","interesting",",","why","do","you","like","action","movies","?","''","}",")",">",">",">","conversation","=","chatbot","(","conversation",")",">",">",">","conversation.messages","[","-1","]","[","``","content","''","]","''","I","think","it","'s","just","because","they","'re","so","fast-paced","and","action-fantastic",".","''","``","`","Learn","more","about","the","basics","of","using","a","pipeline","in","the","[","pipeline","tutorial","]","(","..","\/pipeline_tutorial",")","This","conversational","pipeline","can","currently","be","loaded","from","[","`","pipeline","`","]","using","the","following","task","identifier",":","`","``","conversational","''","`",".","This","pipeline","can","be","used","with","any","model","that","has","a","[","chat","template","]","(","https",":","\/\/huggingface.co\/docs\/transformers\/chat_templating",")","set","."]
docstr: Generate responses for the conversation(s) given as inputs.
  
  Args:
      conversations (a [`Conversation`] or a list of [`Conversation`]):
          Conversation to generate responses for. Inputs can also be passed as a list of dictionaries with `role`
          and `content` keys - in this case, they will be converted to `Conversation` objects automatically.
          Multiple conversations in either format may be passed as a list.
      clean_up_tokenization_spaces (`bool`, *optional*, defaults to `False`):
          Whether or not to clean up the potential extra spaces in the text output.
      generate_kwargs:
          Additional keyword arguments to pass along to the generate method of the model (see the generate method
          corresponding to your framework [here](./model#generative-models)).
  
  Returns:
      [`Conversation`] or a list of [`Conversation`]: Conversation(s) with updated generated responses for those
      containing a new user input.
docstr_tok: ["Generate","responses","for","the","conversation","(","s",")","given","as","inputs",".","Args",":","conversations","(","a","[","`","Conversation","`","]","or","a","list","of","[","`","Conversation","`","]",")",":","Conversation","to","generate","responses","for",".","Inputs","can","also","be","passed","as","a","list","of","dictionaries","with","`","role","`","and","`","content","`","keys","-","in","this","case",",","they","will","be","converted","to","`","Conversation","`","objects","automatically",".","Multiple","conversations","in","either","format","may","be","passed","as","a","list",".","clean_up_tokenization_spaces","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","to","clean","up","the","potential","extra","spaces","in","the","text","output",".","generate_kwargs",":","Additional","keyword","arguments","to","pass","along","to","the","generate","method","of","the","model","(","see","the","generate","method","corresponding","to","your","framework","[","here","]","(",".\/model","#","generative-models",")",")",".","Returns",":","[","`","Conversation","`","]","or","a","list","of","[","`","Conversation","`","]",":","Conversation","(","s",")","with","updated","generated","responses","for","those","containing","a","new","user","input","."]
code: def __call__(
      self,
      conversations: Union[
          List[Dict], Conversation, List[Conversation]
      ],
      num_workers=0,
      **kwargs,
  ):
      r"""
      Generate responses for the conversation(s) given as inputs.
  
      Args:
          conversations (a [`Conversation`] or a list of [`Conversation`]):
              Conversation to generate responses for. Inputs can also be passed as a list of dictionaries with `role`
              and `content` keys - in this case, they will be converted to `Conversation` objects automatically.
              Multiple conversations in either format may be passed as a list.
          clean_up_tokenization_spaces (`bool`, *optional*, defaults to `False`):
              Whether or not to clean up the potential extra spaces in the text output.
          generate_kwargs:
              Additional keyword arguments to pass along to the generate method of the model (see the generate method
              corresponding to your framework [here](./model#generative-models)).
  
      Returns:
          [`Conversation`] or a list of [`Conversation`]: Conversation(s) with updated generated responses for those
          containing a new user input.
      """
      # XXX: num_workers==0 is required to be backward compatible
      # Otherwise the threads will require a Conversation copy.
      # This will definitely hinder performance on GPU, but has to be opted
      # in because of this BC change.
      if isinstance(conversations, list) and isinstance(
          conversations[0], dict
      ):
          conversations = Conversation(conversations)
      elif isinstance(conversations, list) and isinstance(
          conversations[0], list
      ):
          conversations = [Conversation(conv) for conv in conversations]
      outputs = super().__call__(
          conversations, num_workers=num_workers, **kwargs
      )
      if isinstance(outputs, list) and len(outputs) == 1:
          return outputs[0]
      return outputs
  
imports: import uuid
  from typing import Any, Dict, List, Union
  from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging
  from .base import PIPELINE_INIT_ARGS, Pipeline
label_desc: Use image node_id 3 for calling the ConversationalPipeline obj's underlying member method code with example usage: obj.__call__(conversations, num_workers) and returns: outputs, outputs