From 03dd57aceda9d1b78ab8fefc20a00d380bbf6ac2 Mon Sep 17 00:00:00 2001 From: Karolis Kluonaitis Date: Tue, 11 Nov 2025 11:23:44 +0200 Subject: [PATCH] add paths parameters to map --- examples/ai_map_include.py | 14 ++++++++++++++ pyproject.toml | 2 +- readme.md | 4 ++++ src/oxylabs_ai_studio/apps/ai_map.py | 12 ++++++++++++ uv.lock | 4 ++-- 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 examples/ai_map_include.py diff --git a/examples/ai_map_include.py b/examples/ai_map_include.py new file mode 100644 index 0000000..5a31b26 --- /dev/null +++ b/examples/ai_map_include.py @@ -0,0 +1,14 @@ +from oxylabs_ai_studio.apps.ai_map import AiMap + +ai_map = AiMap(api_key="") + +payload = { + "url": "https://oxylabs.io", + "user_prompt": "find product pages", + "return_sources_limit": 10, + "include_sitemap": False, + "include_paths": [".*/?products/.*"], +} +result = ai_map.map(**payload) +print(result.data) + diff --git a/pyproject.toml b/pyproject.toml index 40a65f7..9f80588 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "oxylabs-ai-studio" -version = "0.2.16" +version = "0.2.17" description = "Oxylabs studio python sdk" readme = "README.md" keywords = ["oxylabs", "ai", "studio"] diff --git a/readme.md b/readme.md index 4572218..43f615d 100644 --- a/readme.md +++ b/readme.md @@ -154,6 +154,10 @@ print(result.data) - `render_javascript` (bool): Render JavaScript (default: False) - `return_sources_limit` (int): Max number of sources to return (default: 25) - `geo_location` (str): proxy location in ISO2 format. +- `include_sitemap` (bool): Include URLs discovered via sitemap. (default: False) +- `include_paths` (list[str] | None): Regex patterns to include (matched against URL path, e.g., `.*/?products/.*`) +- `exclude_paths` (list[str] | None): Regex patterns to exclude (matched against URL path) + --- See the [examples](https://github.com/oxylabs/oxylabs-ai-studio-py/tree/main/examples) folder for usage examples of each method. Each method has corresponding async version. diff --git a/src/oxylabs_ai_studio/apps/ai_map.py b/src/oxylabs_ai_studio/apps/ai_map.py index 8122d7c..0140ca9 100644 --- a/src/oxylabs_ai_studio/apps/ai_map.py +++ b/src/oxylabs_ai_studio/apps/ai_map.py @@ -34,6 +34,9 @@ def map( return_sources_limit: int = 25, geo_location: str | None = None, render_javascript: bool = False, + include_sitemap: bool = False, + include_paths: list[str] | None = None, + exclude_paths: list[str] | None = None, ) -> AiMapJob: body = { "url": url, @@ -41,6 +44,9 @@ def map( "return_sources_limit": return_sources_limit, "geo_location": geo_location, "render_html": render_javascript, + "include_sitemap": include_sitemap, + "include_paths": include_paths, + "exclude_paths": exclude_paths, } client = self.get_client() create_response = self.call_api( @@ -103,6 +109,9 @@ async def map_async( return_sources_limit: int = 25, geo_location: str | None = None, render_javascript: bool = False, + include_sitemap: bool = False, + include_paths: list[str] | None = None, + exclude_paths: list[str] | None = None, ) -> AiMapJob: body = { "url": url, @@ -110,6 +119,9 @@ async def map_async( "return_sources_limit": return_sources_limit, "geo_location": geo_location, "render_html": render_javascript, + "include_sitemap": include_sitemap, + "include_paths": include_paths, + "exclude_paths": exclude_paths, } async with self.async_client() as client: create_response = await self.call_api_async( diff --git a/uv.lock b/uv.lock index ad4b0f1..f081166 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.10" [[package]] @@ -448,7 +448,7 @@ wheels = [ [[package]] name = "oxylabs-ai-studio" -version = "0.2.16" +version = "0.2.17" source = { editable = "." } dependencies = [ { name = "httpx" },