Coverage for mindsdb / integrations / handlers / litellm_handler / settings.py: 100%

30 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-21 00:36 +0000

1from typing import List, Optional, Union, Dict 

2from pydantic import BaseModel, Extra 

3 

4 

5class CompletionParameters(BaseModel): 

6 model: str # The model to be used for the API call. 

7 prompt_template: Optional[str] = None # Template for the prompt to be used. 

8 

9 # Optional OpenAI params: see https://platform.openai.com/docs/api-reference/chat/runs 

10 tool_choice: Optional[str] = None # Specific tool to be used, if applicable. 

11 

12 timeout: Optional[Union[float, int]] = None # Timeout for the API request. 

13 temperature: Optional[float] = None # Controls randomness: higher value means more random responses. 

14 top_p: Optional[float] = None # Nucleus sampling: higher value means more diverse responses. 

15 n: Optional[int] = None # Number of completions to generate for each prompt. 

16 stream: Optional[bool] = None # Whether to stream responses or not. 

17 stop: Optional[str] = None # Sequence at which the model should stop generating further tokens. 

18 max_tokens: Optional[float] = None # Maximum number of tokens to generate in each completion. 

19 presence_penalty: Optional[float] = None # Penalty for new tokens based on their existing presence in the text. 

20 frequency_penalty: Optional[float] = None # Penalty for new tokens based on their frequency in the text. 

21 logit_bias: Optional[Dict] = None # Adjusts the likelihood of specified tokens appearing in the completion. 

22 user: Optional[str] = None # Identifier for the end-user, for usage tracking. 

23 

24 # openai v1.0+ new params 

25 response_format: Optional[Dict] = None # Format of the response, if specific formatting is required. 

26 seed: Optional[int] = None # Random seed for deterministic completions. 

27 tools: Optional[List[str]] = None # List of additional tools or features to be used. 

28 tool_choice: Optional[str] = None # Specific tool to be used, if applicable. 

29 deployment_id: Optional[str] = None # Identifier for the deployment. 

30 

31 # set api_base, api_version, api_key 

32 base_url: Optional[str] = None # Base URL of the API. 

33 api_version: Optional[str] = None # Version of the API to be used. 

34 api_key: Optional[str] = None # API key for authentication. 

35 target: Optional[str] = None # the name of output column 

36 

37 class Config: 

38 extra = Extra.forbid 

39 arbitrary_types_allowed = True 

40 use_enum_values = True