utils
Class info¶
🛈 DocStrings¶
Utilities for working with prompt functions.
extract_function_info
¶
extract_function_info(
fn_or_path: str | Callable[..., Any],
completions: Mapping[str, CompletionFunction | str] | None = None,
) -> tuple[list[PromptParameter], str]
Extract parameter info and description from a function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn_or_path
|
str | Callable[..., Any]
|
Function or import path to analyze |
required |
completions
|
Mapping[str, CompletionFunction | str] | None
|
Optional mapping of parameter names to completion functions or their import paths |
None
|
Returns:
| Type | Description |
|---|---|
tuple[list[PromptParameter], str]
|
Tuple of (list of argument definitions, function description) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If function cannot be imported or analyzed |
Source code in src/llmling/prompts/utils.py
get_description_completions
¶
get_description_completions(arg: PromptParameter, current_value: str) -> list[str]
Get completions from argument description.
Source code in src/llmling/prompts/utils.py
get_type_completions
¶
get_type_completions(arg: PromptParameter, current_value: str) -> list[str]
Get completions based on argument type.