| 
 | 1 | +---  | 
 | 2 | +sidebar_label: parameters  | 
 | 3 | +title: aixplain.base.parameters  | 
 | 4 | +---  | 
 | 5 | + | 
 | 6 | +### Parameter Objects  | 
 | 7 | + | 
 | 8 | +```python  | 
 | 9 | +@dataclass  | 
 | 10 | +class Parameter()  | 
 | 11 | +```  | 
 | 12 | + | 
 | 13 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L6)  | 
 | 14 | + | 
 | 15 | +A class representing a single parameter with its properties.  | 
 | 16 | + | 
 | 17 | +**Attributes**:  | 
 | 18 | + | 
 | 19 | +- `name` _str_ - The name of the parameter.  | 
 | 20 | +- `required` _bool_ - Whether the parameter is required or optional.  | 
 | 21 | +- `value` _Optional[Any]_ - The value of the parameter. Defaults to None.  | 
 | 22 | + | 
 | 23 | +### BaseParameters Objects  | 
 | 24 | + | 
 | 25 | +```python  | 
 | 26 | +class BaseParameters()  | 
 | 27 | +```  | 
 | 28 | + | 
 | 29 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L19)  | 
 | 30 | + | 
 | 31 | +A base class for managing a collection of parameters.  | 
 | 32 | + | 
 | 33 | +This class provides functionality to store, access, and manipulate parameters  | 
 | 34 | +in a structured way. Parameters can be accessed using attribute syntax or  | 
 | 35 | +dictionary-style access.  | 
 | 36 | + | 
 | 37 | +**Attributes**:  | 
 | 38 | + | 
 | 39 | +- `parameters` _Dict[str, Parameter]_ - Dictionary storing Parameter objects.  | 
 | 40 | + | 
 | 41 | +#### \_\_init\_\_  | 
 | 42 | + | 
 | 43 | +```python  | 
 | 44 | +def __init__() -> None  | 
 | 45 | +```  | 
 | 46 | + | 
 | 47 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L29)  | 
 | 48 | + | 
 | 49 | +Initialize the BaseParameters class.  | 
 | 50 | + | 
 | 51 | +The initialization creates an empty dictionary to store parameters.  | 
 | 52 | + | 
 | 53 | +#### get\_parameter  | 
 | 54 | + | 
 | 55 | +```python  | 
 | 56 | +def get_parameter(name: str) -> Optional[Parameter]  | 
 | 57 | +```  | 
 | 58 | + | 
 | 59 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L36)  | 
 | 60 | + | 
 | 61 | +Get a parameter by name.  | 
 | 62 | + | 
 | 63 | +**Arguments**:  | 
 | 64 | + | 
 | 65 | +- `name` _str_ - Name of the parameter  | 
 | 66 | +    | 
 | 67 | + | 
 | 68 | +**Returns**:  | 
 | 69 | + | 
 | 70 | +- `Optional[Parameter]` - Parameter object if found, None otherwise  | 
 | 71 | + | 
 | 72 | +#### to\_dict  | 
 | 73 | + | 
 | 74 | +```python  | 
 | 75 | +def to_dict() -> Dict[str, Dict[str, Any]]  | 
 | 76 | +```  | 
 | 77 | + | 
 | 78 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L47)  | 
 | 79 | + | 
 | 80 | +Convert parameters back to dictionary format.  | 
 | 81 | + | 
 | 82 | +**Returns**:  | 
 | 83 | + | 
 | 84 | +  Dict[str, Dict[str, Any]]: Dictionary representation of parameters  | 
 | 85 | + | 
 | 86 | +#### to\_list  | 
 | 87 | + | 
 | 88 | +```python  | 
 | 89 | +def to_list() -> List[str]  | 
 | 90 | +```  | 
 | 91 | + | 
 | 92 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L55)  | 
 | 93 | + | 
 | 94 | +Convert parameters to a list format.  | 
 | 95 | + | 
 | 96 | +This method creates a list of dictionaries containing the name and value  | 
 | 97 | +of each parameter that has a value set.  | 
 | 98 | + | 
 | 99 | +**Returns**:  | 
 | 100 | + | 
 | 101 | +- `List[str]` - A list of dictionaries, each containing 'name' and 'value'  | 
 | 102 | +  keys for parameters that have values set.  | 
 | 103 | + | 
 | 104 | +#### \_\_str\_\_  | 
 | 105 | + | 
 | 106 | +```python  | 
 | 107 | +def __str__() -> str  | 
 | 108 | +```  | 
 | 109 | + | 
 | 110 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L67)  | 
 | 111 | + | 
 | 112 | +Create a pretty string representation of the parameters.  | 
 | 113 | + | 
 | 114 | +**Returns**:  | 
 | 115 | + | 
 | 116 | +- `str` - Formatted string showing all parameters  | 
 | 117 | + | 
 | 118 | +#### \_\_setattr\_\_  | 
 | 119 | + | 
 | 120 | +```python  | 
 | 121 | +def __setattr__(name: str, value: Any) -> None  | 
 | 122 | +```  | 
 | 123 | + | 
 | 124 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L84)  | 
 | 125 | + | 
 | 126 | +Allow setting parameters using attribute syntax.  | 
 | 127 | + | 
 | 128 | +This special method enables setting parameter values using attribute syntax  | 
 | 129 | +(e.g., params.text = "Hello"). It only works for parameters that have been  | 
 | 130 | +previously defined.  | 
 | 131 | + | 
 | 132 | +**Arguments**:  | 
 | 133 | + | 
 | 134 | +- `name` _str_ - Name of the parameter to set.  | 
 | 135 | +- `value` _Any_ - Value to assign to the parameter.  | 
 | 136 | +    | 
 | 137 | + | 
 | 138 | +**Raises**:  | 
 | 139 | + | 
 | 140 | +- `AttributeError` - If attempting to set a parameter that hasn't been defined.  | 
 | 141 | + | 
 | 142 | +#### \_\_getattr\_\_  | 
 | 143 | + | 
 | 144 | +```python  | 
 | 145 | +def __getattr__(name: str) -> Any  | 
 | 146 | +```  | 
 | 147 | + | 
 | 148 | +[[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/base/parameters.py#L107)  | 
 | 149 | + | 
 | 150 | +Allow getting parameter values using attribute syntax.  | 
 | 151 | + | 
 | 152 | +This special method enables accessing parameter values using attribute syntax  | 
 | 153 | +(e.g., params.text). It only works for parameters that have been previously  | 
 | 154 | +defined.  | 
 | 155 | + | 
 | 156 | +**Arguments**:  | 
 | 157 | + | 
 | 158 | +- `name` _str_ - Name of the parameter to access.  | 
 | 159 | +    | 
 | 160 | + | 
 | 161 | +**Returns**:  | 
 | 162 | + | 
 | 163 | +- `Any` - The value of the requested parameter.  | 
 | 164 | +    | 
 | 165 | + | 
 | 166 | +**Raises**:  | 
 | 167 | + | 
 | 168 | +- `AttributeError` - If attempting to access a parameter that hasn't been defined.  | 
 | 169 | + | 
0 commit comments