Skip to content

Commit 3583e1a

Browse files
feat(api): api update
1 parent d04f479 commit 3583e1a

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 41
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7e6b2353ee8631f506bd8ef7657f1684cddf84805c01d89c691d7f98c42127f7.yml
3-
openapi_spec_hash: b63b980d90fc9c2b896b2739a8e15a59
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-bf7ffa610bd4a02ea5bcb157521d17a041a48f78d87bf8fe8d812d3cbb87b489.yml
3+
openapi_spec_hash: 90142d96969dea44c46a01abb683c426
44
config_hash: 0fb0ceca5946298c416cec0cca5260c7

pkg/cmd/web.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var webExtract = requestflag.WithInnerFlags(cli.Command{
2121
Flags: []cli.Flag{
2222
&requestflag.Flag[map[string]any]{
2323
Name: "schema",
24-
Usage: "JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object.",
24+
Usage: "JSON Schema for the returned data object. Image fields such as `image_urls` or `product_photos` automatically make page image references available to extraction, so product data and photos can be returned in one call. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object.",
2525
Required: true,
2626
BodyPath: "schema",
2727
},
@@ -31,6 +31,11 @@ var webExtract = requestflag.WithInnerFlags(cli.Command{
3131
Required: true,
3232
BodyPath: "url",
3333
},
34+
&requestflag.Flag[[]map[string]any]{
35+
Name: "action",
36+
Usage: "Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms.",
37+
BodyPath: "actions",
38+
},
3439
&requestflag.Flag[bool]{
3540
Name: "fact-check",
3641
Usage: "When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source.",
@@ -84,7 +89,7 @@ var webExtract = requestflag.WithInnerFlags(cli.Command{
8489
},
8590
&requestflag.Flag[int64]{
8691
Name: "stop-after-ms",
87-
Usage: "Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s).",
92+
Usage: "Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are provided.",
8893
Default: 80000,
8994
BodyPath: "stopAfterMs",
9095
},

pkg/cmd/web_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func TestWebExtract(t *testing.T) {
1818
"web", "extract",
1919
"--schema", "{type: bar, properties: bar, required: bar, additionalProperties: bar}",
2020
"--url", "https://example.com",
21+
"--action", "{do: wait, timeMs: 0}",
2122
"--fact-check=true",
2223
"--follow-subdomains=true",
2324
"--include-frames=true",
@@ -46,6 +47,7 @@ func TestWebExtract(t *testing.T) {
4647
"web", "extract",
4748
"--schema", "{type: bar, properties: bar, required: bar, additionalProperties: bar}",
4849
"--url", "https://example.com",
50+
"--action", "{do: wait, timeMs: 0}",
4951
"--fact-check=true",
5052
"--follow-subdomains=true",
5153
"--include-frames=true",
@@ -74,6 +76,9 @@ func TestWebExtract(t *testing.T) {
7476
" required: bar\n" +
7577
" additionalProperties: bar\n" +
7678
"url: https://example.com\n" +
79+
"actions:\n" +
80+
" - do: wait\n" +
81+
" timeMs: 0\n" +
7782
"factCheck: true\n" +
7883
"followSubdomains: true\n" +
7984
"includeFrames: true\n" +

0 commit comments

Comments
 (0)