Test n parameter for multiple completions
(client)
| 41 | |
| 42 | |
| 43 | def test_n_parameter(client): |
| 44 | """Test n parameter for multiple completions""" |
| 45 | n = 3 |
| 46 | response = client.chat.completions.create( |
| 47 | model=TEST_MODEL, |
| 48 | messages=[ |
| 49 | {"role": "user", "content": "Write a one-line joke"} |
| 50 | ], |
| 51 | n=n, |
| 52 | temperature=0.8, |
| 53 | max_tokens=50 |
| 54 | ) |
| 55 | |
| 56 | assert len(response.choices) == n |
| 57 | # Check all responses are different (with high temperature) |
| 58 | contents = [choice.message.content for choice in response.choices] |
| 59 | assert len(set(contents)) > 1 # At least some different responses |
| 60 | |
| 61 | |
| 62 | def test_approach_prefix(client): |