TextGenerationPipeline: ValueError: `return_text` is mutually exclusive with `return_full_text`
Author: lupreCSC
Pull request: no
Labels: name: Core: Pipeline

name: Usage

name: bug

### System Info

- `transformers` version: 4.44.2
- Platform: Linux-6.8.0-40-generic-x86_64-with-glibc2.35
- Python version: 3.11.4
- Huggingface_hub version: 0.24.6
- Safetensors version: 0.4.5
- Accelerate version: 0.24.0
- Accelerate config:    not found
- PyTorch version (GPU?): 2.0.0+cu117 (False)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: no

### Who can help?

@Rocketknight1 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

```python
from transformers.pipelines import pipeline, TextGenerationPipeline
template = """


{%- for message in messages %}
    {{- message['role'] + ' ' + message['content'] }}
{%- endfor %}
    assistant
"""

model_name = "TurkuNLP/gpt3-finnish-small"
model_pipeline: TextGenerationPipeline = pipeline(model=model_name, framework="pt", task="text-generation")
model_pipeline.tokenizer.chat_template = template

messages = [{"role": "user", "content": "Mitä Suomen paras kaupunki on?"}]
output = model_pipeline(messages, return_text=True, return_full_text=False, do_sample=True, max_new_tokens=10, num_return_sequences=2)
print(output)
```

(Nevermind that this template for this model doesn't really make sense).
The above raises
```
File .../transformers/pipelines/text_generation.py:174, in TextGenerationPipeline._sanitize_parameters(self, return_full_text, return_tensors, return_text, return_type, clean_up_tokenization_spaces, prefix, handle_long_generation, stop_sequence, truncation, max_length, **generate_kwargs)
    172 if return_full_text is not None and return_type is None:
    173     if return_text is not None:
--> 174         raise ValueError("`return_text` is mutually exclusive with `return_full_text`")
    175     if return_tensors is not None:
    176         raise ValueError("`return_full_text` is mutually exclusive with `return_tensors`")

ValueError: `return_text` is mutually exclusive with `return_full_text`
```

Removing the `return_text=True` argument to the pipeline call returns the expected result (only the newly generated text).

### Expected behavior

The code above succeeds and returns only newly generated text, without the prompt, as specified in [the documentation](https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#transformers.TextGenerationPipeline.__call__): 

> return_text (bool, optional, defaults to True) — Whether or not to return the decoded texts in the outputs.
> return_full_text (bool, optional, defaults to True) — If set to False only added text is returned, otherwise the full text is returned. Only meaningful if return_text is set to True.

Comments:
This is definitely a bug, or at the very least incorrect documentation. Thanks for flagging it, we're investigating now!