signatures
Class info¶
🛈 DocStrings¶
Signature utils.
create_bound_callable
¶
create_bound_callable(
original_callable: Callable[..., Any],
by_name: dict[str, Any] | None = None,
by_type: dict[type, Any] | None = None,
bind_kwargs: bool = False,
) -> Callable[..., Awaitable[Any]]
Create a wrapper that pre-binds parameters by name or type.
Parameters are bound by their position in the function signature. Only positional and positional-or-keyword parameters can be bound by default. If bind_kwargs=True, keyword-only parameters can also be bound using the same by_name/by_type logic. Binding by name takes priority over binding by type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
original_callable
|
Callable[..., Any]
|
The original callable that may need parameter binding |
required |
by_name
|
dict[str, Any] | None
|
Parameters to bind by exact parameter name |
None
|
by_type
|
dict[type, Any] | None
|
Parameters to bind by parameter type annotation |
None
|
bind_kwargs
|
bool
|
Whether to also bind keyword-only parameters |
False
|
Returns:
| Type | Description |
|---|---|
Callable[..., Awaitable[Any]]
|
New callable with parameters pre-bound and proper introspection |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the callable's signature cannot be inspected |
Source code in src/llmling_agent/utils/signatures.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
create_modified_signature
¶
create_modified_signature(
fn_or_sig: Callable[..., Any] | Signature,
*,
remove: str | list[str] | None = None,
inject: dict[str, type] | None = None
) -> Signature
Create a modified signature by removing specified parameters / injecting new ones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn_or_sig
|
Callable[..., Any] | Signature
|
The function or signature to modify. |
required |
remove
|
str | list[str] | None
|
The parameter(s) to remove. |
None
|
inject
|
dict[str, type] | None
|
The parameter(s) to inject. |
None
|
Returns:
| Type | Description |
|---|---|
Signature
|
The modified signature. |
Source code in src/llmling_agent/utils/signatures.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |