@tabstack/sdk 2.0.0 → 2.2.0
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.
- package/CHANGELOG.md +55 -0
- package/README.md +2 -2
- package/client.d.mts +3 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -2
- package/client.d.ts.map +1 -1
- package/client.js +8 -2
- package/client.js.map +1 -1
- package/client.mjs +9 -3
- package/client.mjs.map +1 -1
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agent.d.mts +83 -3
- package/resources/agent.d.mts.map +1 -1
- package/resources/agent.d.ts +83 -3
- package/resources/agent.d.ts.map +1 -1
- package/resources/agent.js +45 -2
- package/resources/agent.js.map +1 -1
- package/resources/agent.mjs +45 -2
- package/resources/agent.mjs.map +1 -1
- package/resources/extract.d.mts +90 -1
- package/resources/extract.d.mts.map +1 -1
- package/resources/extract.d.ts +90 -1
- package/resources/extract.d.ts.map +1 -1
- package/resources/extract.js +25 -1
- package/resources/extract.js.map +1 -1
- package/resources/extract.mjs +25 -1
- package/resources/extract.mjs.map +1 -1
- package/resources/generate.d.mts +35 -1
- package/resources/generate.d.mts.map +1 -1
- package/resources/generate.d.ts +35 -1
- package/resources/generate.d.ts.map +1 -1
- package/resources/generate.js +19 -1
- package/resources/generate.js.map +1 -1
- package/resources/generate.mjs +19 -1
- package/resources/generate.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/src/client.ts +19 -4
- package/src/core/streaming.ts +2 -2
- package/src/internal/parse.ts +6 -0
- package/src/resources/agent.ts +104 -3
- package/src/resources/extract.ts +102 -1
- package/src/resources/generate.ts +37 -1
- package/src/resources/index.ts +7 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/resources/agent.d.mts
CHANGED
|
@@ -4,14 +4,19 @@ import { Stream } from "../core/streaming.mjs";
|
|
|
4
4
|
import { RequestOptions } from "../internal/request-options.mjs";
|
|
5
5
|
export declare class Agent extends APIResource {
|
|
6
6
|
/**
|
|
7
|
-
* Execute AI-powered browser automation tasks using natural language
|
|
8
|
-
* endpoint **always streams** responses using Server-Sent
|
|
7
|
+
* Execute AI-powered browser automation tasks using natural language with optional
|
|
8
|
+
* geotargeting. This endpoint **always streams** responses using Server-Sent
|
|
9
|
+
* Events (SSE).
|
|
9
10
|
*
|
|
10
11
|
* **Streaming Response:**
|
|
11
12
|
*
|
|
12
13
|
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
13
14
|
* - Real-time progress updates and results as they're generated
|
|
14
15
|
*
|
|
16
|
+
* **Geotargeting:**
|
|
17
|
+
*
|
|
18
|
+
* - Optionally specify a country code for geotargeted browsing
|
|
19
|
+
*
|
|
15
20
|
* **Use Cases:**
|
|
16
21
|
*
|
|
17
22
|
* - Web scraping and data extraction
|
|
@@ -31,6 +36,37 @@ export declare class Agent extends APIResource {
|
|
|
31
36
|
* ```
|
|
32
37
|
*/
|
|
33
38
|
automate(body: AgentAutomateParams, options?: RequestOptions): APIPromise<Stream<AutomateEvent>>;
|
|
39
|
+
/**
|
|
40
|
+
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
41
|
+
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
42
|
+
* using Server-Sent Events (SSE).
|
|
43
|
+
*
|
|
44
|
+
* **Streaming Response:**
|
|
45
|
+
*
|
|
46
|
+
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
47
|
+
* - Real-time progress updates as research progresses through phases
|
|
48
|
+
*
|
|
49
|
+
* **Research Modes:**
|
|
50
|
+
*
|
|
51
|
+
* - `fast` - Quick answers with minimal web searches
|
|
52
|
+
* - `balanced` - Standard research with multiple iterations (default)
|
|
53
|
+
*
|
|
54
|
+
* **Use Cases:**
|
|
55
|
+
*
|
|
56
|
+
* - Answering complex questions with cited sources
|
|
57
|
+
* - Synthesizing information from multiple web sources
|
|
58
|
+
* - Research reports on specific topics
|
|
59
|
+
* - Fact-checking and verification tasks
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const researchEvent = await client.agent.research({
|
|
64
|
+
* query:
|
|
65
|
+
* 'What are the latest developments in quantum computing?',
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
research(body: AgentResearchParams, options?: RequestOptions): APIPromise<Stream<ResearchEvent>>;
|
|
34
70
|
}
|
|
35
71
|
export interface AutomateEvent {
|
|
36
72
|
/**
|
|
@@ -42,6 +78,16 @@ export interface AutomateEvent {
|
|
|
42
78
|
*/
|
|
43
79
|
event?: string;
|
|
44
80
|
}
|
|
81
|
+
export interface ResearchEvent {
|
|
82
|
+
/**
|
|
83
|
+
* Event payload data
|
|
84
|
+
*/
|
|
85
|
+
data?: unknown;
|
|
86
|
+
/**
|
|
87
|
+
* The event type: phase, progress, complete, or error
|
|
88
|
+
*/
|
|
89
|
+
event?: 'phase' | 'progress' | 'complete' | 'error';
|
|
90
|
+
}
|
|
45
91
|
export interface AgentAutomateParams {
|
|
46
92
|
/**
|
|
47
93
|
* The task description in natural language
|
|
@@ -51,6 +97,10 @@ export interface AgentAutomateParams {
|
|
|
51
97
|
* JSON data to provide context for form filling or complex tasks
|
|
52
98
|
*/
|
|
53
99
|
data?: unknown;
|
|
100
|
+
/**
|
|
101
|
+
* Optional geotargeting parameters for proxy requests
|
|
102
|
+
*/
|
|
103
|
+
geo_target?: AgentAutomateParams.GeoTarget;
|
|
54
104
|
/**
|
|
55
105
|
* Safety constraints for execution
|
|
56
106
|
*/
|
|
@@ -68,7 +118,37 @@ export interface AgentAutomateParams {
|
|
|
68
118
|
*/
|
|
69
119
|
url?: string;
|
|
70
120
|
}
|
|
121
|
+
export declare namespace AgentAutomateParams {
|
|
122
|
+
/**
|
|
123
|
+
* Optional geotargeting parameters for proxy requests
|
|
124
|
+
*/
|
|
125
|
+
interface GeoTarget {
|
|
126
|
+
/**
|
|
127
|
+
* Country code using ISO 3166-1 alpha-2 standard (2 letters, e.g., "US", "GB",
|
|
128
|
+
* "JP"). See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
129
|
+
*/
|
|
130
|
+
country?: string;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export interface AgentResearchParams {
|
|
134
|
+
/**
|
|
135
|
+
* The research query or question to answer
|
|
136
|
+
*/
|
|
137
|
+
query: string;
|
|
138
|
+
/**
|
|
139
|
+
* Timeout in seconds for fetching web pages
|
|
140
|
+
*/
|
|
141
|
+
fetch_timeout?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Research mode: fast (quick answers), balanced (standard research, default)
|
|
144
|
+
*/
|
|
145
|
+
mode?: 'fast' | 'balanced';
|
|
146
|
+
/**
|
|
147
|
+
* Skip cache and force fresh research
|
|
148
|
+
*/
|
|
149
|
+
nocache?: boolean;
|
|
150
|
+
}
|
|
71
151
|
export declare namespace Agent {
|
|
72
|
-
export { type AutomateEvent as AutomateEvent, type AgentAutomateParams as AgentAutomateParams };
|
|
152
|
+
export { type AutomateEvent as AutomateEvent, type ResearchEvent as ResearchEvent, type AgentAutomateParams as AgentAutomateParams, type AgentResearchParams as AgentResearchParams, };
|
|
73
153
|
}
|
|
74
154
|
//# sourceMappingURL=agent.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.mts","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,E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AEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,mBAAmB,CAAC;IACnC;;OAEG;IACH,UAAiB,SAAS;QACxB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/agent.d.ts
CHANGED
|
@@ -4,14 +4,19 @@ import { Stream } from "../core/streaming.js";
|
|
|
4
4
|
import { RequestOptions } from "../internal/request-options.js";
|
|
5
5
|
export declare class Agent extends APIResource {
|
|
6
6
|
/**
|
|
7
|
-
* Execute AI-powered browser automation tasks using natural language
|
|
8
|
-
* endpoint **always streams** responses using Server-Sent
|
|
7
|
+
* Execute AI-powered browser automation tasks using natural language with optional
|
|
8
|
+
* geotargeting. This endpoint **always streams** responses using Server-Sent
|
|
9
|
+
* Events (SSE).
|
|
9
10
|
*
|
|
10
11
|
* **Streaming Response:**
|
|
11
12
|
*
|
|
12
13
|
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
13
14
|
* - Real-time progress updates and results as they're generated
|
|
14
15
|
*
|
|
16
|
+
* **Geotargeting:**
|
|
17
|
+
*
|
|
18
|
+
* - Optionally specify a country code for geotargeted browsing
|
|
19
|
+
*
|
|
15
20
|
* **Use Cases:**
|
|
16
21
|
*
|
|
17
22
|
* - Web scraping and data extraction
|
|
@@ -31,6 +36,37 @@ export declare class Agent extends APIResource {
|
|
|
31
36
|
* ```
|
|
32
37
|
*/
|
|
33
38
|
automate(body: AgentAutomateParams, options?: RequestOptions): APIPromise<Stream<AutomateEvent>>;
|
|
39
|
+
/**
|
|
40
|
+
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
41
|
+
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
42
|
+
* using Server-Sent Events (SSE).
|
|
43
|
+
*
|
|
44
|
+
* **Streaming Response:**
|
|
45
|
+
*
|
|
46
|
+
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
47
|
+
* - Real-time progress updates as research progresses through phases
|
|
48
|
+
*
|
|
49
|
+
* **Research Modes:**
|
|
50
|
+
*
|
|
51
|
+
* - `fast` - Quick answers with minimal web searches
|
|
52
|
+
* - `balanced` - Standard research with multiple iterations (default)
|
|
53
|
+
*
|
|
54
|
+
* **Use Cases:**
|
|
55
|
+
*
|
|
56
|
+
* - Answering complex questions with cited sources
|
|
57
|
+
* - Synthesizing information from multiple web sources
|
|
58
|
+
* - Research reports on specific topics
|
|
59
|
+
* - Fact-checking and verification tasks
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const researchEvent = await client.agent.research({
|
|
64
|
+
* query:
|
|
65
|
+
* 'What are the latest developments in quantum computing?',
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
research(body: AgentResearchParams, options?: RequestOptions): APIPromise<Stream<ResearchEvent>>;
|
|
34
70
|
}
|
|
35
71
|
export interface AutomateEvent {
|
|
36
72
|
/**
|
|
@@ -42,6 +78,16 @@ export interface AutomateEvent {
|
|
|
42
78
|
*/
|
|
43
79
|
event?: string;
|
|
44
80
|
}
|
|
81
|
+
export interface ResearchEvent {
|
|
82
|
+
/**
|
|
83
|
+
* Event payload data
|
|
84
|
+
*/
|
|
85
|
+
data?: unknown;
|
|
86
|
+
/**
|
|
87
|
+
* The event type: phase, progress, complete, or error
|
|
88
|
+
*/
|
|
89
|
+
event?: 'phase' | 'progress' | 'complete' | 'error';
|
|
90
|
+
}
|
|
45
91
|
export interface AgentAutomateParams {
|
|
46
92
|
/**
|
|
47
93
|
* The task description in natural language
|
|
@@ -51,6 +97,10 @@ export interface AgentAutomateParams {
|
|
|
51
97
|
* JSON data to provide context for form filling or complex tasks
|
|
52
98
|
*/
|
|
53
99
|
data?: unknown;
|
|
100
|
+
/**
|
|
101
|
+
* Optional geotargeting parameters for proxy requests
|
|
102
|
+
*/
|
|
103
|
+
geo_target?: AgentAutomateParams.GeoTarget;
|
|
54
104
|
/**
|
|
55
105
|
* Safety constraints for execution
|
|
56
106
|
*/
|
|
@@ -68,7 +118,37 @@ export interface AgentAutomateParams {
|
|
|
68
118
|
*/
|
|
69
119
|
url?: string;
|
|
70
120
|
}
|
|
121
|
+
export declare namespace AgentAutomateParams {
|
|
122
|
+
/**
|
|
123
|
+
* Optional geotargeting parameters for proxy requests
|
|
124
|
+
*/
|
|
125
|
+
interface GeoTarget {
|
|
126
|
+
/**
|
|
127
|
+
* Country code using ISO 3166-1 alpha-2 standard (2 letters, e.g., "US", "GB",
|
|
128
|
+
* "JP"). See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
129
|
+
*/
|
|
130
|
+
country?: string;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export interface AgentResearchParams {
|
|
134
|
+
/**
|
|
135
|
+
* The research query or question to answer
|
|
136
|
+
*/
|
|
137
|
+
query: string;
|
|
138
|
+
/**
|
|
139
|
+
* Timeout in seconds for fetching web pages
|
|
140
|
+
*/
|
|
141
|
+
fetch_timeout?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Research mode: fast (quick answers), balanced (standard research, default)
|
|
144
|
+
*/
|
|
145
|
+
mode?: 'fast' | 'balanced';
|
|
146
|
+
/**
|
|
147
|
+
* Skip cache and force fresh research
|
|
148
|
+
*/
|
|
149
|
+
nocache?: boolean;
|
|
150
|
+
}
|
|
71
151
|
export declare namespace Agent {
|
|
72
|
-
export { type AutomateEvent as AutomateEvent, type AgentAutomateParams as AgentAutomateParams };
|
|
152
|
+
export { type AutomateEvent as AutomateEvent, type ResearchEvent as ResearchEvent, type AgentAutomateParams as AgentAutomateParams, type AgentResearchParams as AgentResearchParams, };
|
|
73
153
|
}
|
|
74
154
|
//# sourceMappingURL=agent.d.ts.map
|
package/resources/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OAEV,EAAE,cAAc,EAAE;AAEzB,qBAAa,KAAM,SAAQ,WAAW;IACpC
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OAEV,EAAE,cAAc,EAAE;AAEzB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAShG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;CAQjG;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;CACrD;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC;IAE3C;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,mBAAmB,CAAC;IACnC;;OAEG;IACH,UAAiB,SAAS;QACxB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/agent.js
CHANGED
|
@@ -6,14 +6,19 @@ const resource_1 = require("../core/resource.js");
|
|
|
6
6
|
const headers_1 = require("../internal/headers.js");
|
|
7
7
|
class Agent extends resource_1.APIResource {
|
|
8
8
|
/**
|
|
9
|
-
* Execute AI-powered browser automation tasks using natural language
|
|
10
|
-
* endpoint **always streams** responses using Server-Sent
|
|
9
|
+
* Execute AI-powered browser automation tasks using natural language with optional
|
|
10
|
+
* geotargeting. This endpoint **always streams** responses using Server-Sent
|
|
11
|
+
* Events (SSE).
|
|
11
12
|
*
|
|
12
13
|
* **Streaming Response:**
|
|
13
14
|
*
|
|
14
15
|
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
15
16
|
* - Real-time progress updates and results as they're generated
|
|
16
17
|
*
|
|
18
|
+
* **Geotargeting:**
|
|
19
|
+
*
|
|
20
|
+
* - Optionally specify a country code for geotargeted browsing
|
|
21
|
+
*
|
|
17
22
|
* **Use Cases:**
|
|
18
23
|
*
|
|
19
24
|
* - Web scraping and data extraction
|
|
@@ -40,6 +45,44 @@ class Agent extends resource_1.APIResource {
|
|
|
40
45
|
stream: true,
|
|
41
46
|
});
|
|
42
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
50
|
+
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
51
|
+
* using Server-Sent Events (SSE).
|
|
52
|
+
*
|
|
53
|
+
* **Streaming Response:**
|
|
54
|
+
*
|
|
55
|
+
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
56
|
+
* - Real-time progress updates as research progresses through phases
|
|
57
|
+
*
|
|
58
|
+
* **Research Modes:**
|
|
59
|
+
*
|
|
60
|
+
* - `fast` - Quick answers with minimal web searches
|
|
61
|
+
* - `balanced` - Standard research with multiple iterations (default)
|
|
62
|
+
*
|
|
63
|
+
* **Use Cases:**
|
|
64
|
+
*
|
|
65
|
+
* - Answering complex questions with cited sources
|
|
66
|
+
* - Synthesizing information from multiple web sources
|
|
67
|
+
* - Research reports on specific topics
|
|
68
|
+
* - Fact-checking and verification tasks
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const researchEvent = await client.agent.research({
|
|
73
|
+
* query:
|
|
74
|
+
* 'What are the latest developments in quantum computing?',
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
research(body, options) {
|
|
79
|
+
return this._client.post('/research', {
|
|
80
|
+
body,
|
|
81
|
+
...options,
|
|
82
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
83
|
+
stream: true,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
43
86
|
}
|
|
44
87
|
exports.Agent = Agent;
|
|
45
88
|
//# sourceMappingURL=agent.js.map
|
package/resources/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAGnD,MAAa,KAAM,SAAQ,sBAAW;IACpC
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAGnD,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAsC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAsC,CAAC;IAC1C,CAAC;CACF;AAhFD,sBAgFC"}
|
package/resources/agent.mjs
CHANGED
|
@@ -3,14 +3,19 @@ import { APIResource } from "../core/resource.mjs";
|
|
|
3
3
|
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
4
|
export class Agent extends APIResource {
|
|
5
5
|
/**
|
|
6
|
-
* Execute AI-powered browser automation tasks using natural language
|
|
7
|
-
* endpoint **always streams** responses using Server-Sent
|
|
6
|
+
* Execute AI-powered browser automation tasks using natural language with optional
|
|
7
|
+
* geotargeting. This endpoint **always streams** responses using Server-Sent
|
|
8
|
+
* Events (SSE).
|
|
8
9
|
*
|
|
9
10
|
* **Streaming Response:**
|
|
10
11
|
*
|
|
11
12
|
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
12
13
|
* - Real-time progress updates and results as they're generated
|
|
13
14
|
*
|
|
15
|
+
* **Geotargeting:**
|
|
16
|
+
*
|
|
17
|
+
* - Optionally specify a country code for geotargeted browsing
|
|
18
|
+
*
|
|
14
19
|
* **Use Cases:**
|
|
15
20
|
*
|
|
16
21
|
* - Web scraping and data extraction
|
|
@@ -37,5 +42,43 @@ export class Agent extends APIResource {
|
|
|
37
42
|
stream: true,
|
|
38
43
|
});
|
|
39
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Execute AI-powered research queries that search the web, analyze sources, and
|
|
47
|
+
* synthesize comprehensive answers. This endpoint **always streams** responses
|
|
48
|
+
* using Server-Sent Events (SSE).
|
|
49
|
+
*
|
|
50
|
+
* **Streaming Response:**
|
|
51
|
+
*
|
|
52
|
+
* - All responses are streamed using Server-Sent Events (`text/event-stream`)
|
|
53
|
+
* - Real-time progress updates as research progresses through phases
|
|
54
|
+
*
|
|
55
|
+
* **Research Modes:**
|
|
56
|
+
*
|
|
57
|
+
* - `fast` - Quick answers with minimal web searches
|
|
58
|
+
* - `balanced` - Standard research with multiple iterations (default)
|
|
59
|
+
*
|
|
60
|
+
* **Use Cases:**
|
|
61
|
+
*
|
|
62
|
+
* - Answering complex questions with cited sources
|
|
63
|
+
* - Synthesizing information from multiple web sources
|
|
64
|
+
* - Research reports on specific topics
|
|
65
|
+
* - Fact-checking and verification tasks
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const researchEvent = await client.agent.research({
|
|
70
|
+
* query:
|
|
71
|
+
* 'What are the latest developments in quantum computing?',
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
research(body, options) {
|
|
76
|
+
return this._client.post('/research', {
|
|
77
|
+
body,
|
|
78
|
+
...options,
|
|
79
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
80
|
+
stream: true,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
40
83
|
}
|
|
41
84
|
//# sourceMappingURL=agent.mjs.map
|
package/resources/agent.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.mjs","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;AAGvB,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC
|
|
1
|
+
{"version":3,"file":"agent.mjs","sourceRoot":"","sources":["../src/resources/agent.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;AAGvB,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAsC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,IAAyB,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI;SACb,CAAsC,CAAC;IAC1C,CAAC;CACF"}
|
package/resources/extract.d.mts
CHANGED
|
@@ -8,7 +8,31 @@ export declare class Extract extends APIResource {
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
|
10
10
|
* const response = await client.extract.json({
|
|
11
|
-
* json_schema: {
|
|
11
|
+
* json_schema: {
|
|
12
|
+
* properties: {
|
|
13
|
+
* stories: {
|
|
14
|
+
* items: {
|
|
15
|
+
* properties: {
|
|
16
|
+
* author: {
|
|
17
|
+
* description: 'Author username',
|
|
18
|
+
* type: 'string',
|
|
19
|
+
* },
|
|
20
|
+
* points: {
|
|
21
|
+
* description: 'Story points',
|
|
22
|
+
* type: 'number',
|
|
23
|
+
* },
|
|
24
|
+
* title: {
|
|
25
|
+
* description: 'Story title',
|
|
26
|
+
* type: 'string',
|
|
27
|
+
* },
|
|
28
|
+
* },
|
|
29
|
+
* type: 'object',
|
|
30
|
+
* },
|
|
31
|
+
* type: 'array',
|
|
32
|
+
* },
|
|
33
|
+
* },
|
|
34
|
+
* type: 'object',
|
|
35
|
+
* },
|
|
12
36
|
* url: 'https://news.ycombinator.com',
|
|
13
37
|
* });
|
|
14
38
|
* ```
|
|
@@ -53,6 +77,14 @@ export declare namespace ExtractMarkdownResponse {
|
|
|
53
77
|
* Author information from HTML metadata
|
|
54
78
|
*/
|
|
55
79
|
author?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Document creation date (ISO 8601)
|
|
82
|
+
*/
|
|
83
|
+
created_at?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Creator application (e.g., "Microsoft Word")
|
|
86
|
+
*/
|
|
87
|
+
creator?: string;
|
|
56
88
|
/**
|
|
57
89
|
* Page description from Open Graph or HTML
|
|
58
90
|
*/
|
|
@@ -61,6 +93,26 @@ export declare namespace ExtractMarkdownResponse {
|
|
|
61
93
|
* Featured image URL from Open Graph
|
|
62
94
|
*/
|
|
63
95
|
image?: string;
|
|
96
|
+
/**
|
|
97
|
+
* PDF keywords as array
|
|
98
|
+
*/
|
|
99
|
+
keywords?: Array<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Document modification date (ISO 8601)
|
|
102
|
+
*/
|
|
103
|
+
modified_at?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Number of pages (PDF documents)
|
|
106
|
+
*/
|
|
107
|
+
page_count?: number;
|
|
108
|
+
/**
|
|
109
|
+
* PDF version (e.g., "1.5")
|
|
110
|
+
*/
|
|
111
|
+
pdf_version?: string;
|
|
112
|
+
/**
|
|
113
|
+
* PDF producer software (e.g., "Adobe PDF Library")
|
|
114
|
+
*/
|
|
115
|
+
producer?: string;
|
|
64
116
|
/**
|
|
65
117
|
* Publisher information from Open Graph
|
|
66
118
|
*/
|
|
@@ -69,6 +121,11 @@ export declare namespace ExtractMarkdownResponse {
|
|
|
69
121
|
* Site name from Open Graph
|
|
70
122
|
*/
|
|
71
123
|
site_name?: string;
|
|
124
|
+
/**
|
|
125
|
+
* PDF-specific metadata fields (populated for PDF documents) PDF subject or
|
|
126
|
+
* summary
|
|
127
|
+
*/
|
|
128
|
+
subject?: string;
|
|
72
129
|
/**
|
|
73
130
|
* Page title from Open Graph or HTML
|
|
74
131
|
*/
|
|
@@ -92,16 +149,36 @@ export interface ExtractJsonParams {
|
|
|
92
149
|
* URL to fetch and extract data from
|
|
93
150
|
*/
|
|
94
151
|
url: string;
|
|
152
|
+
/**
|
|
153
|
+
* Optional geotargeting parameters for proxy requests
|
|
154
|
+
*/
|
|
155
|
+
geo_target?: ExtractJsonParams.GeoTarget;
|
|
95
156
|
/**
|
|
96
157
|
* Bypass cache and force fresh data retrieval
|
|
97
158
|
*/
|
|
98
159
|
nocache?: boolean;
|
|
99
160
|
}
|
|
161
|
+
export declare namespace ExtractJsonParams {
|
|
162
|
+
/**
|
|
163
|
+
* Optional geotargeting parameters for proxy requests
|
|
164
|
+
*/
|
|
165
|
+
interface GeoTarget {
|
|
166
|
+
/**
|
|
167
|
+
* Country code using ISO 3166-1 alpha-2 standard (2 letters, e.g., "US", "GB",
|
|
168
|
+
* "JP"). See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
169
|
+
*/
|
|
170
|
+
country?: string;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
100
173
|
export interface ExtractMarkdownParams {
|
|
101
174
|
/**
|
|
102
175
|
* URL to fetch and convert to markdown
|
|
103
176
|
*/
|
|
104
177
|
url: string;
|
|
178
|
+
/**
|
|
179
|
+
* Optional geotargeting parameters for proxy requests
|
|
180
|
+
*/
|
|
181
|
+
geo_target?: ExtractMarkdownParams.GeoTarget;
|
|
105
182
|
/**
|
|
106
183
|
* Include extracted metadata (Open Graph and HTML metadata) as a separate field in
|
|
107
184
|
* the response
|
|
@@ -112,6 +189,18 @@ export interface ExtractMarkdownParams {
|
|
|
112
189
|
*/
|
|
113
190
|
nocache?: boolean;
|
|
114
191
|
}
|
|
192
|
+
export declare namespace ExtractMarkdownParams {
|
|
193
|
+
/**
|
|
194
|
+
* Optional geotargeting parameters for proxy requests
|
|
195
|
+
*/
|
|
196
|
+
interface GeoTarget {
|
|
197
|
+
/**
|
|
198
|
+
* Country code using ISO 3166-1 alpha-2 standard (2 letters, e.g., "US", "GB",
|
|
199
|
+
* "JP"). See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
200
|
+
*/
|
|
201
|
+
country?: string;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
115
204
|
export declare namespace Extract {
|
|
116
205
|
export { type ExtractJsonResponse as ExtractJsonResponse, type ExtractMarkdownResponse as ExtractMarkdownResponse, type ExtractJsonParams as ExtractJsonParams, type ExtractMarkdownParams as ExtractMarkdownParams, };
|
|
117
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.mts","sourceRoot":"","sources":["../src/resources/extract.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC
|
|
1
|
+
{"version":3,"file":"extract.d.mts","sourceRoot":"","sources":["../src/resources/extract.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,IAAI,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;IAIxF;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;CAGrG;AAED,MAAM,MAAM,mBAAmB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAE7D,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,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