Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Make num_of_elements optional in LLMProprtyExtractor
  • Loading branch information
austin-aryn-ai committed Feb 14, 2025
commit fe6d7783cabb9d2fb6de876672b07e5379e883b4
5 changes: 3 additions & 2 deletions lib/sycamore/sycamore/transforms/extract_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __init__(
llm: LLM,
schema_name: Optional[str] = None,
schema: Optional[Union[dict[str, str], Schema]] = None,
num_of_elements: int = 10,
num_of_elements: Optional[int] = None,
prompt_formatter: Callable[[list[Element]], str] = element_list_formatter,
):
super().__init__()
Expand Down Expand Up @@ -221,7 +221,8 @@ def as_llm_map(self, child: Optional[Node], **kwargs) -> Node:

if self._schema_name is not None:
prompt = prompt.set(entity=self._schema_name)
prompt = prompt.set(num_elements=self._num_of_elements)
if self._num_of_elements is not None:
prompt = prompt.set(num_elements=self._num_of_elements)
if self._prompt_formatter is not element_list_formatter:
prompt = prompt.set(prompt_formatter=self._prompt_formatter)

Expand Down