@chrt-inc/typescript-sdk 1.1025.0 → 1.1027.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.
Files changed (145) hide show
  1. package/README.md +12 -9
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/chrtGpt/client/Client.d.ts +6 -13
  4. package/dist/cjs/api/resources/chrtGpt/client/Client.js +24 -17
  5. package/dist/cjs/api/resources/chrtGpt/client/requests/ChrtGptReq.d.ts +38 -0
  6. package/dist/cjs/api/resources/chrtGpt/client/requests/ChrtGptReq.js +19 -0
  7. package/dist/cjs/api/resources/chrtGpt/client/requests/index.d.ts +1 -1
  8. package/dist/cjs/api/resources/chrtGpt/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/chrtGpt/index.js +1 -0
  10. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/Client.d.ts +96 -0
  11. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/Client.js +337 -0
  12. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/index.d.ts +2 -0
  13. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/index.js +17 -0
  14. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsDeleteManyReq.d.ts +13 -0
  15. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsUpdateTitleReq.d.ts +12 -0
  16. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.d.ts +21 -0
  17. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.js +5 -0
  18. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/index.d.ts +3 -0
  19. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/index.js +2 -0
  20. package/dist/cjs/api/resources/chrtGpt/resources/conversations/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/chrtGpt/resources/conversations/index.js +17 -0
  22. package/dist/cjs/api/resources/chrtGpt/resources/index.d.ts +2 -0
  23. package/dist/cjs/api/resources/chrtGpt/resources/index.js +41 -0
  24. package/dist/cjs/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.d.ts +1 -0
  25. package/dist/cjs/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.js +1 -0
  26. package/dist/cjs/api/types/ChrtGptAssistantMessageItem.d.ts +8 -0
  27. package/dist/cjs/api/types/ChrtGptAssistantMessageItem.js +5 -0
  28. package/dist/cjs/api/types/ChrtGptCompletedEvent.d.ts +15 -0
  29. package/dist/cjs/api/types/ChrtGptCompletedEvent.js +5 -0
  30. package/dist/cjs/api/types/ChrtGptConversation1.d.ts +22 -0
  31. package/dist/cjs/api/types/ChrtGptConversation1.js +5 -0
  32. package/dist/cjs/api/types/ChrtGptConversationListRes.d.ts +8 -0
  33. package/dist/cjs/api/types/ChrtGptConversationListRes.js +5 -0
  34. package/dist/cjs/api/types/ChrtGptConversationRes.d.ts +11 -0
  35. package/dist/cjs/api/types/ChrtGptConversationRes.js +5 -0
  36. package/dist/cjs/api/types/ChrtGptConversationSortByEnum.d.ts +8 -0
  37. package/dist/cjs/api/types/ChrtGptConversationSortByEnum.js +10 -0
  38. package/dist/cjs/api/types/ChrtGptConversationTitleSourceEnum1.d.ts +9 -0
  39. package/dist/cjs/api/types/ChrtGptConversationTitleSourceEnum1.js +11 -0
  40. package/dist/cjs/api/types/ChrtGptConversationsDeleteManyRes.d.ts +7 -0
  41. package/dist/cjs/api/types/ChrtGptConversationsDeleteManyRes.js +5 -0
  42. package/dist/cjs/api/types/ChrtGptErrorEvent.d.ts +9 -0
  43. package/dist/cjs/api/types/ChrtGptErrorEvent.js +5 -0
  44. package/dist/cjs/api/types/ChrtGptEvent.d.ts +28 -0
  45. package/dist/cjs/api/types/ChrtGptEvent.js +5 -0
  46. package/dist/cjs/api/types/ChrtGptHistoryItem.d.ts +22 -0
  47. package/dist/cjs/api/types/ChrtGptHistoryItem.js +5 -0
  48. package/dist/{esm/api/types/ChrtGptMessageRes.d.mts → cjs/api/types/ChrtGptStartedEvent.d.ts} +4 -2
  49. package/dist/cjs/api/types/ChrtGptStartedEvent.js +5 -0
  50. package/dist/cjs/api/types/ChrtGptTextDeltaEvent.d.ts +8 -0
  51. package/dist/cjs/api/types/ChrtGptTextDeltaEvent.js +5 -0
  52. package/dist/cjs/api/types/ChrtGptToolCalledEvent.d.ts +12 -0
  53. package/dist/cjs/api/types/ChrtGptToolCalledEvent.js +5 -0
  54. package/dist/cjs/api/types/ChrtGptToolOutputEvent.d.ts +9 -0
  55. package/dist/cjs/api/types/ChrtGptToolOutputEvent.js +5 -0
  56. package/dist/cjs/api/types/ChrtGptUserMessageItem.d.ts +6 -0
  57. package/dist/cjs/api/types/ChrtGptUserMessageItem.js +5 -0
  58. package/dist/cjs/api/types/ChrtGptWebSearchEvent.d.ts +18 -0
  59. package/dist/cjs/api/types/ChrtGptWebSearchEvent.js +5 -0
  60. package/dist/cjs/api/types/index.d.ts +17 -1
  61. package/dist/cjs/api/types/index.js +17 -1
  62. package/dist/cjs/core/index.d.ts +1 -0
  63. package/dist/cjs/core/index.js +1 -0
  64. package/dist/cjs/core/stream/Stream.d.ts +46 -0
  65. package/dist/cjs/core/stream/Stream.js +169 -0
  66. package/dist/cjs/core/stream/index.d.ts +1 -0
  67. package/dist/cjs/core/stream/index.js +5 -0
  68. package/dist/cjs/version.d.ts +1 -1
  69. package/dist/cjs/version.js +1 -1
  70. package/dist/esm/Client.mjs +2 -2
  71. package/dist/esm/api/resources/chrtGpt/client/Client.d.mts +6 -13
  72. package/dist/esm/api/resources/chrtGpt/client/Client.mjs +24 -17
  73. package/dist/esm/api/resources/chrtGpt/client/requests/ChrtGptReq.d.mts +38 -0
  74. package/dist/esm/api/resources/chrtGpt/client/requests/ChrtGptReq.mjs +16 -0
  75. package/dist/esm/api/resources/chrtGpt/client/requests/index.d.mts +1 -1
  76. package/dist/esm/api/resources/chrtGpt/index.d.mts +1 -0
  77. package/dist/esm/api/resources/chrtGpt/index.mjs +1 -0
  78. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/Client.d.mts +96 -0
  79. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/Client.mjs +300 -0
  80. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/index.d.mts +2 -0
  81. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/index.mjs +1 -0
  82. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsDeleteManyReq.d.mts +13 -0
  83. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsUpdateTitleReq.d.mts +12 -0
  84. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.d.mts +21 -0
  85. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.mjs +4 -0
  86. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/index.d.mts +3 -0
  87. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/index.mjs +1 -0
  88. package/dist/esm/api/resources/chrtGpt/resources/conversations/index.d.mts +1 -0
  89. package/dist/esm/api/resources/chrtGpt/resources/conversations/index.mjs +1 -0
  90. package/dist/esm/api/resources/chrtGpt/resources/index.d.mts +2 -0
  91. package/dist/esm/api/resources/chrtGpt/resources/index.mjs +2 -0
  92. package/dist/esm/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.d.mts +1 -0
  93. package/dist/esm/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.mjs +1 -0
  94. package/dist/esm/api/types/ChrtGptAssistantMessageItem.d.mts +8 -0
  95. package/dist/esm/api/types/ChrtGptAssistantMessageItem.mjs +4 -0
  96. package/dist/esm/api/types/ChrtGptCompletedEvent.d.mts +15 -0
  97. package/dist/esm/api/types/ChrtGptCompletedEvent.mjs +4 -0
  98. package/dist/esm/api/types/ChrtGptConversation1.d.mts +22 -0
  99. package/dist/esm/api/types/ChrtGptConversation1.mjs +4 -0
  100. package/dist/esm/api/types/ChrtGptConversationListRes.d.mts +8 -0
  101. package/dist/esm/api/types/ChrtGptConversationListRes.mjs +4 -0
  102. package/dist/esm/api/types/ChrtGptConversationRes.d.mts +11 -0
  103. package/dist/esm/api/types/ChrtGptConversationRes.mjs +4 -0
  104. package/dist/esm/api/types/ChrtGptConversationSortByEnum.d.mts +8 -0
  105. package/dist/esm/api/types/ChrtGptConversationSortByEnum.mjs +7 -0
  106. package/dist/esm/api/types/ChrtGptConversationTitleSourceEnum1.d.mts +9 -0
  107. package/dist/esm/api/types/ChrtGptConversationTitleSourceEnum1.mjs +8 -0
  108. package/dist/esm/api/types/ChrtGptConversationsDeleteManyRes.d.mts +7 -0
  109. package/dist/esm/api/types/ChrtGptConversationsDeleteManyRes.mjs +4 -0
  110. package/dist/esm/api/types/ChrtGptErrorEvent.d.mts +9 -0
  111. package/dist/esm/api/types/ChrtGptErrorEvent.mjs +4 -0
  112. package/dist/esm/api/types/ChrtGptEvent.d.mts +28 -0
  113. package/dist/esm/api/types/ChrtGptEvent.mjs +4 -0
  114. package/dist/esm/api/types/ChrtGptHistoryItem.d.mts +22 -0
  115. package/dist/esm/api/types/ChrtGptHistoryItem.mjs +4 -0
  116. package/dist/{cjs/api/types/ChrtGptMessageRes.d.ts → esm/api/types/ChrtGptStartedEvent.d.mts} +4 -2
  117. package/dist/esm/api/types/ChrtGptStartedEvent.mjs +4 -0
  118. package/dist/esm/api/types/ChrtGptTextDeltaEvent.d.mts +8 -0
  119. package/dist/esm/api/types/ChrtGptTextDeltaEvent.mjs +4 -0
  120. package/dist/esm/api/types/ChrtGptToolCalledEvent.d.mts +12 -0
  121. package/dist/esm/api/types/ChrtGptToolCalledEvent.mjs +4 -0
  122. package/dist/esm/api/types/ChrtGptToolOutputEvent.d.mts +9 -0
  123. package/dist/esm/api/types/ChrtGptToolOutputEvent.mjs +4 -0
  124. package/dist/esm/api/types/ChrtGptUserMessageItem.d.mts +6 -0
  125. package/dist/esm/api/types/ChrtGptUserMessageItem.mjs +4 -0
  126. package/dist/esm/api/types/ChrtGptWebSearchEvent.d.mts +18 -0
  127. package/dist/esm/api/types/ChrtGptWebSearchEvent.mjs +4 -0
  128. package/dist/esm/api/types/index.d.mts +17 -1
  129. package/dist/esm/api/types/index.mjs +17 -1
  130. package/dist/esm/core/index.d.mts +1 -0
  131. package/dist/esm/core/index.mjs +1 -0
  132. package/dist/esm/core/stream/Stream.d.mts +46 -0
  133. package/dist/esm/core/stream/Stream.mjs +164 -0
  134. package/dist/esm/core/stream/index.d.mts +1 -0
  135. package/dist/esm/core/stream/index.mjs +1 -0
  136. package/dist/esm/version.d.mts +1 -1
  137. package/dist/esm/version.mjs +1 -1
  138. package/package.json +1 -1
  139. package/reference.md +279 -4
  140. package/dist/cjs/api/resources/chrtGpt/client/requests/ChrtGptMessageReq.d.ts +0 -14
  141. package/dist/esm/api/resources/chrtGpt/client/requests/ChrtGptMessageReq.d.mts +0 -14
  142. /package/dist/cjs/api/resources/chrtGpt/{client/requests/ChrtGptMessageReq.js → resources/conversations/client/requests/ChrtGptConversationsDeleteManyReq.js} +0 -0
  143. /package/dist/cjs/api/{types/ChrtGptMessageRes.js → resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsUpdateTitleReq.js} +0 -0
  144. /package/dist/esm/api/resources/chrtGpt/{client/requests/ChrtGptMessageReq.mjs → resources/conversations/client/requests/ChrtGptConversationsDeleteManyReq.mjs} +0 -0
  145. /package/dist/esm/api/{types/ChrtGptMessageRes.mjs → resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsUpdateTitleReq.mjs} +0 -0
package/README.md CHANGED
@@ -41,9 +41,12 @@ Instantiate and use the client with the following:
41
41
  import { ChrtClient } from "@chrt-inc/typescript-sdk";
42
42
 
43
43
  const client = new ChrtClient({ token: "YOUR_TOKEN" });
44
- await client.chrtGpt.messageV1({
44
+ const response = await client.chrtGpt.postV1({
45
45
  message: "message",
46
46
  });
47
+ for await (const item of response) {
48
+ console.log(item);
49
+ }
47
50
  ```
48
51
 
49
52
  ## Request and Response Types
@@ -54,7 +57,7 @@ following namespace:
54
57
  ```typescript
55
58
  import { Chrt } from "@chrt-inc/typescript-sdk";
56
59
 
57
- const request: Chrt.ChrtGptMessageReq = {
60
+ const request: Chrt.ChrtGptReq = {
58
61
  ...
59
62
  };
60
63
  ```
@@ -68,7 +71,7 @@ will be thrown.
68
71
  import { ChrtError } from "@chrt-inc/typescript-sdk";
69
72
 
70
73
  try {
71
- await client.chrtGpt.messageV1(...);
74
+ await client.chrtGpt.postV1(...);
72
75
  } catch (err) {
73
76
  if (err instanceof ChrtError) {
74
77
  console.log(err.statusCode);
@@ -476,7 +479,7 @@ const text = new TextDecoder().decode(bytes);
476
479
  If you would like to send additional headers as part of the request, use the `headers` request option.
477
480
 
478
481
  ```typescript
479
- const response = await client.chrtGpt.messageV1(..., {
482
+ const response = await client.chrtGpt.postV1(..., {
480
483
  headers: {
481
484
  'X-Custom-Header': 'custom value'
482
485
  }
@@ -488,7 +491,7 @@ const response = await client.chrtGpt.messageV1(..., {
488
491
  If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
489
492
 
490
493
  ```typescript
491
- const response = await client.chrtGpt.messageV1(..., {
494
+ const response = await client.chrtGpt.postV1(..., {
492
495
  queryParams: {
493
496
  'customQueryParamKey': 'custom query param value'
494
497
  }
@@ -510,7 +513,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
510
513
  Use the `maxRetries` request option to configure this behavior.
511
514
 
512
515
  ```typescript
513
- const response = await client.chrtGpt.messageV1(..., {
516
+ const response = await client.chrtGpt.postV1(..., {
514
517
  maxRetries: 0 // override maxRetries at the request level
515
518
  });
516
519
  ```
@@ -520,7 +523,7 @@ const response = await client.chrtGpt.messageV1(..., {
520
523
  The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
521
524
 
522
525
  ```typescript
523
- const response = await client.chrtGpt.messageV1(..., {
526
+ const response = await client.chrtGpt.postV1(..., {
524
527
  timeoutInSeconds: 30 // override timeout to 30s
525
528
  });
526
529
  ```
@@ -531,7 +534,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
531
534
 
532
535
  ```typescript
533
536
  const controller = new AbortController();
534
- const response = await client.chrtGpt.messageV1(..., {
537
+ const response = await client.chrtGpt.postV1(..., {
535
538
  abortSignal: controller.signal
536
539
  });
537
540
  controller.abort(); // aborts the request
@@ -543,7 +546,7 @@ The SDK provides access to raw response data, including headers, through the `.w
543
546
  The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
544
547
 
545
548
  ```typescript
546
- const { data, rawResponse } = await client.chrtGpt.messageV1(...).withRawResponse();
549
+ const { data, rawResponse } = await client.chrtGpt.postV1(...).withRawResponse();
547
550
 
548
551
  console.log(data);
549
552
  console.log(rawResponse.headers['X-My-Header']);
@@ -62,8 +62,8 @@ class ChrtClient {
62
62
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
63
63
  "X-Fern-Language": "JavaScript",
64
64
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
65
- "X-Fern-SDK-Version": "1.1025.0",
66
- "User-Agent": "@chrt-inc/typescript-sdk/1.1025.0",
65
+ "X-Fern-SDK-Version": "1.1027.0",
66
+ "User-Agent": "@chrt-inc/typescript-sdk/1.1027.0",
67
67
  "X-Fern-Runtime": core.RUNTIME.type,
68
68
  "X-Fern-Runtime-Version": core.RUNTIME.version,
69
69
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -4,6 +4,7 @@
4
4
  import * as environments from "../../../../environments.js";
5
5
  import * as core from "../../../../core/index.js";
6
6
  import * as Chrt from "../../../index.js";
7
+ import { Conversations } from "../resources/conversations/client/Client.js";
7
8
  export declare namespace ChrtGpt {
8
9
  interface Options {
9
10
  environment?: core.Supplier<environments.ChrtEnvironment | string>;
@@ -29,21 +30,13 @@ export declare namespace ChrtGpt {
29
30
  }
30
31
  export declare class ChrtGpt {
31
32
  protected readonly _options: ChrtGpt.Options;
33
+ protected _conversations: Conversations | undefined;
32
34
  constructor(_options?: ChrtGpt.Options);
35
+ get conversations(): Conversations;
33
36
  /**
34
- * Sends a message to ChrtGPT and returns its reply, starting a new conversation when no conversation_id is given. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTMessageReq) -> (ChrtGPTMessageRes)
35
- *
36
- * @param {Chrt.ChrtGptMessageReq} request
37
- * @param {ChrtGpt.RequestOptions} requestOptions - Request-specific configuration.
38
- *
39
- * @throws {@link Chrt.UnprocessableEntityError}
40
- *
41
- * @example
42
- * await client.chrtGpt.messageV1({
43
- * message: "message"
44
- * })
37
+ * Sends a message to ChrtGPT and streams its reply, starting a new conversation when no conversation_id is given. In the background, retitles the conversation after each of its first 3 turns and updates its summary and order identifiers after every turn. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTReq) -> (stream[ChrtGPTEvent])
45
38
  */
46
- messageV1(request: Chrt.ChrtGptMessageReq, requestOptions?: ChrtGpt.RequestOptions): core.HttpResponsePromise<Chrt.ChrtGptMessageRes>;
47
- private __messageV1;
39
+ postV1(request: Chrt.ChrtGptReq, requestOptions?: ChrtGpt.RequestOptions): core.HttpResponsePromise<core.Stream<Chrt.ChrtGptEvent>>;
40
+ private __postV1;
48
41
  protected _getAuthorizationHeader(): Promise<string | undefined>;
49
42
  }
@@ -51,44 +51,51 @@ const core = __importStar(require("../../../../core/index.js"));
51
51
  const Chrt = __importStar(require("../../../index.js"));
52
52
  const headers_js_1 = require("../../../../core/headers.js");
53
53
  const errors = __importStar(require("../../../../errors/index.js"));
54
+ const Client_js_1 = require("../resources/conversations/client/Client.js");
54
55
  class ChrtGpt {
55
56
  constructor(_options = {}) {
56
57
  this._options = _options;
57
58
  }
59
+ get conversations() {
60
+ var _a;
61
+ return ((_a = this._conversations) !== null && _a !== void 0 ? _a : (this._conversations = new Client_js_1.Conversations(this._options)));
62
+ }
58
63
  /**
59
- * Sends a message to ChrtGPT and returns its reply, starting a new conversation when no conversation_id is given. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTMessageReq) -> (ChrtGPTMessageRes)
60
- *
61
- * @param {Chrt.ChrtGptMessageReq} request
62
- * @param {ChrtGpt.RequestOptions} requestOptions - Request-specific configuration.
63
- *
64
- * @throws {@link Chrt.UnprocessableEntityError}
65
- *
66
- * @example
67
- * await client.chrtGpt.messageV1({
68
- * message: "message"
69
- * })
64
+ * Sends a message to ChrtGPT and streams its reply, starting a new conversation when no conversation_id is given. In the background, retitles the conversation after each of its first 3 turns and updates its summary and order identifiers after every turn. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTReq) -> (stream[ChrtGPTEvent])
70
65
  */
71
- messageV1(request, requestOptions) {
72
- return core.HttpResponsePromise.fromPromise(this.__messageV1(request, requestOptions));
66
+ postV1(request, requestOptions) {
67
+ return core.HttpResponsePromise.fromPromise(this.__postV1(request, requestOptions));
73
68
  }
74
- __messageV1(request, requestOptions) {
69
+ __postV1(request, requestOptions) {
75
70
  return __awaiter(this, void 0, void 0, function* () {
76
71
  var _a, _b, _c, _d;
77
72
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
78
73
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
79
- 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.ChrtEnvironment.Local, "chrt_gpt/message/v1"),
74
+ 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.ChrtEnvironment.Local, "chrt_gpt/v1"),
80
75
  method: "POST",
81
76
  headers: _headers,
82
77
  contentType: "application/json",
83
78
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
84
79
  requestType: "json",
85
80
  body: request,
81
+ responseType: "sse",
86
82
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
87
83
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
88
84
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
89
85
  });
90
86
  if (_response.ok) {
91
- return { data: _response.body, rawResponse: _response.rawResponse };
87
+ return {
88
+ data: new core.Stream({
89
+ stream: _response.body,
90
+ parse: (data) => data,
91
+ signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
92
+ eventShape: {
93
+ type: "sse",
94
+ streamTerminator: "[DONE]",
95
+ },
96
+ }),
97
+ rawResponse: _response.rawResponse,
98
+ };
92
99
  }
93
100
  if (_response.error.reason === "status-code") {
94
101
  switch (_response.error.statusCode) {
@@ -110,7 +117,7 @@ class ChrtGpt {
110
117
  rawResponse: _response.rawResponse,
111
118
  });
112
119
  case "timeout":
113
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /chrt_gpt/message/v1.");
120
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /chrt_gpt/v1.");
114
121
  case "unknown":
115
122
  throw new errors.ChrtError({
116
123
  message: _response.error.errorMessage,
@@ -0,0 +1,38 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * message: "message"
8
+ * }
9
+ */
10
+ export interface ChrtGptReq {
11
+ /** Omit to start a new conversation. */
12
+ conversation_id?: string | null;
13
+ message: string;
14
+ /** How much ChrtGPT reasons before answering this message. Higher is slower and more thorough. */
15
+ reasoning_effort?: ChrtGptReq.ReasoningEffort;
16
+ /** How long and detailed ChrtGPT's reply is. */
17
+ verbosity?: ChrtGptReq.Verbosity;
18
+ }
19
+ export declare namespace ChrtGptReq {
20
+ /**
21
+ * How much ChrtGPT reasons before answering this message. Higher is slower and more thorough.
22
+ */
23
+ type ReasoningEffort = "low" | "medium" | "high";
24
+ const ReasoningEffort: {
25
+ readonly Low: "low";
26
+ readonly Medium: "medium";
27
+ readonly High: "high";
28
+ };
29
+ /**
30
+ * How long and detailed ChrtGPT's reply is.
31
+ */
32
+ type Verbosity = "low" | "medium" | "high";
33
+ const Verbosity: {
34
+ readonly Low: "low";
35
+ readonly Medium: "medium";
36
+ readonly High: "high";
37
+ };
38
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChrtGptReq = void 0;
7
+ var ChrtGptReq;
8
+ (function (ChrtGptReq) {
9
+ ChrtGptReq.ReasoningEffort = {
10
+ Low: "low",
11
+ Medium: "medium",
12
+ High: "high",
13
+ };
14
+ ChrtGptReq.Verbosity = {
15
+ Low: "low",
16
+ Medium: "medium",
17
+ High: "high",
18
+ };
19
+ })(ChrtGptReq || (exports.ChrtGptReq = ChrtGptReq = {}));
@@ -1 +1 @@
1
- export { type ChrtGptMessageReq } from "./ChrtGptMessageReq.js";
1
+ export { type ChrtGptReq } from "./ChrtGptReq.js";
@@ -1 +1,2 @@
1
1
  export * from "./client/index.js";
2
+ export * from "./resources/index.js";
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./client/index.js"), exports);
18
+ __exportStar(require("./resources/index.js"), exports);
@@ -0,0 +1,96 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../../../environments.js";
5
+ import * as core from "../../../../../../core/index.js";
6
+ import * as Chrt from "../../../../../index.js";
7
+ export declare namespace Conversations {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.ChrtEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
+ fetcher?: core.FetchFunction;
16
+ }
17
+ interface RequestOptions {
18
+ /** The maximum time to wait for a response in seconds. */
19
+ timeoutInSeconds?: number;
20
+ /** The number of times to retry the request. Defaults to 2. */
21
+ maxRetries?: number;
22
+ /** A hook to abort the request. */
23
+ abortSignal?: AbortSignal;
24
+ /** Additional query string parameters to include in the request. */
25
+ queryParams?: Record<string, unknown>;
26
+ /** Additional headers to include in the request. */
27
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
28
+ }
29
+ }
30
+ export declare class Conversations {
31
+ protected readonly _options: Conversations.Options;
32
+ constructor(_options?: Conversations.Options);
33
+ /**
34
+ * Permanently deletes the caller's ChrtGPT conversations and their history, skipping IDs that don't exist or aren't the caller's. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTConversationsDeleteManyReq) -> (ChrtGPTConversationsDeleteManyRes)
35
+ *
36
+ * @param {Chrt.chrtGpt.ChrtGptConversationsDeleteManyReq} request
37
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
38
+ *
39
+ * @throws {@link Chrt.UnprocessableEntityError}
40
+ *
41
+ * @example
42
+ * await client.chrtGpt.conversations.deleteManyV1({
43
+ * conversation_ids: ["conversation_ids"]
44
+ * })
45
+ */
46
+ deleteManyV1(request: Chrt.chrtGpt.ChrtGptConversationsDeleteManyReq, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Chrt.ChrtGptConversationsDeleteManyRes>;
47
+ private __deleteManyV1;
48
+ /**
49
+ * Lists the caller's ChrtGPT conversations, most recently active first by default. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | () -> (ChrtGPTConversationListRes)
50
+ *
51
+ * @param {Chrt.chrtGpt.ConversationsListV1Request} request
52
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
53
+ *
54
+ * @throws {@link Chrt.UnprocessableEntityError}
55
+ *
56
+ * @example
57
+ * await client.chrtGpt.conversations.listV1({
58
+ * sort_by: "updated_at",
59
+ * sort_order: "asc",
60
+ * page: 1,
61
+ * page_size: 1
62
+ * })
63
+ */
64
+ listV1(request?: Chrt.chrtGpt.ConversationsListV1Request, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Chrt.ChrtGptConversationListRes>;
65
+ private __listV1;
66
+ /**
67
+ * Renames one of the caller's ChrtGPT conversations; ChrtGPT never retitles it after that. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTConversationsUpdateTitleReq) -> (ChrtGPTConversation1)
68
+ *
69
+ * @param {string} conversationId
70
+ * @param {Chrt.chrtGpt.ChrtGptConversationsUpdateTitleReq} request
71
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
72
+ *
73
+ * @throws {@link Chrt.UnprocessableEntityError}
74
+ *
75
+ * @example
76
+ * await client.chrtGpt.conversations.updateTitleV1("conversation_id", {
77
+ * title: "title"
78
+ * })
79
+ */
80
+ updateTitleV1(conversationId: string, request: Chrt.chrtGpt.ChrtGptConversationsUpdateTitleReq, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Chrt.ChrtGptConversation1>;
81
+ private __updateTitleV1;
82
+ /**
83
+ * Gets one of the caller's ChrtGPT conversations with its history of messages, tool calls, and web searches. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | () -> (ChrtGPTConversationRes)
84
+ *
85
+ * @param {string} conversationId
86
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
87
+ *
88
+ * @throws {@link Chrt.UnprocessableEntityError}
89
+ *
90
+ * @example
91
+ * await client.chrtGpt.conversations.getV1("conversation_id")
92
+ */
93
+ getV1(conversationId: string, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Chrt.ChrtGptConversationRes>;
94
+ private __getV1;
95
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
96
+ }