diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 9dea71b3..daa8df41 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: c48cf606-fb42-4a45-9c23-8f0555307828 management: - docChecksum: 517d52f6e5ee5f6149f7992be851d3ce + docChecksum: 2d465bbf278c6f507e1f998b7f615011 docVersion: 1.0.0 speakeasyVersion: 1.787.0 generationVersion: 2.914.0 - releaseVersion: 1.0.17 - configChecksum: 06db7ad82c00ff523fda2cb959e8b916 + releaseVersion: 1.0.18 + configChecksum: ccc40eafb79218be7c75f1f92ad3308f repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true persistentEdits: - generation_id: 2b85e133-0d70-4ccc-8c6c-4d1c3016e0a4 - pristine_commit_hash: 689a628f2990f756186ad847accd62feeb0ee851 - pristine_tree_hash: fbe23957f334a21e2e75afd099c079400e7c49ab + generation_id: 9eed3acb-d49b-49c8-97ba-9aa56adb56ec + pristine_commit_hash: 1d8d44bc16ba2e5c4aa04d653988e3b8b94ec450 + pristine_tree_hash: 6c831dc19a9c623836e79b74fe44617436466448 features: python: acceptHeaders: 3.0.0 @@ -1178,8 +1178,8 @@ trackedFiles: pristine_git_object: 11d6c22059efcf4e3b0d6b15b39a67678adc7a4b docs/components/chatwebsearchshorthand.mdx: id: 40f0c0a47ef4 - last_write_checksum: sha1:a469a44e9c0e07ed77fb17302c25b51a5a8b962a - pristine_git_object: 942103ab9977faed1ecf76509e94acd48cef57f7 + last_write_checksum: sha1:70479a0b9c1972263715bdf48a6b24dea2a0f1a5 + pristine_git_object: 0ddc2d3421f5f808c09c8c1d721d3ee347e2de38 docs/components/chatwebsearchshorthandtype.mdx: id: ce16c0139963 last_write_checksum: sha1:1637ce5dac9fc9c87df3793d46a4eff33282e0a3 @@ -2598,8 +2598,8 @@ trackedFiles: pristine_git_object: 63991d9ba8aedd15e34bdc73c8f99fbdcda2d037 docs/components/legacywebsearchservertool.mdx: id: 0b47ff5dd0c4 - last_write_checksum: sha1:ef83a0b10997f5e4b739804c64100360e6dc2f32 - pristine_git_object: e966af5dc1c57d2628f6392e923e7cf8b9f29188 + last_write_checksum: sha1:afabfb572c01159fba046a3743982ff2209df8ef + pristine_git_object: 004025a7d9377b7781cfe0f05a163b7a810dcca2 docs/components/legacywebsearchservertooltype.mdx: id: 192fa7358f3b last_write_checksum: sha1:c82facbab1f9b4f53e06a6e3986b886f2a9b9b00 @@ -3934,16 +3934,16 @@ trackedFiles: pristine_git_object: 56d189d99021af45f7fa6fb143af33d7d08cedcb docs/components/preview20250311websearchservertool.mdx: id: aeecb65a50e0 - last_write_checksum: sha1:9cd7cb2fd03fb0fb42684a3e00b072045d1974ee - pristine_git_object: 51a09f1717d612fcb41f0694f55e699f619e86b3 + last_write_checksum: sha1:ef24b4b2ec4d2860e80e5fb3d1c6f73dd2c97945 + pristine_git_object: d734b67ee2937717d0758e70ff7cf0c9e6ed88de docs/components/preview20250311websearchservertooltype.mdx: id: cedcfeda38d6 last_write_checksum: sha1:f7ac2913cc8c24d851c06d02c06742f9fe435084 pristine_git_object: 3669d05ce38327fa9b3d9a8c66c1de208a5f30e2 docs/components/previewwebsearchservertool.mdx: id: 2695e6e2fdfb - last_write_checksum: sha1:3279699a9827cc33c871fd15ab6af0129605760f - pristine_git_object: 66b4f3f11418bba6015197b38d12ef65d3fb061b + last_write_checksum: sha1:46ea9605eb3d8d7052a57684b86f686c2e520dfb + pristine_git_object: df18b19f02904491741e59c2c762b441bd9f7761 docs/components/previewwebsearchservertooltype.mdx: id: 4b6373295164 last_write_checksum: sha1:b28bae247d5a91d62f9be9877cd6f437628be49e @@ -5210,8 +5210,8 @@ trackedFiles: pristine_git_object: 6453f10f1843521ab57609e00cea4459984d565b docs/components/websearchconfig.mdx: id: 6d343d63543d - last_write_checksum: sha1:0a95768519dec7e4d01574b21f08c4f7feb7c1ef - pristine_git_object: 7fce2c52339b16ee22d21fd6983abf8dc8b3f5b9 + last_write_checksum: sha1:390164276ab8f4e4dea9e282f16e9c6b4f03a631 + pristine_git_object: c748e3b28ba3d4ff3972472e712dfb808c2aee52 docs/components/websearchdomainfilter.mdx: id: e6aef0d8853a last_write_checksum: sha1:e537f3dea8da557bc1a96ac339099088041ff5ad @@ -5238,12 +5238,12 @@ trackedFiles: pristine_git_object: 35edaa6c73e1f7c3731d7d5005897f72ca4ed496 docs/components/websearchservertool.mdx: id: cf9994f5aba9 - last_write_checksum: sha1:cc8bd65eb95f0a85c53c4d6f58281c70c28cff29 - pristine_git_object: 12501386ea51318cdadc2b3dcbe001800005f906 + last_write_checksum: sha1:17ca2a930ebb7d80949f89708a35136bb1623bfb + pristine_git_object: c9d9926f40fafd2fb63cf977530a3291e6fb3947 docs/components/websearchservertoolconfig.mdx: id: bb335e5d49e5 - last_write_checksum: sha1:0df601c9f454e72a8dc54e8f654201f8d3304f34 - pristine_git_object: f06444b67b2c7e6cd0a8790fe494d9a28ae0f7fb + last_write_checksum: sha1:3077af6ed4e4b3b657a6168e305f2f6cc3bccf22 + pristine_git_object: 90e572e0a0a41517bb5e7952ff3555ec185cc4bd docs/components/websearchservertoolopenrouter.mdx: id: d1e3cf613d26 last_write_checksum: sha1:014a351e3ba7d11d72eeb622e088215abdf7d4eb @@ -6718,8 +6718,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:038fced9e76ce56dae55c1e87f6a5c12a21b3bbb - pristine_git_object: 6ed3b7717434af18d2804155ba4c81723def20d0 + last_write_checksum: sha1:1d3f87cbaa18a5a04ceb47b6e87480f372d1a7d9 + pristine_git_object: 8343280ffb3fb85e6eb68b09a8438743c000de8b scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:77f44b60b98bc126557ec27391f91dfba764bb54 @@ -6746,8 +6746,8 @@ trackedFiles: pristine_git_object: 86713cfea633e09d33b3d4e65281071fe20e6137 src/openrouter/_version.py: id: d8d15ad6c586 - last_write_checksum: sha1:1ef0db51e9aadf65de40e7217b1104e191eb9b8f - pristine_git_object: 678fd942b8264c0205d51c799fac70362bb4eb89 + last_write_checksum: sha1:b06dded8354b2be12e1990095bce2d4e02b870e2 + pristine_git_object: 9ce2441c1892c8f90e88d4a2191e3aa646656bda src/openrouter/analytics.py: id: cb406b5aaabb last_write_checksum: sha1:9e709b71dd0611056dc0cec6150b578defe32841 @@ -7318,8 +7318,8 @@ trackedFiles: pristine_git_object: d5ebd465c8d843f4bc1f0763d136d31960ab2efa src/openrouter/components/chatwebsearchshorthand.py: id: 13091b97a3f6 - last_write_checksum: sha1:5f0a816474fb5767093d1657410765d4904879d8 - pristine_git_object: 9d333c1da7bc71abf85294ff59f8d144312e19b4 + last_write_checksum: sha1:0981957b40db4dcf14b2f267043b71b940d50fd5 + pristine_git_object: 485d31ac6fdb519bfe199a985f2280c10405449c src/openrouter/components/codeinterpreterservertool.py: id: a72c520afbf9 last_write_checksum: sha1:89e529b98c4b42a9d573f9234ee44f702e8bfcb7 @@ -7898,8 +7898,8 @@ trackedFiles: pristine_git_object: 0fe43c16758210b0b304f3f31cc88ba2df5e46a0 src/openrouter/components/legacy_websearchservertool.py: id: 8b28b05b8756 - last_write_checksum: sha1:bff7d5ebd6a54d3a598aaaeccefd18a04bb9b489 - pristine_git_object: 5628eb8718f0a2fb6664a4e4a11e84a20409a991 + last_write_checksum: sha1:35911582d15ad277e42d99e7ec51fd3b02f0e9f8 + pristine_git_object: f293a934b9940801b091d7c67a531b06991229fa src/openrouter/components/listbyokkeysresponse.py: id: d5f63cba5dd9 last_write_checksum: sha1:97cd54e94ba4996ebb43252ac31aa70511e0328c @@ -8426,12 +8426,12 @@ trackedFiles: pristine_git_object: 6828e9dd037e51ac1409380429e4aa86f8446211 src/openrouter/components/preview_20250311_websearchservertool.py: id: ecfe1a37c34f - last_write_checksum: sha1:51b131fca288db6925b444804158dd87f5e8b641 - pristine_git_object: b2ebdf07be0b3a2ef96fd7bf9fcce576d4687668 + last_write_checksum: sha1:6ba52dd1187f6b0763317143c6e2a561007abe4c + pristine_git_object: d2b460468999a65bfb0a874d227bffa19bbc47b4 src/openrouter/components/preview_websearchservertool.py: id: 9c02777285ce - last_write_checksum: sha1:5a8cef31c58d98bfd7a9cc97671b9720c3306ade - pristine_git_object: 7decade6f14207bbfe9bc35a620406a7e681b899 + last_write_checksum: sha1:7402fbafe151df158e1252f39e2763d35169d578 + pristine_git_object: f94bdab26839bd04307ba239f98dcb6eca28ddea src/openrouter/components/preview_websearchuserlocation.py: id: 40414eada27a last_write_checksum: sha1:0e241830bf9014e8ea814465c573711d8a7caa2c @@ -8982,8 +8982,8 @@ trackedFiles: pristine_git_object: adceee794cf8135f5db3b2d741dc6e4de9c4e968 src/openrouter/components/websearchconfig.py: id: 3884d9509e8c - last_write_checksum: sha1:c248e857a66dc84dd3bee697c38c5708f41d8b5e - pristine_git_object: 7478eed04a26073e0604c52d482f22df8fc9ef3b + last_write_checksum: sha1:71c23fc4151ddf9535d41f432a5cfbc91a0daf04 + pristine_git_object: c45df2dc89258098abaf6d2cd016e88fbc76ee7d src/openrouter/components/websearchdomainfilter.py: id: 4a7307ed2ba6 last_write_checksum: sha1:8754e3ef0b0c92fd72db36bbebada0d4fedb079c @@ -9002,16 +9002,16 @@ trackedFiles: pristine_git_object: 324037856d9c5a39675e4a2237eba61ac471dcee src/openrouter/components/websearchservertool.py: id: 32c7333e3c21 - last_write_checksum: sha1:350594b998b01c6fcd074726458419f767e8446e - pristine_git_object: 353136f1fe350535582f8800b4c37b606eead82d + last_write_checksum: sha1:2d8241a33b09154843403aa7fc92cfd272a9e078 + pristine_git_object: cb00458d1e50cdc2b57206059a82b12264257b28 src/openrouter/components/websearchservertool_openrouter.py: id: 3fcedc999f5b last_write_checksum: sha1:d5c34450670513a4fed73afc86670fc77f19a247 pristine_git_object: cac816de64f204cda6c706eee57f0d72b8b860eb src/openrouter/components/websearchservertoolconfig.py: id: ebdaa99d47da - last_write_checksum: sha1:5f9c19c63541cde91a2616be6ba8b90d6d96e39f - pristine_git_object: 8928f4994e491abd85589b6fc9a8e8b68726cec4 + last_write_checksum: sha1:1541e1aa4a48ba9b63439e0eccd27cb1ea2ecee3 + pristine_git_object: d195f79ad2a7ac53fc2f755ca1be4728dd11eb89 src/openrouter/components/websearchsource.py: id: a1fe81b68a7b last_write_checksum: sha1:fa30e5813682231d742fb6861f0fe92f655c8e81 @@ -11241,4 +11241,4 @@ examples: "500": application/json: {"error": {"code": 500, "message": "Internal Server Error"}} examplesVersion: 1.0.2 -releaseNotes: "## Python SDK Changes:\n* `open_router.guardrails.list()`: `response.data[].include_byok_in_budgets` **Added**\n* `open_router.guardrails.create()`: \n * `request.include_byok_in_budgets` **Added**\n * `response.data.include_byok_in_budgets` **Added**\n* `open_router.guardrails.get()`: `response.data.include_byok_in_budgets` **Added**\n* `open_router.guardrails.update()`: \n * `request.include_byok_in_budgets` **Added**\n * `response.data.include_byok_in_budgets` **Added**\n" +releaseNotes: "## Python SDK Changes:\n* `open_router.beta.responses.send()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem).tools[]` **Changed**\n * `response` **Changed**\n* `open_router.chat.send()`: \n * `request.tools[]` **Changed**\n* `open_router.presets.create_presets_chat_completions()`: \n * `request.tools[].union(ChatWebSearchShorthand)` **Changed**\n* `open_router.presets.create_presets_messages()`: \n * `request.tools[].union(OpenRouterWebSearchServerTool).parameters.max_uses` **Added**\n* `open_router.presets.create_presets_responses()`: \n * `request.input.union(Array<>)[].union(AdditionalToolsItem).tools[]` **Changed**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index ec84a216..f7653c90 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -36,7 +36,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true python: - version: 1.0.17 + version: 1.0.18 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 9027835c..1d31ee4c 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -6032,6 +6032,10 @@ components: description: 'Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.' example: 50 type: 'integer' + max_uses: + description: 'Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.' + example: 3 + type: 'integer' parameters: $ref: '#/components/schemas/WebSearchConfig' search_context_size: @@ -11175,6 +11179,10 @@ components: description: 'Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.' example: 5 type: 'integer' + max_uses: + description: 'Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.' + example: 3 + type: 'integer' search_context_size: $ref: '#/components/schemas/SearchContextSizeEnum' type: @@ -18723,6 +18731,10 @@ components: description: 'Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.' example: 5 type: 'integer' + max_uses: + description: 'Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.' + example: 3 + type: 'integer' search_context_size: $ref: '#/components/schemas/SearchContextSizeEnum' type: @@ -18747,6 +18759,10 @@ components: description: 'Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.' example: 5 type: 'integer' + max_uses: + description: 'Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.' + example: 3 + type: 'integer' search_context_size: $ref: '#/components/schemas/SearchContextSizeEnum' type: @@ -23873,6 +23889,10 @@ components: description: 'Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.' example: 50 type: 'integer' + max_uses: + description: 'Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.' + example: 3 + type: 'integer' search_context_size: $ref: '#/components/schemas/SearchQualityLevel' user_location: @@ -23995,6 +24015,10 @@ components: description: 'Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.' example: 5 type: 'integer' + max_uses: + description: 'Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.' + example: 3 + type: 'integer' search_context_size: $ref: '#/components/schemas/SearchContextSizeEnum' type: @@ -24052,6 +24076,10 @@ components: description: 'Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.' example: 50 type: 'integer' + max_uses: + description: 'Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.' + example: 3 + type: 'integer' search_context_size: $ref: '#/components/schemas/SearchQualityLevel' user_location: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 069a0654..580149d6 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:2bd4213d7f3dd51fadb76f220976a38fa47e7b520ee88fdc56f4c2a628bccb8f - sourceBlobDigest: sha256:9a033c15332f630e5e8ec465e3b7e28ceb87be4b5645802496a0d007448d128e + sourceRevisionDigest: sha256:b1162425d94a3a5b4980ae71f2b04fbb05421fccbd83357fa34a53904d652a69 + sourceBlobDigest: sha256:cc117568fbe7b9092b84038b9676517cc56226e8ba6a86b43396eb021d826eb9 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:2bd4213d7f3dd51fadb76f220976a38fa47e7b520ee88fdc56f4c2a628bccb8f - sourceBlobDigest: sha256:9a033c15332f630e5e8ec465e3b7e28ceb87be4b5645802496a0d007448d128e + sourceRevisionDigest: sha256:b1162425d94a3a5b4980ae71f2b04fbb05421fccbd83357fa34a53904d652a69 + sourceBlobDigest: sha256:cc117568fbe7b9092b84038b9676517cc56226e8ba6a86b43396eb021d826eb9 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:1d45567f92d194079a498105ec086f17965145aa1f06a26a8284bb898a9dec19 + codeSamplesRevisionDigest: sha256:c4785d760a1f1040f3f0a5905744bd3f89b98247139064d0cbf800167790edec workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.787.0 diff --git a/RELEASES.md b/RELEASES.md index 84ab2019..fd11d771 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -749,4 +749,14 @@ Based on: ### Generated - [python v1.0.17] . ### Releases -- [PyPI v1.0.17] https://pypi.org/project/openrouter/1.0.17 - . \ No newline at end of file +- [PyPI v1.0.17] https://pypi.org/project/openrouter/1.0.17 - . + +## 2026-07-24 01:36:04 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v1.0.18] . +### Releases +- [PyPI v1.0.18] https://pypi.org/project/openrouter/1.0.18 - . \ No newline at end of file diff --git a/docs/components/chatwebsearchshorthand.mdx b/docs/components/chatwebsearchshorthand.mdx index 942103ab..0ddc2d34 100644 --- a/docs/components/chatwebsearchshorthand.mdx +++ b/docs/components/chatwebsearchshorthand.mdx @@ -15,6 +15,7 @@ Web search tool using OpenAI Responses API syntax. Automatically converted to op | `max_characters` | *Optional[int]* | :heavy_minus_sign: | Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity). | 2000 | | `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | | `max_total_results` | *Optional[int]* | :heavy_minus_sign: | Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified. | 50 | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. | 3 | | `parameters` | [Optional[components.WebSearchConfig]](../components/websearchconfig.mdx) | :heavy_minus_sign: | N/A | \{
"max_results": 5,
"search_context_size": "medium"
} | | `search_context_size` | [Optional[components.SearchQualityLevel]](../components/searchqualitylevel.mdx) | :heavy_minus_sign: | How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set. | medium | | `type` | [components.ChatWebSearchShorthandType](../components/chatwebsearchshorthandtype.mdx) | :heavy_check_mark: | N/A | | diff --git a/docs/components/legacywebsearchservertool.mdx b/docs/components/legacywebsearchservertool.mdx index e966af5d..004025a7 100644 --- a/docs/components/legacywebsearchservertool.mdx +++ b/docs/components/legacywebsearchservertool.mdx @@ -7,11 +7,12 @@ Web search tool configuration ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | -| `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | -| `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | -| `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | -| `type` | [components.LegacyWebSearchServerToolType](../components/legacywebsearchservertooltype.mdx) | :heavy_check_mark: | N/A | | -| `user_location` | [OptionalNullable[components.WebSearchUserLocation]](../components/websearchuserlocation.mdx) | :heavy_minus_sign: | User location information for web search | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | +| `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | +| `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. | 3 | +| `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | +| `type` | [components.LegacyWebSearchServerToolType](../components/legacywebsearchservertooltype.mdx) | :heavy_check_mark: | N/A | | +| `user_location` | [OptionalNullable[components.WebSearchUserLocation]](../components/websearchuserlocation.mdx) | :heavy_minus_sign: | User location information for web search | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/components/preview20250311websearchservertool.mdx b/docs/components/preview20250311websearchservertool.mdx index 51a09f17..d734b67e 100644 --- a/docs/components/preview20250311websearchservertool.mdx +++ b/docs/components/preview20250311websearchservertool.mdx @@ -7,11 +7,12 @@ Web search preview tool configuration (2025-03-11 version) ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | -| `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | -| `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | -| `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | -| `type` | [components.Preview20250311WebSearchServerToolType](../components/preview20250311websearchservertooltype.mdx) | :heavy_check_mark: | N/A | | -| `user_location` | [OptionalNullable[components.PreviewWebSearchUserLocation]](../components/previewwebsearchuserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | +| `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | +| `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. | 3 | +| `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | +| `type` | [components.Preview20250311WebSearchServerToolType](../components/preview20250311websearchservertooltype.mdx) | :heavy_check_mark: | N/A | | +| `user_location` | [OptionalNullable[components.PreviewWebSearchUserLocation]](../components/previewwebsearchuserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/components/previewwebsearchservertool.mdx b/docs/components/previewwebsearchservertool.mdx index 66b4f3f1..df18b19f 100644 --- a/docs/components/previewwebsearchservertool.mdx +++ b/docs/components/previewwebsearchservertool.mdx @@ -7,11 +7,12 @@ Web search preview tool configuration ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | -| `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | -| `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | -| `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | -| `type` | [components.PreviewWebSearchServerToolType](../components/previewwebsearchservertooltype.mdx) | :heavy_check_mark: | N/A | | -| `user_location` | [OptionalNullable[components.PreviewWebSearchUserLocation]](../components/previewwebsearchuserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | +| `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | +| `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. | 3 | +| `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | +| `type` | [components.PreviewWebSearchServerToolType](../components/previewwebsearchservertooltype.mdx) | :heavy_check_mark: | N/A | | +| `user_location` | [OptionalNullable[components.PreviewWebSearchUserLocation]](../components/previewwebsearchuserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/components/websearchconfig.mdx b/docs/components/websearchconfig.mdx index 7fce2c52..c748e3b2 100644 --- a/docs/components/websearchconfig.mdx +++ b/docs/components/websearchconfig.mdx @@ -12,5 +12,6 @@ title: "WebSearchConfig" | `max_characters` | *Optional[int]* | :heavy_minus_sign: | Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity). | 2000 | | `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | | `max_total_results` | *Optional[int]* | :heavy_minus_sign: | Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified. | 50 | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. | 3 | | `search_context_size` | [Optional[components.SearchQualityLevel]](../components/searchqualitylevel.mdx) | :heavy_minus_sign: | How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set. | medium | | `user_location` | [Optional[components.WebSearchUserLocationServerTool]](../components/websearchuserlocationservertool.mdx) | :heavy_minus_sign: | Approximate user location for location-biased results. | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/components/websearchservertool.mdx b/docs/components/websearchservertool.mdx index 12501386..c9d9926f 100644 --- a/docs/components/websearchservertool.mdx +++ b/docs/components/websearchservertool.mdx @@ -7,11 +7,12 @@ Web search tool configuration (2025-08-26 version) ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | -| `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | -| `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | -| `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | -| `type` | [components.WebSearchServerToolType](../components/websearchservertooltype.mdx) | :heavy_check_mark: | N/A | | -| `user_location` | [OptionalNullable[components.WebSearchUserLocation]](../components/websearchuserlocation.mdx) | :heavy_minus_sign: | User location information for web search | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | +| `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | +| `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. | 3 | +| `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | +| `type` | [components.WebSearchServerToolType](../components/websearchservertooltype.mdx) | :heavy_check_mark: | N/A | | +| `user_location` | [OptionalNullable[components.WebSearchUserLocation]](../components/websearchuserlocation.mdx) | :heavy_minus_sign: | User location information for web search | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/docs/components/websearchservertoolconfig.mdx b/docs/components/websearchservertoolconfig.mdx index f06444b6..90e572e0 100644 --- a/docs/components/websearchservertoolconfig.mdx +++ b/docs/components/websearchservertoolconfig.mdx @@ -15,5 +15,6 @@ Configuration for the openrouter:web_search server tool | `max_characters` | *Optional[int]* | :heavy_minus_sign: | Exact maximum number of characters of content per search result. Applies to the Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, caps highlight content per result. For Parallel, caps excerpt content per result (default 1,500 when omitted). For Perplexity, maps to the native `max_tokens_per_page` parameter (converted from characters to tokens) and trims the response to the exact character cap. When both `max_characters` and `search_context_size` are set, `max_characters` takes precedence. When omitted, falls back to `search_context_size` mapping (Exa) or engine defaults (Parallel, Perplexity). | 2000 | | `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | | `max_total_results` | *Optional[int]* | :heavy_minus_sign: | Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified. | 50 | +| `max_uses` | *Optional[int]* | :heavy_minus_sign: | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. | 3 | | `search_context_size` | [Optional[components.SearchQualityLevel]](../components/searchqualitylevel.mdx) | :heavy_minus_sign: | How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set. | medium | | `user_location` | [Optional[components.WebSearchUserLocationServerTool]](../components/websearchuserlocationservertool.mdx) | :heavy_minus_sign: | Approximate user location for location-biased results. | \{
"city": "San Francisco",
"country": "US",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} | \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6ed3b771..8343280f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "1.0.17" +version = "1.0.18" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 678fd942..9ce2441c 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "1.0.17" +__version__: str = "1.0.18" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.914.0" -__user_agent__: str = "speakeasy-sdk/python 1.0.17 2.914.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 1.0.18 2.914.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/components/chatwebsearchshorthand.py b/src/openrouter/components/chatwebsearchshorthand.py index 9d333c1d..485d31ac 100644 --- a/src/openrouter/components/chatwebsearchshorthand.py +++ b/src/openrouter/components/chatwebsearchshorthand.py @@ -41,6 +41,8 @@ class ChatWebSearchShorthandTypedDict(TypedDict): r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" max_total_results: NotRequired[int] r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" + max_uses: NotRequired[int] + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" parameters: NotRequired[WebSearchConfigTypedDict] search_context_size: NotRequired[SearchQualityLevel] r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" @@ -71,6 +73,9 @@ class ChatWebSearchShorthand(BaseModel): max_total_results: Optional[int] = None r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" + max_uses: Optional[int] = None + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" + parameters: Optional[WebSearchConfig] = None search_context_size: Optional[SearchQualityLevel] = None @@ -89,6 +94,7 @@ def serialize_model(self, handler): "max_characters", "max_results", "max_total_results", + "max_uses", "parameters", "search_context_size", "user_location", diff --git a/src/openrouter/components/legacy_websearchservertool.py b/src/openrouter/components/legacy_websearchservertool.py index 5628eb87..f293a934 100644 --- a/src/openrouter/components/legacy_websearchservertool.py +++ b/src/openrouter/components/legacy_websearchservertool.py @@ -29,6 +29,8 @@ class LegacyWebSearchServerToolTypedDict(TypedDict): filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] max_results: NotRequired[int] r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" + max_uses: NotRequired[int] + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" search_context_size: NotRequired[SearchContextSizeEnum] r"""Size of the search context for web search tools""" user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]] @@ -48,6 +50,9 @@ class LegacyWebSearchServerTool(BaseModel): max_results: Optional[int] = None r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" + max_uses: Optional[int] = None + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" + search_context_size: Optional[SearchContextSizeEnum] = None r"""Size of the search context for web search tools""" @@ -57,7 +62,14 @@ class LegacyWebSearchServerTool(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["engine", "filters", "max_results", "search_context_size", "user_location"] + [ + "engine", + "filters", + "max_results", + "max_uses", + "search_context_size", + "user_location", + ] ) nullable_fields = set(["filters", "user_location"]) serialized = handler(self) diff --git a/src/openrouter/components/preview_20250311_websearchservertool.py b/src/openrouter/components/preview_20250311_websearchservertool.py index b2ebdf07..d2b46046 100644 --- a/src/openrouter/components/preview_20250311_websearchservertool.py +++ b/src/openrouter/components/preview_20250311_websearchservertool.py @@ -32,6 +32,8 @@ class Preview20250311WebSearchServerToolTypedDict(TypedDict): filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] max_results: NotRequired[int] r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" + max_uses: NotRequired[int] + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" search_context_size: NotRequired[SearchContextSizeEnum] r"""Size of the search context for web search tools""" user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]] @@ -50,6 +52,9 @@ class Preview20250311WebSearchServerTool(BaseModel): max_results: Optional[int] = None r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" + max_uses: Optional[int] = None + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" + search_context_size: Optional[SearchContextSizeEnum] = None r"""Size of the search context for web search tools""" @@ -58,7 +63,14 @@ class Preview20250311WebSearchServerTool(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["engine", "filters", "max_results", "search_context_size", "user_location"] + [ + "engine", + "filters", + "max_results", + "max_uses", + "search_context_size", + "user_location", + ] ) nullable_fields = set(["filters", "user_location"]) serialized = handler(self) diff --git a/src/openrouter/components/preview_websearchservertool.py b/src/openrouter/components/preview_websearchservertool.py index 7decade6..f94bdab2 100644 --- a/src/openrouter/components/preview_websearchservertool.py +++ b/src/openrouter/components/preview_websearchservertool.py @@ -32,6 +32,8 @@ class PreviewWebSearchServerToolTypedDict(TypedDict): filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] max_results: NotRequired[int] r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" + max_uses: NotRequired[int] + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" search_context_size: NotRequired[SearchContextSizeEnum] r"""Size of the search context for web search tools""" user_location: NotRequired[Nullable[PreviewWebSearchUserLocationTypedDict]] @@ -50,6 +52,9 @@ class PreviewWebSearchServerTool(BaseModel): max_results: Optional[int] = None r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" + max_uses: Optional[int] = None + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" + search_context_size: Optional[SearchContextSizeEnum] = None r"""Size of the search context for web search tools""" @@ -58,7 +63,14 @@ class PreviewWebSearchServerTool(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["engine", "filters", "max_results", "search_context_size", "user_location"] + [ + "engine", + "filters", + "max_results", + "max_uses", + "search_context_size", + "user_location", + ] ) nullable_fields = set(["filters", "user_location"]) serialized = handler(self) diff --git a/src/openrouter/components/websearchconfig.py b/src/openrouter/components/websearchconfig.py index 7478eed0..c45df2dc 100644 --- a/src/openrouter/components/websearchconfig.py +++ b/src/openrouter/components/websearchconfig.py @@ -26,6 +26,8 @@ class WebSearchConfigTypedDict(TypedDict): r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" max_total_results: NotRequired[int] r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" + max_uses: NotRequired[int] + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" search_context_size: NotRequired[SearchQualityLevel] r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" user_location: NotRequired[WebSearchUserLocationServerToolTypedDict] @@ -51,6 +53,9 @@ class WebSearchConfig(BaseModel): max_total_results: Optional[int] = None r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" + max_uses: Optional[int] = None + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" + search_context_size: Optional[SearchQualityLevel] = None r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" @@ -67,6 +72,7 @@ def serialize_model(self, handler): "max_characters", "max_results", "max_total_results", + "max_uses", "search_context_size", "user_location", ] diff --git a/src/openrouter/components/websearchservertool.py b/src/openrouter/components/websearchservertool.py index 353136f1..cb00458d 100644 --- a/src/openrouter/components/websearchservertool.py +++ b/src/openrouter/components/websearchservertool.py @@ -29,6 +29,8 @@ class WebSearchServerToolTypedDict(TypedDict): filters: NotRequired[Nullable[WebSearchDomainFilterTypedDict]] max_results: NotRequired[int] r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" + max_uses: NotRequired[int] + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" search_context_size: NotRequired[SearchContextSizeEnum] r"""Size of the search context for web search tools""" user_location: NotRequired[Nullable[WebSearchUserLocationTypedDict]] @@ -48,6 +50,9 @@ class WebSearchServerTool(BaseModel): max_results: Optional[int] = None r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" + max_uses: Optional[int] = None + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" + search_context_size: Optional[SearchContextSizeEnum] = None r"""Size of the search context for web search tools""" @@ -57,7 +62,14 @@ class WebSearchServerTool(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["engine", "filters", "max_results", "search_context_size", "user_location"] + [ + "engine", + "filters", + "max_results", + "max_uses", + "search_context_size", + "user_location", + ] ) nullable_fields = set(["filters", "user_location"]) serialized = handler(self) diff --git a/src/openrouter/components/websearchservertoolconfig.py b/src/openrouter/components/websearchservertoolconfig.py index 8928f499..d195f79a 100644 --- a/src/openrouter/components/websearchservertoolconfig.py +++ b/src/openrouter/components/websearchservertoolconfig.py @@ -28,6 +28,8 @@ class WebSearchServerToolConfigTypedDict(TypedDict): r"""Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped.""" max_total_results: NotRequired[int] r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" + max_uses: NotRequired[int] + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" search_context_size: NotRequired[SearchQualityLevel] r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" user_location: NotRequired[WebSearchUserLocationServerToolTypedDict] @@ -55,6 +57,9 @@ class WebSearchServerToolConfig(BaseModel): max_total_results: Optional[int] = None r"""Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.""" + max_uses: Optional[int] = None + r"""Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it.""" + search_context_size: Optional[SearchQualityLevel] = None r"""How much context to retrieve per result. Applies to Exa, Parallel, and Perplexity engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. For Perplexity, maps directly to the Search API's native search_context_size parameter. Overridden by `max_characters` when both are set.""" @@ -71,6 +76,7 @@ def serialize_model(self, handler): "max_characters", "max_results", "max_total_results", + "max_uses", "search_context_size", "user_location", ] diff --git a/uv.lock b/uv.lock index f6ff8218..3c938b4d 100644 --- a/uv.lock +++ b/uv.lock @@ -213,7 +213,7 @@ wheels = [ [[package]] name = "openrouter" -version = "1.0.17" +version = "1.0.18" source = { editable = "." } dependencies = [ { name = "httpcore" },