Skip to main content
Send a prompt to the LLM and get a structured response about the current page.
result = await page.prompt(
    "What is the main heading on this page?",
    schema={"heading": {"type": "string"}},
)
print(result)
ParameterTypeRequiredDescription
promptstr / stringYesThe question or instruction to send to the LLM about the current page.
schemadict / Record<string, unknown>NoJSON schema that constrains the response shape. When provided, the LLM returns data matching this schema.
modeldict / Record<string, unknown>NoLLM model configuration override. Use to select a different model for this call.
Returns dict | list | str | None / Record<string, unknown> | unknown[] | string | null.