hyperbrowser 0.15.0__tar.gz → 0.16.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hyperbrowser might be problematic. Click here for more details.
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/PKG-INFO +1 -1
- hyperbrowser-0.16.0/hyperbrowser/tools/anthropic.py +56 -0
- hyperbrowser-0.16.0/hyperbrowser/tools/openai.py +67 -0
- hyperbrowser-0.16.0/hyperbrowser/tools/schema.py +75 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/pyproject.toml +1 -1
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/LICENSE +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/README.md +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/__init__.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/async_client.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/base.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/crawl.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/extension.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/profile.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/scrape.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/session.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/crawl.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/extension.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/profile.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/scrape.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/session.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/sync.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/config.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/exceptions.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/models/consts.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/models/crawl.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/models/extension.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/models/profile.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/models/scrape.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/models/session.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/transport/async_transport.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/transport/base.py +0 -0
- {hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/transport/sync.py +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from typing import Dict, Union, Optional
|
|
2
|
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
|
3
|
+
|
|
4
|
+
from hyperbrowser.tools.schema import CRAWL_SCHEMA, SCRAPE_SCHEMA
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CacheControlEphemeralParam(TypedDict, total=False):
|
|
8
|
+
type: Required[Literal["ephemeral"]]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class InputSchemaTyped(TypedDict, total=False):
|
|
12
|
+
type: Required[Literal["object"]]
|
|
13
|
+
|
|
14
|
+
properties: Optional[object]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
InputSchema: TypeAlias = Union[InputSchemaTyped, Dict[str, object]]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ToolParam(TypedDict, total=False):
|
|
21
|
+
input_schema: Required[InputSchema]
|
|
22
|
+
"""[JSON schema](https://json-schema.org/) for this tool's input.
|
|
23
|
+
|
|
24
|
+
This defines the shape of the `input` that your tool accepts and that the model
|
|
25
|
+
will produce.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
name: Required[str]
|
|
29
|
+
"""Name of the tool.
|
|
30
|
+
|
|
31
|
+
This is how the tool will be called by the model and in tool_use blocks.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
cache_control: Optional[CacheControlEphemeralParam]
|
|
35
|
+
|
|
36
|
+
description: str
|
|
37
|
+
"""Description of what this tool does.
|
|
38
|
+
|
|
39
|
+
Tool descriptions should be as detailed as possible. The more information that
|
|
40
|
+
the model has about what the tool is and how to use it, the better it will
|
|
41
|
+
perform. You can use natural language descriptions to reinforce important
|
|
42
|
+
aspects of the tool input JSON schema.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
SCRAPE_TOOL_ANTHROPIC: ToolParam = {
|
|
47
|
+
"input_schema": SCRAPE_SCHEMA,
|
|
48
|
+
"name": "scrape_webpage",
|
|
49
|
+
"description": "Scrape content from a webpage and return the content in markdown format",
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
CRAWL_TOOL_ANTHROPIC: ToolParam = {
|
|
53
|
+
"input_schema": CRAWL_SCHEMA,
|
|
54
|
+
"name": "crawl_website",
|
|
55
|
+
"description": "Crawl a website and return the content in markdown format",
|
|
56
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from typing import Dict, Optional
|
|
2
|
+
from typing_extensions import Literal, Required, TypedDict, TypeAlias
|
|
3
|
+
|
|
4
|
+
from hyperbrowser.tools.schema import CRAWL_SCHEMA, SCRAPE_SCHEMA
|
|
5
|
+
|
|
6
|
+
FunctionParameters: TypeAlias = Dict[str, object]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class FunctionDefinition(TypedDict, total=False):
|
|
10
|
+
name: Required[str]
|
|
11
|
+
"""The name of the function to be called.
|
|
12
|
+
|
|
13
|
+
Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length
|
|
14
|
+
of 64.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
description: str
|
|
18
|
+
"""
|
|
19
|
+
A description of what the function does, used by the model to choose when and
|
|
20
|
+
how to call the function.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
parameters: FunctionParameters
|
|
24
|
+
"""The parameters the functions accepts, described as a JSON Schema object.
|
|
25
|
+
|
|
26
|
+
See the [guide](https://platform.openai.com/docs/guides/function-calling) for
|
|
27
|
+
examples, and the
|
|
28
|
+
[JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
|
|
29
|
+
documentation about the format.
|
|
30
|
+
|
|
31
|
+
Omitting `parameters` defines a function with an empty parameter list.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
strict: Optional[bool]
|
|
35
|
+
"""Whether to enable strict schema adherence when generating the function call.
|
|
36
|
+
|
|
37
|
+
If set to true, the model will follow the exact schema defined in the
|
|
38
|
+
`parameters` field. Only a subset of JSON Schema is supported when `strict` is
|
|
39
|
+
`true`. Learn more about Structured Outputs in the
|
|
40
|
+
[function calling guide](docs/guides/function-calling).
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ChatCompletionToolParam(TypedDict, total=False):
|
|
45
|
+
function: Required[FunctionDefinition]
|
|
46
|
+
|
|
47
|
+
type: Required[Literal["function"]]
|
|
48
|
+
"""The type of the tool. Currently, only `function` is supported."""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
SCRAPE_TOOL_OPENAI: ChatCompletionToolParam = {
|
|
52
|
+
"type": "function",
|
|
53
|
+
"function": {
|
|
54
|
+
"name": "scrape_webpage",
|
|
55
|
+
"description": "Scrape content from a webpage and return the content in markdown format",
|
|
56
|
+
"parameters": SCRAPE_SCHEMA,
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
CRAWL_TOOL_OPENAI: ChatCompletionToolParam = {
|
|
61
|
+
"type": "function",
|
|
62
|
+
"function": {
|
|
63
|
+
"name": "crawl_website",
|
|
64
|
+
"description": "Crawl a website and return the content in markdown format",
|
|
65
|
+
"parameters": CRAWL_SCHEMA,
|
|
66
|
+
},
|
|
67
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
SCRAPE_OPTIONS = {
|
|
2
|
+
"type": "object",
|
|
3
|
+
"description": "The options for the scrape",
|
|
4
|
+
"properties": {
|
|
5
|
+
"include_tags": {
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
},
|
|
10
|
+
"description": "An array of HTML tags, classes, or IDs to include in the scraped content. Only elements matching these selectors will be returned.",
|
|
11
|
+
},
|
|
12
|
+
"exclude_tags": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
},
|
|
17
|
+
"description": "An array of HTML tags, classes, or IDs to exclude from the scraped content. Elements matching these selectors will be omitted from the response.",
|
|
18
|
+
},
|
|
19
|
+
"only_main_content": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Whether to only return the main content of the page. If true, only the main content of the page will be returned, excluding any headers, navigation menus,footers, or other non-main content.",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
SCRAPE_SCHEMA = {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {
|
|
29
|
+
"url": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "The URL of the website to scrape",
|
|
32
|
+
},
|
|
33
|
+
"scrape_options": SCRAPE_OPTIONS,
|
|
34
|
+
},
|
|
35
|
+
"required": ["url"],
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
CRAWL_SCHEMA = {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"properties": {
|
|
41
|
+
"url": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "The URL of the website to crawl",
|
|
44
|
+
},
|
|
45
|
+
"max_pages": {
|
|
46
|
+
"type": "number",
|
|
47
|
+
"default": 10,
|
|
48
|
+
"description": "The maximum number of pages to crawl",
|
|
49
|
+
},
|
|
50
|
+
"follow_links": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"description": "Whether to follow links on the page",
|
|
53
|
+
},
|
|
54
|
+
"ignore_sitemap": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Whether to ignore the sitemap",
|
|
57
|
+
},
|
|
58
|
+
"exclude_patterns": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
},
|
|
63
|
+
"description": "An array of regular expressions or wildcard patterns specifying which URLs should be excluded from the crawl. Any pages whose URLs' path match one of these patterns will be skipped. Example: ['/admin', '/careers/*']",
|
|
64
|
+
},
|
|
65
|
+
"include_patterns": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"items": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
},
|
|
70
|
+
"description": "An array of regular expressions or wildcard patterns specifying which URLs should be included in the crawl. Only pages whose URLs' path match one of these path patterns will be visited. Example: ['/admin', '/careers/*']",
|
|
71
|
+
},
|
|
72
|
+
"scrape_options": SCRAPE_OPTIONS,
|
|
73
|
+
},
|
|
74
|
+
"required": ["url"],
|
|
75
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/crawl.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/extension.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/profile.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/scrape.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/async_manager/session.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/crawl.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/extension.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/profile.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/scrape.py
RENAMED
|
File without changes
|
{hyperbrowser-0.15.0 → hyperbrowser-0.16.0}/hyperbrowser/client/managers/sync_manager/session.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|