Extract playground returns expected results on web. API extract returns empty.

I used the web-based extract playground to figure out prompt + URL and it is returning the expected results. However, when I copy the generated code from the playground to a python file, each API call returns an empty set.
from firecrawl import Firecrawl
from pydantic import BaseModel, Field

# Initialize the Firecrawl with your API key
app = Firecrawl(api_key='xxx')

# Define your extraction schema
class ExtractSchema(BaseModel):
lawyers: list = Field(description="The lawyers")

# Perform the extraction
data = app.extract(
urls=['www.floridabar.org/directories/find-mbr/?locType=T&locValue=miami-dade&sdx=N&eligible=Y&deceased=N&pageSize=10&pageNumber=1'],
prompt='Ensure that the first name, last name, city, state, and email are included as required fields. Wait for 5 seconds before starting the extraction.',
schema=ExtractSchema.model_json_schema()
)

print(data)
from firecrawl import Firecrawl
from pydantic import BaseModel, Field

# Initialize the Firecrawl with your API key
app = Firecrawl(api_key='xxx')

# Define your extraction schema
class ExtractSchema(BaseModel):
lawyers: list = Field(description="The lawyers")

# Perform the extraction
data = app.extract(
urls=['www.floridabar.org/directories/find-mbr/?locType=T&locValue=miami-dade&sdx=N&eligible=Y&deceased=N&pageSize=10&pageNumber=1'],
prompt='Ensure that the first name, last name, city, state, and email are included as required fields. Wait for 5 seconds before starting the extraction.',
schema=ExtractSchema.model_json_schema()
)

print(data)
3 Replies
micah.stairs
micah.stairs5w ago
Hey! This probably isn't an API vs playground issue. After all, the playground uses the API under the hood. The issue is likely that /extract is non-deterministic since it heavily relies on LLMs, which are inherently non-deterministic.
csmicfool
csmicfoolOP5w ago
Regardless of the exact cause, I've switched to /scrape
micah.stairs
micah.stairs5w ago
Great choice!

Did you find this page helpful?