Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions ask_alyf/ask_alyf/toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
from ask_alyf.ask_alyf.skill_utils import get_accessible_skill_doc
from ask_alyf.ask_alyf.utils import parse_newline_list

# Frappe list filters are a list of filter rows, where each row is a list of
# scalars, e.g. [["Customer", "name", "=", "CUST-001"], ["disabled", "=", 0]].
# Typed (rather than `list[Any]`) so the generated JSON Schema gives the array
# `items` a concrete `type`, which OpenAI strict function-calling requires.
Scalar = str | int | float | bool | None
FrappeFilterList = list[list[Scalar | list[Scalar]]]


@dataclass
class ask_alyfRuntime:
Expand Down Expand Up @@ -143,7 +150,7 @@ def get_list(
self,
doctype: str,
fields: str | list[str] | None = None,
filters: dict[str, Any] | list[Any] | None = None,
filters: dict[str, Any] | FrappeFilterList | None = None,
order_by: str | None = None,
limit: int = 20,
group_by: str | None = None,
Expand Down Expand Up @@ -174,7 +181,7 @@ def get_list(
def get_count(
self,
doctype: str,
filters: dict[str, Any] | list[Any] | None = None,
filters: dict[str, Any] | FrappeFilterList | None = None,
) -> int:
"""Count documents that match the given filters.

Expand Down Expand Up @@ -211,7 +218,7 @@ def get_value(
self,
doctype: str,
fieldname: str | list[str],
filters: dict[str, Any] | list[Any] | str | None = None,
filters: dict[str, Any] | FrappeFilterList | str | None = None,
) -> Any:
"""Read one or more field values from a document.

Expand Down
Loading