Skip to content

Commit 25e8da8

Browse files
committed
fixed mypy type error
1 parent f5cd110 commit 25e8da8

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

agentstack/_tools/firecrawl/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,24 +83,26 @@ def check_batch_status(job_id: str):
8383
return app.check_batch_scrape_status(job_id)
8484

8585

86-
def extract_data(urls: List[str], schema: Dict[str, Any] = None, prompt: str = None):
86+
def extract_data(urls: List[str], schema: Optional[Dict[str, Any]] = None, prompt: Optional[str] = None) -> Dict[
87+
str, Any]:
8788
"""
8889
Extract structured data from URLs using LLMs.
89-
90+
9091
Args:
9192
urls: List of URLs to extract data from
9293
schema: Optional JSON schema defining the structure of data to extract
9394
prompt: Optional natural language prompt describing the data to extract
94-
95+
9596
Returns:
9697
Dictionary containing the extracted structured data
9798
"""
98-
params = {
99-
'prompt': prompt
100-
} if prompt else {
101-
'schema': schema
102-
}
103-
99+
params: Dict[str, Any] = {}
100+
101+
if prompt is not None:
102+
params['prompt'] = prompt
103+
elif schema is not None:
104+
params['schema'] = schema
105+
104106
data = app.extract(urls, params)
105107
return data
106108

0 commit comments

Comments
 (0)