Skip to content

Commit 3b9e64f

Browse files
feat(api): api update
1 parent 9f486e7 commit 3b9e64f

3 files changed

Lines changed: 45 additions & 6 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: 29
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d60fed3d26479d1ee76b77df8415390504542522e7188792a23bf77b9f37ed63.yml
3-
openapi_spec_hash: 263672c59d9b01c50f7d2307fbd82ec0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-adab8df19dce27396e4a0e698287f083e1f932e63b85fd8dd4d54f80f0e0b5a8.yml
3+
openapi_spec_hash: 717fea46f446ff97bad627f200963fd7
44
config_hash: ff35e224e809656528c44163aa41bebd

‎src/context/dev/resources/web.py‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,8 +1949,24 @@ def web_scrape_md(
19491949
extra_body: Body | None = None,
19501950
timeout: float | httpx.Timeout | None | NotGiven = not_given,
19511951
) -> WebWebScrapeMdResponse:
1952-
"""
1953-
Scrapes the given URL into LLM usable Markdown.
1952+
"""Scrapes the given URL into LLM usable Markdown.
1953+
1954+
Inspect key_metadata on JSON
1955+
responses from a recognized API key; use error_code to distinguish stable
1956+
failure categories.
1957+
1958+
### Billing & errors
1959+
1960+
| HTTP status | Billed? | Meaning |
1961+
| ----------- | -------------- | ---------------------------------------------------------------------------------------- |
1962+
| 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing |
1963+
| 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
1964+
| 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
1965+
| 404 | No | Target page returned or fingerprinted as not found |
1966+
| 408 | No | Request timed out |
1967+
| 415 | No | Unsupported content type |
1968+
| 429 | No | Per-minute rate limit exceeded; honor Retry-After |
1969+
| 500 | No | Internal error |
19541970
19551971
Args:
19561972
url: Full URL to scrape into LLM usable Markdown (must include http:// or https://
@@ -4007,8 +4023,24 @@ async def web_scrape_md(
40074023
extra_body: Body | None = None,
40084024
timeout: float | httpx.Timeout | None | NotGiven = not_given,
40094025
) -> WebWebScrapeMdResponse:
4010-
"""
4011-
Scrapes the given URL into LLM usable Markdown.
4026+
"""Scrapes the given URL into LLM usable Markdown.
4027+
4028+
Inspect key_metadata on JSON
4029+
responses from a recognized API key; use error_code to distinguish stable
4030+
failure categories.
4031+
4032+
### Billing & errors
4033+
4034+
| HTTP status | Billed? | Meaning |
4035+
| ----------- | -------------- | ---------------------------------------------------------------------------------------- |
4036+
| 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing |
4037+
| 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
4038+
| 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
4039+
| 404 | No | Target page returned or fingerprinted as not found |
4040+
| 408 | No | Request timed out |
4041+
| 415 | No | Unsupported content type |
4042+
| 429 | No | Per-minute rate limit exceeded; honor Retry-After |
4043+
| 500 | No | Internal error |
40124044
40134045
Args:
40144046
url: Full URL to scrape into LLM usable Markdown (must include http:// or https://

‎src/context/dev/types/web_web_scrape_md_response.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ class KeyMetadata(BaseModel):
102102

103103

104104
class WebWebScrapeMdResponse(BaseModel):
105+
content_length: int = FieldInfo(alias="contentLength")
106+
"""UTF-8 byte length of the returned Markdown.
107+
108+
Use 0 to identify an empty result and compare small values against your
109+
workload's minimum useful-content threshold.
110+
"""
111+
105112
markdown: str
106113
"""Page content converted to GitHub Flavored Markdown"""
107114

0 commit comments

Comments
 (0)