(client: OpenAI)
| 146 | |
| 147 | |
| 148 | def test_stop(client: OpenAI): |
| 149 | response = client.completions.create( |
| 150 | model="", |
| 151 | prompt=abc_prompt, |
| 152 | max_tokens=20, |
| 153 | temperature=0.0, |
| 154 | stop=["C"], |
| 155 | ) |
| 156 | |
| 157 | assert response.choices[0].text == " A B " |
| 158 | |
| 159 | # this is an interesting case because it adds a stop string close to, |
| 160 | # but not at, the token limit, so the scheduler finished the sequence |
| 161 | # but the model yet hasn't. have had bugs here before regarding block |
| 162 | # freeing. |
| 163 | response = client.completions.create( |
| 164 | model="", |
| 165 | prompt=abc_prompt, |
| 166 | max_tokens=10, |
| 167 | temperature=0.0, |
| 168 | stop=["I"], |
| 169 | ) |
| 170 | |
| 171 | assert response.choices[0].text == " A B C D E F G H " |
| 172 | |
| 173 | |
| 174 | def make_messages(word: str): |
nothing calls this directly
no outgoing calls
no test coverage detected