r"""Defines the parameters for generating chat completions using OpenAI compatibility. Reference: https://openrouter.ai/docs/api-reference/parameters Args: temperature (float, optional): Sampling temperature to use, between :obj:`0` and :obj:`2`. Higher values make
| 20 | |
| 21 | |
| 22 | class OpenRouterConfig(BaseConfig): |
| 23 | r"""Defines the parameters for generating chat completions using OpenAI |
| 24 | compatibility. |
| 25 | |
| 26 | Reference: https://openrouter.ai/docs/api-reference/parameters |
| 27 | |
| 28 | Args: |
| 29 | temperature (float, optional): Sampling temperature to use, between |
| 30 | :obj:`0` and :obj:`2`. Higher values make the output more random, |
| 31 | while lower values make it more focused and deterministic. |
| 32 | (default: :obj:`None`) |
| 33 | top_p (float, optional): An alternative to sampling with temperature, |
| 34 | called nucleus sampling, where the model considers the results of |
| 35 | the tokens with top_p probability mass. So :obj:`0.1` means only |
| 36 | the tokens comprising the top 10% probability mass are considered. |
| 37 | (default: :obj:`None`) |
| 38 | n (int, optional): How many chat completion choices to generate for |
| 39 | each input message. (default: :obj:`None`) |
| 40 | response_format (object, optional): An object specifying the format |
| 41 | that the model must output. Compatible with GPT-4 Turbo and all |
| 42 | GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to |
| 43 | {"type": "json_object"} enables JSON mode, which guarantees the |
| 44 | message the model generates is valid JSON. Important: when using |
| 45 | JSON mode, you must also instruct the model to produce JSON |
| 46 | yourself via a system or user message. Without this, the model |
| 47 | may generate an unending stream of whitespace until the generation |
| 48 | reaches the token limit, resulting in a long-running and seemingly |
| 49 | "stuck" request. Also note that the message content may be |
| 50 | partially cut off if finish_reason="length", which indicates the |
| 51 | generation exceeded max_tokens or the conversation exceeded the |
| 52 | max context length. |
| 53 | stream (bool, optional): If True, partial message deltas will be sent |
| 54 | as data-only server-sent events as they become available. |
| 55 | (default: :obj:`None`) |
| 56 | stop (str or list, optional): Up to :obj:`4` sequences where the API |
| 57 | will stop generating further tokens. (default: :obj:`None`) |
| 58 | max_tokens (int, optional): The maximum number of tokens to generate |
| 59 | in the chat completion. The total length of input tokens and |
| 60 | generated tokens is limited by the model's context length. |
| 61 | (default: :obj:`None`) |
| 62 | presence_penalty (float, optional): Number between :obj:`-2.0` and |
| 63 | :obj:`2.0`. Positive values penalize new tokens based on whether |
| 64 | they appear in the text so far, increasing the model's likelihood |
| 65 | to talk about new topics. See more information about frequency and |
| 66 | presence penalties. (default: :obj:`None`) |
| 67 | frequency_penalty (float, optional): Number between :obj:`-2.0` and |
| 68 | :obj:`2.0`. Positive values penalize new tokens based on their |
| 69 | existing frequency in the text so far, decreasing the model's |
| 70 | likelihood to repeat the same line verbatim. See more information |
| 71 | about frequency and presence penalties. (default: :obj:`None`) |
| 72 | user (str, optional): A unique identifier representing your end-user, |
| 73 | which can help OpenAI to monitor and detect abuse. |
| 74 | (default: :obj:`None`) |
| 75 | tools (list[FunctionTool], optional): A list of tools the model may |
| 76 | call. Currently, only functions are supported as a tool. Use this |
| 77 | to provide a list of functions the model may generate JSON inputs |
| 78 | for. A max of 128 functions are supported. (default: :obj:`None`) |
| 79 | tool_choice (Union[dict[str, str], str], optional): Controls which (if |
no outgoing calls
no test coverage detected