# Controlling bos, eos, etc in api-inference

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcontrolling-bos-eos-etc-in-api-inference%2F5701%3E%5C
**Category:** Beginners\
**Created:** [April 22, 2021, 7:59pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcontrolling-bos-eos-etc-in-api-inference%2F5701 "2021-04-22T19:59:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cristivlad](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cristivlad/32/1542_2.png) [@cristivlad](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcristivlad)%5C
**Post date:** [April 22, 2021, 7:59pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcontrolling-bos-eos-etc-in-api-inference%2F5701%2F1 "2021-04-22T19:59:26Z")

</div>

Is there a way to control the beginning of sentence, end of sentence tokens through the inference api? I could not find it in the documentation.

---

<div class="post-metadata">

**Author:** ![Narsil](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/narsil/32/40029_2.png) [@Narsil](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNarsil)%5C
**Post date:** [May 4, 2021, 3:18pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcontrolling-bos-eos-etc-in-api-inference%2F5701%2F2 "2021-05-04T15:18:19Z")

</div>

Hi @cristivlad ,

Currently there is no way to override those within the API.  
We are adding and `end_sequence` parameter to enable stopping the generation when using prompt-like generation (for GPT-Neo for instance).

For BOS, what did you want to do with it ?

Cheers,  
Nicolas

---

<div class="post-metadata">

**Author:** ![louis030195](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/louis030195/32/3591_2.png) [@louis030195](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flouis030195)%5C
**Post date:** [January 12, 2022, 8:33pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcontrolling-bos-eos-etc-in-api-inference%2F5701%2F3 "2022-01-12T20:33:13Z")

</div>

I tried **end\_sequence** and indeed works, I would suggest updating the [doc](/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fdocs%2Fpython%2Fhtml%2Fdetailed_parameters.html%23text-generation-task)%2C thanks in any case! 🙂

```python
    data = json.dumps(
        {
            "inputs": "1+1=2\n2+2=",
            "parameters": {
                "max_length": 50,
                "num_return_sequences": 1,
                "return_text": False,
                "return_full_text": False,
                "do_sample": True,
                "top_k": 50,
                "top_p": 0.95,
                "end_sequence": "\n"
            },
            "options": {
                "wait_for_model": True,
            },
        }
    )

```
