r"""Defines the parameters for generating chat completions using the OpenAI API. Reference: https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html Args: temperature (float, optional): Sampling temperature to use, between :obj:`0` and :obj:`2`. Higher v
| 23 | |
| 24 | # flake8: noqa: E501 |
| 25 | class VLLMConfig(BaseConfig): |
| 26 | r"""Defines the parameters for generating chat completions using the |
| 27 | OpenAI API. |
| 28 | |
| 29 | Reference: https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html |
| 30 | |
| 31 | Args: |
| 32 | temperature (float, optional): Sampling temperature to use, between |
| 33 | :obj:`0` and :obj:`2`. Higher values make the output more random, |
| 34 | while lower values make it more focused and deterministic. |
| 35 | (default: :obj:`0.2`) |
| 36 | top_p (float, optional): An alternative to sampling with temperature, |
| 37 | called nucleus sampling, where the model considers the results of |
| 38 | the tokens with top_p probability mass. So :obj:`0.1` means only |
| 39 | the tokens comprising the top 10% probability mass are considered. |
| 40 | (default: :obj:`1.0`) |
| 41 | n (int, optional): How many chat completion choices to generate for |
| 42 | each input message. (default: :obj:`1`) |
| 43 | response_format (object, optional): An object specifying the format |
| 44 | that the model must output. Compatible with GPT-4 Turbo and all |
| 45 | GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to |
| 46 | {"type": "json_object"} enables JSON mode, which guarantees the |
| 47 | message the model generates is valid JSON. Important: when using |
| 48 | JSON mode, you must also instruct the model to produce JSON |
| 49 | yourself via a system or user message. Without this, the model |
| 50 | may generate an unending stream of whitespace until the generation |
| 51 | reaches the token limit, resulting in a long-running and seemingly |
| 52 | "stuck" request. Also note that the message content may be |
| 53 | partially cut off if finish_reason="length", which indicates the |
| 54 | generation exceeded max_tokens or the conversation exceeded the |
| 55 | max context length. |
| 56 | stream (bool, optional): If True, partial message deltas will be sent |
| 57 | as data-only server-sent events as they become available. |
| 58 | (default: :obj:`False`) |
| 59 | stop (str or list, optional): Up to :obj:`4` sequences where the API |
| 60 | will stop generating further tokens. (default: :obj:`None`) |
| 61 | max_tokens (int, optional): The maximum number of tokens to generate |
| 62 | in the chat completion. The total length of input tokens and |
| 63 | generated tokens is limited by the model's context length. |
| 64 | (default: :obj:`None`) |
| 65 | presence_penalty (float, optional): Number between :obj:`-2.0` and |
| 66 | :obj:`2.0`. Positive values penalize new tokens based on whether |
| 67 | they appear in the text so far, increasing the model's likelihood |
| 68 | to talk about new topics. See more information about frequency and |
| 69 | presence penalties. (default: :obj:`0.0`) |
| 70 | frequency_penalty (float, optional): Number between :obj:`-2.0` and |
| 71 | :obj:`2.0`. Positive values penalize new tokens based on their |
| 72 | existing frequency in the text so far, decreasing the model's |
| 73 | likelihood to repeat the same line verbatim. See more information |
| 74 | about frequency and presence penalties. (default: :obj:`0.0`) |
| 75 | logit_bias (dict, optional): Modify the likelihood of specified tokens |
| 76 | appearing in the completion. Accepts a json object that maps tokens |
| 77 | (specified by their token ID in the tokenizer) to an associated |
| 78 | bias value from :obj:`-100` to :obj:`100`. Mathematically, the bias |
| 79 | is added to the logits generated by the model prior to sampling. |
| 80 | The exact effect will vary per model, but values between:obj:` -1` |
| 81 | and :obj:`1` should decrease or increase likelihood of selection; |
| 82 | values like :obj:`-100` or :obj:`100` should result in a ban or |
no test coverage detected