@athenaintel/sdk 4.3.2158 → 4.3.2160
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/README.md +17 -16
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +2 -2
- package/dist/cjs/Client.js +4 -4
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +1 -1
- package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -41
- package/dist/cjs/api/resources/agents/client/Client.js +2 -163
- package/dist/cjs/api/resources/agents/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/agents/client/index.js +0 -15
- package/dist/cjs/api/resources/agents/resources/general/client/Client.d.ts +2 -44
- package/dist/cjs/api/resources/agents/resources/general/client/Client.js +1 -163
- package/dist/cjs/api/resources/agents/resources/general/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/agents/resources/general/client/index.js +15 -0
- package/dist/cjs/api/{types → resources/agents/resources/general/client/requests}/GeneralAgentRequest.d.ts +11 -2
- package/dist/cjs/api/resources/agents/resources/general/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/agents/resources/index.d.ts +1 -6
- package/dist/cjs/api/resources/agents/resources/index.js +2 -7
- package/dist/cjs/api/resources/index.d.ts +0 -1
- package/dist/cjs/api/resources/index.js +3 -4
- package/dist/cjs/api/resources/tools/client/Client.d.ts +11 -0
- package/dist/cjs/api/resources/tools/client/Client.js +11 -0
- package/dist/cjs/api/resources/tools/resources/calendar/client/Client.d.ts +20 -13
- package/dist/cjs/api/resources/tools/resources/calendar/client/Client.js +70 -71
- package/dist/cjs/api/resources/tools/resources/calendar/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/calendar/client/index.js +15 -0
- package/dist/cjs/api/resources/tools/resources/calendar/client/requests/ListEventsCalendarRequest.d.ts +22 -0
- package/dist/cjs/api/resources/tools/resources/calendar/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/tools/resources/email/client/Client.d.ts +40 -16
- package/dist/cjs/api/resources/tools/resources/email/client/Client.js +105 -82
- package/dist/cjs/api/resources/tools/resources/email/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/email/client/index.js +15 -0
- package/dist/cjs/api/resources/tools/resources/email/client/requests/EmailDraftRequestIn.d.ts +27 -0
- package/dist/cjs/api/resources/tools/resources/email/client/requests/SearchEmailRequest.d.ts +15 -0
- package/dist/cjs/api/resources/tools/resources/email/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/tools/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/tools/resources/index.js +5 -3
- package/dist/cjs/api/types/CalendarAttendeeOut.d.ts +11 -0
- package/dist/cjs/api/types/CalendarEventOut.d.ts +28 -0
- package/dist/cjs/api/types/CalendarEventsResponseOut.d.ts +14 -0
- package/dist/cjs/api/types/EmailDraftResponseOut.d.ts +23 -0
- package/dist/cjs/api/types/EmailSearchResponseOut.d.ts +22 -0
- package/dist/cjs/api/types/EmailSearchResultOut.d.ts +25 -0
- package/dist/cjs/api/types/EmailSearchResultOut.js +3 -0
- package/dist/cjs/api/types/index.d.ts +6 -5
- package/dist/cjs/api/types/index.js +6 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +2 -2
- package/dist/esm/Client.mjs +4 -4
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +1 -1
- package/dist/esm/api/resources/agents/client/Client.d.mts +1 -41
- package/dist/esm/api/resources/agents/client/Client.mjs +0 -128
- package/dist/esm/api/resources/agents/client/index.d.mts +1 -1
- package/dist/esm/api/resources/agents/client/index.mjs +1 -1
- package/dist/esm/api/resources/agents/resources/general/client/Client.d.mts +2 -44
- package/dist/esm/api/resources/agents/resources/general/client/Client.mjs +1 -163
- package/dist/esm/api/resources/agents/resources/general/client/index.d.mts +1 -1
- package/dist/esm/api/resources/agents/resources/general/client/index.mjs +1 -1
- package/dist/esm/api/{types → resources/agents/resources/general/client/requests}/GeneralAgentRequest.d.mts +11 -2
- package/dist/esm/api/resources/agents/resources/general/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/agents/resources/index.d.mts +1 -6
- package/dist/esm/api/resources/agents/resources/index.mjs +1 -6
- package/dist/esm/api/resources/index.d.mts +0 -1
- package/dist/esm/api/resources/index.mjs +0 -1
- package/dist/esm/api/resources/tools/client/Client.d.mts +11 -0
- package/dist/esm/api/resources/tools/client/Client.mjs +11 -0
- package/dist/esm/api/resources/tools/resources/calendar/client/Client.d.mts +20 -13
- package/dist/esm/api/resources/tools/resources/calendar/client/Client.mjs +70 -71
- package/dist/esm/api/resources/tools/resources/calendar/client/index.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/calendar/client/index.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/calendar/client/requests/ListEventsCalendarRequest.d.mts +22 -0
- package/dist/esm/api/resources/tools/resources/calendar/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/tools/resources/email/client/Client.d.mts +40 -16
- package/dist/esm/api/resources/tools/resources/email/client/Client.mjs +105 -82
- package/dist/esm/api/resources/tools/resources/email/client/index.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/email/client/index.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/email/client/requests/EmailDraftRequestIn.d.mts +27 -0
- package/dist/esm/api/resources/tools/resources/email/client/requests/SearchEmailRequest.d.mts +15 -0
- package/dist/esm/api/resources/tools/resources/email/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/tools/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/tools/resources/index.mjs +2 -0
- package/dist/esm/api/types/CalendarAttendeeOut.d.mts +11 -0
- package/dist/esm/api/types/CalendarEventOut.d.mts +28 -0
- package/dist/esm/api/types/CalendarEventsResponseOut.d.mts +14 -0
- package/dist/esm/api/types/EmailDraftResponseOut.d.mts +23 -0
- package/dist/esm/api/types/EmailSearchResponseOut.d.mts +22 -0
- package/dist/esm/api/types/EmailSearchResultOut.d.mts +25 -0
- package/dist/esm/api/types/EmailSearchResultOut.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +6 -5
- package/dist/esm/api/types/index.mjs +6 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +61 -532
- package/dist/cjs/api/resources/agents/client/requests/CustomAgentRequest.d.ts +0 -20
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/client/Client.d.ts +0 -34
- package/dist/cjs/api/resources/agents/resources/drive/client/Client.js +0 -138
- package/dist/cjs/api/resources/agents/resources/drive/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/client/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/drive/client/requests/DriveAgentRequest.d.ts +0 -17
- package/dist/cjs/api/resources/agents/resources/drive/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/research/client/Client.d.ts +0 -34
- package/dist/cjs/api/resources/agents/resources/research/client/Client.js +0 -138
- package/dist/cjs/api/resources/agents/resources/research/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/research/client/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/research/client/requests/ResearchAgentRequest.d.ts +0 -17
- package/dist/cjs/api/resources/agents/resources/research/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/research/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/research/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/sql/client/Client.d.ts +0 -34
- package/dist/cjs/api/resources/agents/resources/sql/client/Client.js +0 -135
- package/dist/cjs/api/resources/agents/resources/sql/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/sql/client/index.js +0 -17
- package/dist/cjs/api/resources/agents/resources/sql/client/requests/SqlAgentRequest.d.ts +0 -17
- package/dist/cjs/api/resources/agents/resources/sql/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/sql/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/agents/resources/sql/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/sql/index.js +0 -17
- package/dist/cjs/api/types/CustomAgentResponse.d.ts +0 -4
- package/dist/cjs/api/types/DriveAgentResponse.d.ts +0 -4
- package/dist/cjs/api/types/ResearchAgentResponse.d.ts +0 -4
- package/dist/cjs/api/types/SqlAgentResponse.d.ts +0 -6
- package/dist/esm/api/resources/agents/client/requests/CustomAgentRequest.d.mts +0 -20
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/client/Client.d.mts +0 -34
- package/dist/esm/api/resources/agents/resources/drive/client/Client.mjs +0 -101
- package/dist/esm/api/resources/agents/resources/drive/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/drive/client/requests/DriveAgentRequest.d.mts +0 -17
- package/dist/esm/api/resources/agents/resources/drive/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/research/client/Client.d.mts +0 -34
- package/dist/esm/api/resources/agents/resources/research/client/Client.mjs +0 -101
- package/dist/esm/api/resources/agents/resources/research/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/research/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/research/client/requests/ResearchAgentRequest.d.mts +0 -17
- package/dist/esm/api/resources/agents/resources/research/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/research/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/research/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/Client.d.mts +0 -34
- package/dist/esm/api/resources/agents/resources/sql/client/Client.mjs +0 -98
- package/dist/esm/api/resources/agents/resources/sql/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/requests/SqlAgentRequest.d.mts +0 -17
- package/dist/esm/api/resources/agents/resources/sql/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/sql/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/sql/index.mjs +0 -1
- package/dist/esm/api/types/CustomAgentResponse.d.mts +0 -4
- package/dist/esm/api/types/DriveAgentResponse.d.mts +0 -4
- package/dist/esm/api/types/ResearchAgentResponse.d.mts +0 -4
- package/dist/esm/api/types/SqlAgentResponse.d.mts +0 -6
- /package/dist/cjs/api/{types → resources/agents/resources/general/client/requests}/GeneralAgentRequest.js +0 -0
- /package/dist/cjs/api/resources/agents/{client → resources/general/client}/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{agents/client/requests/CustomAgentRequest.js → tools/resources/calendar/client/requests/ListEventsCalendarRequest.js} +0 -0
- /package/dist/cjs/api/resources/{agents/resources/drive → tools/resources/calendar}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{agents/resources/drive/client/requests/DriveAgentRequest.js → tools/resources/email/client/requests/EmailDraftRequestIn.js} +0 -0
- /package/dist/cjs/api/resources/{agents/resources/research/client/requests/ResearchAgentRequest.js → tools/resources/email/client/requests/SearchEmailRequest.js} +0 -0
- /package/dist/cjs/api/resources/{agents/resources/research → tools/resources/email}/client/requests/index.js +0 -0
- /package/dist/cjs/api/{resources/agents/resources/sql/client/requests/SqlAgentRequest.js → types/CalendarAttendeeOut.js} +0 -0
- /package/dist/cjs/api/types/{CustomAgentResponse.js → CalendarEventOut.js} +0 -0
- /package/dist/cjs/api/types/{DriveAgentResponse.js → CalendarEventsResponseOut.js} +0 -0
- /package/dist/cjs/api/types/{ResearchAgentResponse.js → EmailDraftResponseOut.js} +0 -0
- /package/dist/cjs/api/types/{SqlAgentResponse.js → EmailSearchResponseOut.js} +0 -0
- /package/dist/esm/api/{types → resources/agents/resources/general/client/requests}/GeneralAgentRequest.mjs +0 -0
- /package/dist/esm/api/resources/agents/{client → resources/general/client}/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{agents/client/requests/CustomAgentRequest.mjs → tools/resources/calendar/client/requests/ListEventsCalendarRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{agents/resources/drive → tools/resources/calendar}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{agents/resources/drive/client/requests/DriveAgentRequest.mjs → tools/resources/email/client/requests/EmailDraftRequestIn.mjs} +0 -0
- /package/dist/esm/api/resources/{agents/resources/research/client/requests/ResearchAgentRequest.mjs → tools/resources/email/client/requests/SearchEmailRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{agents/resources/research → tools/resources/email}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/{resources/agents/resources/sql/client/requests/SqlAgentRequest.mjs → types/CalendarAttendeeOut.mjs} +0 -0
- /package/dist/esm/api/types/{CustomAgentResponse.mjs → CalendarEventOut.mjs} +0 -0
- /package/dist/esm/api/types/{DriveAgentResponse.mjs → CalendarEventsResponseOut.mjs} +0 -0
- /package/dist/esm/api/types/{ResearchAgentResponse.mjs → EmailDraftResponseOut.mjs} +0 -0
- /package/dist/esm/api/types/{SqlAgentResponse.mjs → EmailSearchResponseOut.mjs} +0 -0
package/README.md
CHANGED
|
@@ -41,14 +41,15 @@ Instantiate and use the client with the following:
|
|
|
41
41
|
import { AthenaIntelligenceClient } from "@athenaintel/sdk";
|
|
42
42
|
|
|
43
43
|
const client = new AthenaIntelligenceClient({ apiKey: "YOUR_API_KEY" });
|
|
44
|
-
await client.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
await client.aop.create({
|
|
45
|
+
agentId: "research_agent",
|
|
46
|
+
description: "Generates market research reports",
|
|
47
|
+
icon: "ListTodo",
|
|
48
|
+
parent_folder_id: "asset_folder_12345",
|
|
49
|
+
prompt: "Generate a comprehensive market research report for [[ company ]]",
|
|
50
|
+
section: "Research",
|
|
51
|
+
title: "Market Research Report",
|
|
52
|
+
workspace_id: "workspace_abc123"
|
|
52
53
|
});
|
|
53
54
|
```
|
|
54
55
|
|
|
@@ -60,7 +61,7 @@ following namespace:
|
|
|
60
61
|
```typescript
|
|
61
62
|
import { AthenaIntelligence } from "@athenaintel/sdk";
|
|
62
63
|
|
|
63
|
-
const request: AthenaIntelligence.
|
|
64
|
+
const request: AthenaIntelligence.AopCreateRequestIn = {
|
|
64
65
|
...
|
|
65
66
|
};
|
|
66
67
|
```
|
|
@@ -74,7 +75,7 @@ will be thrown.
|
|
|
74
75
|
import { AthenaIntelligenceError } from "@athenaintel/sdk";
|
|
75
76
|
|
|
76
77
|
try {
|
|
77
|
-
await client.
|
|
78
|
+
await client.aop.create(...);
|
|
78
79
|
} catch (err) {
|
|
79
80
|
if (err instanceof AthenaIntelligenceError) {
|
|
80
81
|
console.log(err.statusCode);
|
|
@@ -554,7 +555,7 @@ const response = page.response;
|
|
|
554
555
|
If you would like to send additional headers as part of the request, use the `headers` request option.
|
|
555
556
|
|
|
556
557
|
```typescript
|
|
557
|
-
const response = await client.
|
|
558
|
+
const response = await client.aop.create(..., {
|
|
558
559
|
headers: {
|
|
559
560
|
'X-Custom-Header': 'custom value'
|
|
560
561
|
}
|
|
@@ -566,7 +567,7 @@ const response = await client.agents.invokeById(..., {
|
|
|
566
567
|
If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
|
|
567
568
|
|
|
568
569
|
```typescript
|
|
569
|
-
const response = await client.
|
|
570
|
+
const response = await client.aop.create(..., {
|
|
570
571
|
queryParams: {
|
|
571
572
|
'customQueryParamKey': 'custom query param value'
|
|
572
573
|
}
|
|
@@ -588,7 +589,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
|
|
|
588
589
|
Use the `maxRetries` request option to configure this behavior.
|
|
589
590
|
|
|
590
591
|
```typescript
|
|
591
|
-
const response = await client.
|
|
592
|
+
const response = await client.aop.create(..., {
|
|
592
593
|
maxRetries: 0 // override maxRetries at the request level
|
|
593
594
|
});
|
|
594
595
|
```
|
|
@@ -598,7 +599,7 @@ const response = await client.agents.invokeById(..., {
|
|
|
598
599
|
The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
|
|
599
600
|
|
|
600
601
|
```typescript
|
|
601
|
-
const response = await client.
|
|
602
|
+
const response = await client.aop.create(..., {
|
|
602
603
|
timeoutInSeconds: 30 // override timeout to 30s
|
|
603
604
|
});
|
|
604
605
|
```
|
|
@@ -609,7 +610,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
|
|
|
609
610
|
|
|
610
611
|
```typescript
|
|
611
612
|
const controller = new AbortController();
|
|
612
|
-
const response = await client.
|
|
613
|
+
const response = await client.aop.create(..., {
|
|
613
614
|
abortSignal: controller.signal
|
|
614
615
|
});
|
|
615
616
|
controller.abort(); // aborts the request
|
|
@@ -621,7 +622,7 @@ The SDK provides access to raw response data, including headers, through the `.w
|
|
|
621
622
|
The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
|
|
622
623
|
|
|
623
624
|
```typescript
|
|
624
|
-
const { data, rawResponse } = await client.
|
|
625
|
+
const { data, rawResponse } = await client.aop.create(...).withRawResponse();
|
|
625
626
|
|
|
626
627
|
console.log(data);
|
|
627
628
|
console.log(rawResponse.headers['X-My-Header']);
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@athenaintel/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "4.3.
|
|
47
|
-
"User-Agent": "@athenaintel/sdk/4.3.
|
|
46
|
+
"X-Fern-SDK-Version": "4.3.2160",
|
|
47
|
+
"User-Agent": "@athenaintel/sdk/4.3.2160",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ export declare namespace AthenaIntelligenceClient {
|
|
|
22
22
|
}
|
|
23
23
|
export declare class AthenaIntelligenceClient {
|
|
24
24
|
protected readonly _options: NormalizedClientOptionsWithAuth<AthenaIntelligenceClient.Options>;
|
|
25
|
-
protected _agents: AgentsClient | undefined;
|
|
26
25
|
protected _aop: AopClient | undefined;
|
|
27
26
|
protected _assets: AssetsClient | undefined;
|
|
28
27
|
protected _collabAgents: CollabAgentsClient | undefined;
|
|
@@ -36,8 +35,8 @@ export declare class AthenaIntelligenceClient {
|
|
|
36
35
|
protected _threads: ThreadsClient | undefined;
|
|
37
36
|
protected _tools: ToolsClient | undefined;
|
|
38
37
|
protected _workspaces: WorkspacesClient | undefined;
|
|
38
|
+
protected _agents: AgentsClient | undefined;
|
|
39
39
|
constructor(options?: AthenaIntelligenceClient.Options);
|
|
40
|
-
get agents(): AgentsClient;
|
|
41
40
|
get aop(): AopClient;
|
|
42
41
|
get assets(): AssetsClient;
|
|
43
42
|
get collabAgents(): CollabAgentsClient;
|
|
@@ -51,4 +50,5 @@ export declare class AthenaIntelligenceClient {
|
|
|
51
50
|
get threads(): ThreadsClient;
|
|
52
51
|
get tools(): ToolsClient;
|
|
53
52
|
get workspaces(): WorkspacesClient;
|
|
53
|
+
get agents(): AgentsClient;
|
|
54
54
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -21,10 +21,6 @@ class AthenaIntelligenceClient {
|
|
|
21
21
|
constructor(options = {}) {
|
|
22
22
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
23
23
|
}
|
|
24
|
-
get agents() {
|
|
25
|
-
var _a;
|
|
26
|
-
return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new Client_js_1.AgentsClient(this._options)));
|
|
27
|
-
}
|
|
28
24
|
get aop() {
|
|
29
25
|
var _a;
|
|
30
26
|
return ((_a = this._aop) !== null && _a !== void 0 ? _a : (this._aop = new Client_js_2.AopClient(this._options)));
|
|
@@ -77,5 +73,9 @@ class AthenaIntelligenceClient {
|
|
|
77
73
|
var _a;
|
|
78
74
|
return ((_a = this._workspaces) !== null && _a !== void 0 ? _a : (this._workspaces = new Client_js_14.WorkspacesClient(this._options)));
|
|
79
75
|
}
|
|
76
|
+
get agents() {
|
|
77
|
+
var _a;
|
|
78
|
+
return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new Client_js_1.AgentsClient(this._options)));
|
|
79
|
+
}
|
|
80
80
|
}
|
|
81
81
|
exports.AthenaIntelligenceClient = AthenaIntelligenceClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as core from "../../core/index.js";
|
|
2
2
|
import * as errors from "../../errors/index.js";
|
|
3
3
|
export declare class TooManyRequestsError extends errors.AthenaIntelligenceError {
|
|
4
|
-
constructor(body
|
|
4
|
+
constructor(body?: unknown, rawResponse?: core.RawResponse);
|
|
5
5
|
}
|
|
@@ -1,53 +1,13 @@
|
|
|
1
|
-
import type { BaseClientOptions
|
|
1
|
+
import type { BaseClientOptions } from "../../../../BaseClient.js";
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
|
-
import * as core from "../../../../core/index.js";
|
|
4
|
-
import * as AthenaIntelligence from "../../../index.js";
|
|
5
|
-
import { DriveClient } from "../resources/drive/client/Client.js";
|
|
6
3
|
import { GeneralClient } from "../resources/general/client/Client.js";
|
|
7
|
-
import { ResearchClient } from "../resources/research/client/Client.js";
|
|
8
|
-
import { SqlClient } from "../resources/sql/client/Client.js";
|
|
9
4
|
export declare namespace AgentsClient {
|
|
10
5
|
interface Options extends BaseClientOptions {
|
|
11
6
|
}
|
|
12
|
-
interface RequestOptions extends BaseRequestOptions {
|
|
13
|
-
}
|
|
14
7
|
}
|
|
15
8
|
export declare class AgentsClient {
|
|
16
9
|
protected readonly _options: NormalizedClientOptionsWithAuth<AgentsClient.Options>;
|
|
17
|
-
protected _drive: DriveClient | undefined;
|
|
18
10
|
protected _general: GeneralClient | undefined;
|
|
19
|
-
protected _research: ResearchClient | undefined;
|
|
20
|
-
protected _sql: SqlClient | undefined;
|
|
21
11
|
constructor(options?: AgentsClient.Options);
|
|
22
|
-
get drive(): DriveClient;
|
|
23
12
|
get general(): GeneralClient;
|
|
24
|
-
get research(): ResearchClient;
|
|
25
|
-
get sql(): SqlClient;
|
|
26
|
-
/**
|
|
27
|
-
* Coming soon!
|
|
28
|
-
*
|
|
29
|
-
* Invoke a custom agent created in [spaces](https://resources.athenaintel.com/docs/agents/create-your-agent).
|
|
30
|
-
*
|
|
31
|
-
* Custom agents can be created and configured in spaces to perform specialized tasks.
|
|
32
|
-
* Refer to the specific agent's documentation for details on configuration options
|
|
33
|
-
* and expected responses.
|
|
34
|
-
*
|
|
35
|
-
* @param {AthenaIntelligence.CustomAgentRequest} request
|
|
36
|
-
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
37
|
-
*
|
|
38
|
-
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* await client.agents.invokeById({
|
|
42
|
-
* agent_id: "agent_id",
|
|
43
|
-
* config: {
|
|
44
|
-
* "key": "value"
|
|
45
|
-
* },
|
|
46
|
-
* messages: [{
|
|
47
|
-
* "key": "value"
|
|
48
|
-
* }]
|
|
49
|
-
* })
|
|
50
|
-
*/
|
|
51
|
-
invokeById(request: AthenaIntelligence.CustomAgentRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.CustomAgentResponse>;
|
|
52
|
-
private __invokeById;
|
|
53
13
|
}
|
|
@@ -1,177 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
-
var t = {};
|
|
47
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
-
t[p] = s[p];
|
|
49
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
-
t[p[i]] = s[p[i]];
|
|
53
|
-
}
|
|
54
|
-
return t;
|
|
55
|
-
};
|
|
56
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
4
|
exports.AgentsClient = void 0;
|
|
58
5
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
59
|
-
const
|
|
60
|
-
const core = __importStar(require("../../../../core/index.js"));
|
|
61
|
-
const environments = __importStar(require("../../../../environments.js"));
|
|
62
|
-
const errors = __importStar(require("../../../../errors/index.js"));
|
|
63
|
-
const AthenaIntelligence = __importStar(require("../../../index.js"));
|
|
64
|
-
const Client_js_1 = require("../resources/drive/client/Client.js");
|
|
65
|
-
const Client_js_2 = require("../resources/general/client/Client.js");
|
|
66
|
-
const Client_js_3 = require("../resources/research/client/Client.js");
|
|
67
|
-
const Client_js_4 = require("../resources/sql/client/Client.js");
|
|
6
|
+
const Client_js_1 = require("../resources/general/client/Client.js");
|
|
68
7
|
class AgentsClient {
|
|
69
8
|
constructor(options = {}) {
|
|
70
9
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
71
10
|
}
|
|
72
|
-
get drive() {
|
|
73
|
-
var _a;
|
|
74
|
-
return ((_a = this._drive) !== null && _a !== void 0 ? _a : (this._drive = new Client_js_1.DriveClient(this._options)));
|
|
75
|
-
}
|
|
76
11
|
get general() {
|
|
77
12
|
var _a;
|
|
78
|
-
return ((_a = this._general) !== null && _a !== void 0 ? _a : (this._general = new
|
|
79
|
-
}
|
|
80
|
-
get research() {
|
|
81
|
-
var _a;
|
|
82
|
-
return ((_a = this._research) !== null && _a !== void 0 ? _a : (this._research = new Client_js_3.ResearchClient(this._options)));
|
|
83
|
-
}
|
|
84
|
-
get sql() {
|
|
85
|
-
var _a;
|
|
86
|
-
return ((_a = this._sql) !== null && _a !== void 0 ? _a : (this._sql = new Client_js_4.SqlClient(this._options)));
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Coming soon!
|
|
90
|
-
*
|
|
91
|
-
* Invoke a custom agent created in [spaces](https://resources.athenaintel.com/docs/agents/create-your-agent).
|
|
92
|
-
*
|
|
93
|
-
* Custom agents can be created and configured in spaces to perform specialized tasks.
|
|
94
|
-
* Refer to the specific agent's documentation for details on configuration options
|
|
95
|
-
* and expected responses.
|
|
96
|
-
*
|
|
97
|
-
* @param {AthenaIntelligence.CustomAgentRequest} request
|
|
98
|
-
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
99
|
-
*
|
|
100
|
-
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* await client.agents.invokeById({
|
|
104
|
-
* agent_id: "agent_id",
|
|
105
|
-
* config: {
|
|
106
|
-
* "key": "value"
|
|
107
|
-
* },
|
|
108
|
-
* messages: [{
|
|
109
|
-
* "key": "value"
|
|
110
|
-
* }]
|
|
111
|
-
* })
|
|
112
|
-
*/
|
|
113
|
-
invokeById(request, requestOptions) {
|
|
114
|
-
return core.HttpResponsePromise.fromPromise(this.__invokeById(request, requestOptions));
|
|
115
|
-
}
|
|
116
|
-
__invokeById(request, requestOptions) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
119
|
-
const { agent_id: agentId } = request, _body = __rest(request, ["agent_id"]);
|
|
120
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
121
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
122
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
123
|
-
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, `api/v0/agents/${core.url.encodePathParam(agentId)}/invoke`),
|
|
124
|
-
method: "POST",
|
|
125
|
-
headers: _headers,
|
|
126
|
-
contentType: "application/json",
|
|
127
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
128
|
-
requestType: "json",
|
|
129
|
-
body: _body,
|
|
130
|
-
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
131
|
-
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
132
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
133
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
134
|
-
logging: this._options.logging,
|
|
135
|
-
});
|
|
136
|
-
if (_response.ok) {
|
|
137
|
-
return {
|
|
138
|
-
data: _response.body,
|
|
139
|
-
rawResponse: _response.rawResponse,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
if (_response.error.reason === "status-code") {
|
|
143
|
-
switch (_response.error.statusCode) {
|
|
144
|
-
case 422:
|
|
145
|
-
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
146
|
-
default:
|
|
147
|
-
throw new errors.AthenaIntelligenceError({
|
|
148
|
-
statusCode: _response.error.statusCode,
|
|
149
|
-
body: _response.error.body,
|
|
150
|
-
rawResponse: _response.rawResponse,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
switch (_response.error.reason) {
|
|
155
|
-
case "non-json":
|
|
156
|
-
throw new errors.AthenaIntelligenceError({
|
|
157
|
-
statusCode: _response.error.statusCode,
|
|
158
|
-
body: _response.error.rawBody,
|
|
159
|
-
rawResponse: _response.rawResponse,
|
|
160
|
-
});
|
|
161
|
-
case "body-is-null":
|
|
162
|
-
throw new errors.AthenaIntelligenceError({
|
|
163
|
-
statusCode: _response.error.statusCode,
|
|
164
|
-
rawResponse: _response.rawResponse,
|
|
165
|
-
});
|
|
166
|
-
case "timeout":
|
|
167
|
-
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/agents/{agent_id}/invoke.");
|
|
168
|
-
case "unknown":
|
|
169
|
-
throw new errors.AthenaIntelligenceError({
|
|
170
|
-
message: _response.error.errorMessage,
|
|
171
|
-
rawResponse: _response.rawResponse,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
});
|
|
13
|
+
return ((_a = this._general) !== null && _a !== void 0 ? _a : (this._general = new Client_js_1.GeneralClient(this._options)));
|
|
175
14
|
}
|
|
176
15
|
}
|
|
177
16
|
exports.AgentsClient = AgentsClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -11,34 +11,13 @@ export declare namespace GeneralClient {
|
|
|
11
11
|
export declare class GeneralClient {
|
|
12
12
|
protected readonly _options: NormalizedClientOptionsWithAuth<GeneralClient.Options>;
|
|
13
13
|
constructor(options?: GeneralClient.Options);
|
|
14
|
-
/**
|
|
15
|
-
* Coming soon! Call the general agent with batched requests and return the results.
|
|
16
|
-
*
|
|
17
|
-
* @param {AthenaIntelligence.GeneralAgentRequest[]} request
|
|
18
|
-
* @param {GeneralClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
|
-
*
|
|
20
|
-
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* await client.agents.general.batch([{
|
|
24
|
-
* config: {
|
|
25
|
-
* enabled_tools: ["search"]
|
|
26
|
-
* },
|
|
27
|
-
* messages: [{
|
|
28
|
-
* content: "Please call the search tool for AAPL news.",
|
|
29
|
-
* role: "user"
|
|
30
|
-
* }]
|
|
31
|
-
* }])
|
|
32
|
-
*/
|
|
33
|
-
batch(request: AthenaIntelligence.GeneralAgentRequest[], requestOptions?: GeneralClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.GeneralAgentResponse[]>;
|
|
34
|
-
private __batch;
|
|
35
14
|
/**
|
|
36
15
|
* Call the general Athena agent synchronously.
|
|
37
16
|
*
|
|
38
17
|
* Call the agent with the messages list, wait for the agent to complete,
|
|
39
18
|
* and return the result.
|
|
40
19
|
*
|
|
41
|
-
* @param {AthenaIntelligence.GeneralAgentRequest} request
|
|
20
|
+
* @param {AthenaIntelligence.agents.GeneralAgentRequest} request
|
|
42
21
|
* @param {GeneralClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
43
22
|
*
|
|
44
23
|
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
@@ -54,27 +33,6 @@ export declare class GeneralClient {
|
|
|
54
33
|
* }]
|
|
55
34
|
* })
|
|
56
35
|
*/
|
|
57
|
-
invoke(request: AthenaIntelligence.GeneralAgentRequest, requestOptions?: GeneralClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.GeneralAgentResponse>;
|
|
36
|
+
invoke(request: AthenaIntelligence.agents.GeneralAgentRequest, requestOptions?: GeneralClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.GeneralAgentResponse>;
|
|
58
37
|
private __invoke;
|
|
59
|
-
/**
|
|
60
|
-
* Coming soon! Call the general agent and stream events for real-time chat applications.
|
|
61
|
-
*
|
|
62
|
-
* @param {AthenaIntelligence.GeneralAgentRequest} request
|
|
63
|
-
* @param {GeneralClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
|
-
*
|
|
65
|
-
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* await client.agents.general.streamEvents({
|
|
69
|
-
* config: {
|
|
70
|
-
* enabled_tools: ["search"]
|
|
71
|
-
* },
|
|
72
|
-
* messages: [{
|
|
73
|
-
* content: "Please call the search tool for AAPL news.",
|
|
74
|
-
* role: "user"
|
|
75
|
-
* }]
|
|
76
|
-
* })
|
|
77
|
-
*/
|
|
78
|
-
streamEvents(request: AthenaIntelligence.GeneralAgentRequest, requestOptions?: GeneralClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.GeneralAgentResponse>;
|
|
79
|
-
private __streamEvents;
|
|
80
38
|
}
|
|
@@ -54,94 +54,13 @@ class GeneralClient {
|
|
|
54
54
|
constructor(options = {}) {
|
|
55
55
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Coming soon! Call the general agent with batched requests and return the results.
|
|
59
|
-
*
|
|
60
|
-
* @param {AthenaIntelligence.GeneralAgentRequest[]} request
|
|
61
|
-
* @param {GeneralClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
|
-
*
|
|
63
|
-
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* await client.agents.general.batch([{
|
|
67
|
-
* config: {
|
|
68
|
-
* enabled_tools: ["search"]
|
|
69
|
-
* },
|
|
70
|
-
* messages: [{
|
|
71
|
-
* content: "Please call the search tool for AAPL news.",
|
|
72
|
-
* role: "user"
|
|
73
|
-
* }]
|
|
74
|
-
* }])
|
|
75
|
-
*/
|
|
76
|
-
batch(request, requestOptions) {
|
|
77
|
-
return core.HttpResponsePromise.fromPromise(this.__batch(request, requestOptions));
|
|
78
|
-
}
|
|
79
|
-
__batch(request, requestOptions) {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
82
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
83
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
84
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
85
|
-
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/agents/general/batch"),
|
|
86
|
-
method: "POST",
|
|
87
|
-
headers: _headers,
|
|
88
|
-
contentType: "application/json",
|
|
89
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
90
|
-
requestType: "json",
|
|
91
|
-
body: request,
|
|
92
|
-
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
93
|
-
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
94
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
95
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
96
|
-
logging: this._options.logging,
|
|
97
|
-
});
|
|
98
|
-
if (_response.ok) {
|
|
99
|
-
return {
|
|
100
|
-
data: _response.body,
|
|
101
|
-
rawResponse: _response.rawResponse,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
if (_response.error.reason === "status-code") {
|
|
105
|
-
switch (_response.error.statusCode) {
|
|
106
|
-
case 422:
|
|
107
|
-
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
108
|
-
default:
|
|
109
|
-
throw new errors.AthenaIntelligenceError({
|
|
110
|
-
statusCode: _response.error.statusCode,
|
|
111
|
-
body: _response.error.body,
|
|
112
|
-
rawResponse: _response.rawResponse,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
switch (_response.error.reason) {
|
|
117
|
-
case "non-json":
|
|
118
|
-
throw new errors.AthenaIntelligenceError({
|
|
119
|
-
statusCode: _response.error.statusCode,
|
|
120
|
-
body: _response.error.rawBody,
|
|
121
|
-
rawResponse: _response.rawResponse,
|
|
122
|
-
});
|
|
123
|
-
case "body-is-null":
|
|
124
|
-
throw new errors.AthenaIntelligenceError({
|
|
125
|
-
statusCode: _response.error.statusCode,
|
|
126
|
-
rawResponse: _response.rawResponse,
|
|
127
|
-
});
|
|
128
|
-
case "timeout":
|
|
129
|
-
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/agents/general/batch.");
|
|
130
|
-
case "unknown":
|
|
131
|
-
throw new errors.AthenaIntelligenceError({
|
|
132
|
-
message: _response.error.errorMessage,
|
|
133
|
-
rawResponse: _response.rawResponse,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
57
|
/**
|
|
139
58
|
* Call the general Athena agent synchronously.
|
|
140
59
|
*
|
|
141
60
|
* Call the agent with the messages list, wait for the agent to complete,
|
|
142
61
|
* and return the result.
|
|
143
62
|
*
|
|
144
|
-
* @param {AthenaIntelligence.GeneralAgentRequest} request
|
|
63
|
+
* @param {AthenaIntelligence.agents.GeneralAgentRequest} request
|
|
145
64
|
* @param {GeneralClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
146
65
|
*
|
|
147
66
|
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
@@ -219,86 +138,5 @@ class GeneralClient {
|
|
|
219
138
|
}
|
|
220
139
|
});
|
|
221
140
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Coming soon! Call the general agent and stream events for real-time chat applications.
|
|
224
|
-
*
|
|
225
|
-
* @param {AthenaIntelligence.GeneralAgentRequest} request
|
|
226
|
-
* @param {GeneralClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
227
|
-
*
|
|
228
|
-
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
229
|
-
*
|
|
230
|
-
* @example
|
|
231
|
-
* await client.agents.general.streamEvents({
|
|
232
|
-
* config: {
|
|
233
|
-
* enabled_tools: ["search"]
|
|
234
|
-
* },
|
|
235
|
-
* messages: [{
|
|
236
|
-
* content: "Please call the search tool for AAPL news.",
|
|
237
|
-
* role: "user"
|
|
238
|
-
* }]
|
|
239
|
-
* })
|
|
240
|
-
*/
|
|
241
|
-
streamEvents(request, requestOptions) {
|
|
242
|
-
return core.HttpResponsePromise.fromPromise(this.__streamEvents(request, requestOptions));
|
|
243
|
-
}
|
|
244
|
-
__streamEvents(request, requestOptions) {
|
|
245
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
247
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
248
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
249
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
250
|
-
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/agents/general/stream_events"),
|
|
251
|
-
method: "POST",
|
|
252
|
-
headers: _headers,
|
|
253
|
-
contentType: "application/json",
|
|
254
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
255
|
-
requestType: "json",
|
|
256
|
-
body: request,
|
|
257
|
-
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
258
|
-
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
259
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
260
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
261
|
-
logging: this._options.logging,
|
|
262
|
-
});
|
|
263
|
-
if (_response.ok) {
|
|
264
|
-
return {
|
|
265
|
-
data: _response.body,
|
|
266
|
-
rawResponse: _response.rawResponse,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
if (_response.error.reason === "status-code") {
|
|
270
|
-
switch (_response.error.statusCode) {
|
|
271
|
-
case 422:
|
|
272
|
-
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
273
|
-
default:
|
|
274
|
-
throw new errors.AthenaIntelligenceError({
|
|
275
|
-
statusCode: _response.error.statusCode,
|
|
276
|
-
body: _response.error.body,
|
|
277
|
-
rawResponse: _response.rawResponse,
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
switch (_response.error.reason) {
|
|
282
|
-
case "non-json":
|
|
283
|
-
throw new errors.AthenaIntelligenceError({
|
|
284
|
-
statusCode: _response.error.statusCode,
|
|
285
|
-
body: _response.error.rawBody,
|
|
286
|
-
rawResponse: _response.rawResponse,
|
|
287
|
-
});
|
|
288
|
-
case "body-is-null":
|
|
289
|
-
throw new errors.AthenaIntelligenceError({
|
|
290
|
-
statusCode: _response.error.statusCode,
|
|
291
|
-
rawResponse: _response.rawResponse,
|
|
292
|
-
});
|
|
293
|
-
case "timeout":
|
|
294
|
-
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/agents/general/stream_events.");
|
|
295
|
-
case "unknown":
|
|
296
|
-
throw new errors.AthenaIntelligenceError({
|
|
297
|
-
message: _response.error.errorMessage,
|
|
298
|
-
rawResponse: _response.rawResponse,
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
141
|
}
|
|
304
142
|
exports.GeneralClient = GeneralClient;
|