class_docstr: Initialize a new Inference Client.
  
  [`InferenceClient`] aims to provide a unified experience to perform inference. The client can be used
  seamlessly with either the (free) Inference API or self-hosted Inference Endpoints.
  
  Args:
      model (`str`, `optional`):
          The model to run inference with. Can be a model id hosted on the Hugging Face Hub, e.g. `bigcode/starcoder`
          or a URL to a deployed Inference Endpoint. Defaults to None, in which case a recommended model is
          automatically selected for the task.
      token (`str`, *optional*):
          Hugging Face token. Will default to the locally saved token. Pass `token=False` if you don't want to send
          your token to the server.
      timeout (`float`, `optional`):
          The maximum number of seconds to wait for a response from the server. Loading a new model in Inference
          API can take up to several minutes. Defaults to None, meaning it will loop until the server is available.
      headers (`Dict[str, str]`, `optional`):
          Additional headers to send to the server. By default only the authorization and user-agent headers are sent.
          Values in this dictionary will override the default values.
      cookies (`Dict[str, str]`, `optional`):
          Additional cookies to send to the server.
docstr: Generate conversational responses based on the given input text (i.e. chat with the API).
  
  Args:
      text (`str`):
          The last input from the user in the conversation.
      generated_responses (`List[str]`, *optional*):
          A list of strings corresponding to the earlier replies from the model. Defaults to None.
      past_user_inputs (`List[str]`, *optional*):
          A list of strings corresponding to the earlier replies from the user. Should be the same length as
          `generated_responses`. Defaults to None.
      parameters (`Dict[str, Any]`, *optional*):
          Additional parameters for the conversational task. Defaults to None. For more details about the available
          parameters, please refer to [this page](https://huggingface.co/docs/api-inference/detailed_parameters#conversational-task)
      model (`str`, *optional*):
          The model to use for the conversational task. Can be a model ID hosted on the Hugging Face Hub or a URL to
          a deployed Inference Endpoint. If not provided, the default recommended conversational model will be used.
          Defaults to None.
  
  Returns:
      `Dict`: The generated conversational output.
  
  Raises:
      [`InferenceTimeoutError`]:
          If the model is unavailable or the request times out.
      `HTTPError`:
          If the request fails with an HTTP error status code other than HTTP 503.
  
  Example:
  ```py
  >>> from huggingface_hub import InferenceClient
  >>> client = InferenceClient()
  >>> output = client.conversational("Hi, who are you?")
  >>> output
  {'generated_text': 'I am the one who knocks.', 'conversation': {'generated_responses': ['I am the one who knocks.'], 'past_user_inputs': ['Hi, who are you?']}, 'warnings': ['Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.']}
  >>> client.conversational(
  ...     "Wow, that's scary!",
  ...     generated_responses=output["conversation"]["generated_responses"],
  ...     past_user_inputs=output["conversation"]["past_user_inputs"],
  ... )
  ```
docstr_tok: ["Generate","conversational","responses","based","on","the","given","input","text","(","i.e",".","chat","with","the","API",")",".","Args",":","text","(","`","str","`",")",":","The","last","input","from","the","user","in","the","conversation",".","generated_responses","(","`","List","[","str","]","`",",","*","optional","*",")",":","A","list","of","strings","corresponding","to","the","earlier","replies","from","the","model",".","Defaults","to","None",".","past_user_inputs","(","`","List","[","str","]","`",",","*","optional","*",")",":","A","list","of","strings","corresponding","to","the","earlier","replies","from","the","user",".","Should","be","the","same","length","as","`","generated_responses","`",".","Defaults","to","None",".","parameters","(","`","Dict","[","str",",","Any","]","`",",","*","optional","*",")",":","Additional","parameters","for","the","conversational","task",".","Defaults","to","None",".","For","more","details","about","the","available","parameters",",","please","refer","to","[","this","page","]","(","https",":","\/\/huggingface.co\/docs\/api-inference\/detailed_parameters","#","conversational-task",")","model","(","`","str","`",",","*","optional","*",")",":","The","model","to","use","for","the","conversational","task",".","Can","be","a","model","ID","hosted","on","the","Hugging","Face","Hub","or","a","URL","to","a","deployed","Inference","Endpoint",".","If","not","provided",",","the","default","recommended","conversational","model","will","be","used",".","Defaults","to","None",".","Returns",":","`","Dict","`",":","The","generated","conversational","output",".","Raises",":","[","`","InferenceTimeoutError","`","]",":","If","the","model","is","unavailable","or","the","request","times","out",".","`","HTTPError","`",":","If","the","request","fails","with","an","HTTP","error","status","code","other","than","HTTP","503",".","Example",":","``","`","py",">",">",">","from","huggingface_hub","import","InferenceClient",">",">",">","client","=","InferenceClient","(",")",">",">",">","output","=","client.conversational","(","``","Hi",",","who","are","you","?","''",")",">",">",">","output","{","'generated_text","'",":","'","I","am","the","one","who","knocks",".","'",",","'conversation","'",":","{","'generated_responses","'",":","[","'","I","am","the","one","who","knocks",".","'","]",",","'past_user_inputs","'",":","[","'Hi",",","who","are","you","?","'","]","}",",","'warnings","'",":","[","'Setting","`","pad_token_id","`","to","`","eos_token_id","`",":50256","for","open-end","generation",".","'","]","}",">",">",">","client.conversational","(","...","``","Wow",",","that","'s","scary","!","``",",","...","generated_responses=output","[","``","conversation","''","]","[","``","generated_responses","''","]",",","...","past_user_inputs=output","[","``","conversation","''","]","[","``","past_user_inputs","''","]",",","...",")","``","`"]
code: def conversational(
      self,
      text: str,
      generated_responses: Optional[List[str]] = None,
      past_user_inputs: Optional[List[str]] = None,
      *,
      parameters: Optional[Dict[str, Any]] = None,
      model: Optional[str] = None,
  ) -> ConversationalOutput:
      """
      Generate conversational responses based on the given input text (i.e. chat with the API).
  
      Args:
          text (`str`):
              The last input from the user in the conversation.
          generated_responses (`List[str]`, *optional*):
              A list of strings corresponding to the earlier replies from the model. Defaults to None.
          past_user_inputs (`List[str]`, *optional*):
              A list of strings corresponding to the earlier replies from the user. Should be the same length as
              `generated_responses`. Defaults to None.
          parameters (`Dict[str, Any]`, *optional*):
              Additional parameters for the conversational task. Defaults to None. For more details about the available
              parameters, please refer to [this page](https://huggingface.co/docs/api-inference/detailed_parameters#conversational-task)
          model (`str`, *optional*):
              The model to use for the conversational task. Can be a model ID hosted on the Hugging Face Hub or a URL to
              a deployed Inference Endpoint. If not provided, the default recommended conversational model will be used.
              Defaults to None.
  
      Returns:
          `Dict`: The generated conversational output.
  
      Raises:
          [`InferenceTimeoutError`]:
              If the model is unavailable or the request times out.
          `HTTPError`:
              If the request fails with an HTTP error status code other than HTTP 503.
  
      Example:
      ```py
      >>> from huggingface_hub import InferenceClient
      >>> client = InferenceClient()
      >>> output = client.conversational("Hi, who are you?")
      >>> output
      {'generated_text': 'I am the one who knocks.', 'conversation': {'generated_responses': ['I am the one who knocks.'], 'past_user_inputs': ['Hi, who are you?']}, 'warnings': ['Setting `pad_token_id` to `eos_token_id`:50256 for open-end generation.']}
      >>> client.conversational(
      ...     "Wow, that's scary!",
      ...     generated_responses=output["conversation"]["generated_responses"],
      ...     past_user_inputs=output["conversation"]["past_user_inputs"],
      ... )
      ```
      """
      payload: Dict[str, Any] = {"inputs": {"text": text}}
      if generated_responses is not None:
          payload["inputs"]["generated_responses"] = generated_responses
      if past_user_inputs is not None:
          payload["inputs"]["past_user_inputs"] = past_user_inputs
      if parameters is not None:
          payload["parameters"] = parameters
      response = self.post(
          json=payload, model=model, task="conversational"
      )
      return _bytes_to_dict(response)
  
imports: import logging
  import time
  import warnings
  from dataclasses import asdict
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Literal, Optional, Union, overload
  from requests import HTTPError
  from requests.structures import CaseInsensitiveDict
  from huggingface_hub.constants import ALL_INFERENCE_API_FRAMEWORKS, INFERENCE_ENDPOINT, MAIN_INFERENCE_API_FRAMEWORKS
  from huggingface_hub.inference._common import TASKS_EXPECTING_IMAGES, ContentT, InferenceTimeoutError, ModelStatus, _b64_encode, _b64_to_image, _bytes_to_dict, _bytes_to_image, _bytes_to_list, _fetch_recommended_models, _import_numpy, _is_tgi_server, _open_as_binary, _set_as_non_tgi, _stream_text_generation_response
  from huggingface_hub.inference._text_generation import TextGenerationParameters, TextGenerationRequest, TextGenerationResponse, TextGenerationStreamResponse, raise_text_generation_error
  from huggingface_hub.inference._types import ClassificationOutput, ConversationalOutput, FillMaskOutput, ImageSegmentationOutput, ObjectDetectionOutput, QuestionAnsweringOutput, TableQuestionAnsweringOutput, TokenClassificationOutput
  from huggingface_hub.utils import BadRequestError, build_hf_headers, get_session, hf_raise_for_status
label_desc: Use image node_id 8 for calling the InferenceClient obj's underlying member method code with example usage: obj.conversational(text, generated_responses, past_user_inputs) and returns: _bytes_to_dict