mavenagi 0.0.0-alpha.2 → 0.0.0-alpha.3
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/Client.d.ts +6 -0
- package/Client.js +10 -0
- package/README.md +11 -11
- package/api/resources/action/client/Client.d.ts +78 -0
- package/api/resources/action/client/Client.js +304 -0
- package/api/resources/action/client/index.d.ts +1 -0
- package/api/resources/action/client/index.js +1 -0
- package/api/resources/action/index.d.ts +2 -0
- package/api/resources/action/index.js +2 -0
- package/api/resources/action/types/Action.d.ts +23 -0
- package/api/resources/action/types/ActionParameter.d.ts +8 -0
- package/api/resources/action/types/index.d.ts +2 -0
- package/api/resources/action/types/index.js +2 -0
- package/api/resources/actionSet/client/Client.d.ts +71 -0
- package/api/resources/actionSet/client/Client.js +297 -0
- package/api/resources/actionSet/client/index.d.ts +1 -0
- package/api/resources/actionSet/client/index.js +1 -0
- package/api/resources/actionSet/index.d.ts +2 -0
- package/api/resources/actionSet/index.js +2 -0
- package/api/resources/actionSet/types/ActionSetBase.d.ts +9 -0
- package/{dist/api/resources/knowledge/types/IdBody.d.ts → api/resources/actionSet/types/ActionSetBase.js} +1 -3
- package/api/resources/actionSet/types/ActionSetRequest.d.ts +6 -0
- package/api/resources/{knowledge/types/IdBody.d.ts → actionSet/types/ActionSetRequest.js} +1 -3
- package/api/resources/actionSet/types/ActionSetResponse.d.ts +8 -0
- package/api/resources/actionSet/types/ActionSetResponse.js +4 -0
- package/api/resources/actionSet/types/index.d.ts +3 -0
- package/api/resources/actionSet/types/index.js +3 -0
- package/api/resources/commons/errors/{AgentNotFoundError.d.ts → BadRequestError.d.ts} +1 -1
- package/api/resources/{conversation/errors/EmptyConversationError.js → commons/errors/BadRequestError.js} +3 -3
- package/{dist/api/resources/commons/errors/AgentNotFoundError.d.ts → api/resources/commons/errors/NotFoundError.d.ts} +1 -1
- package/{dist/api/resources/commons/errors/AgentNotFoundError.js → api/resources/commons/errors/NotFoundError.js} +3 -3
- package/{dist/api/resources/conversation/errors/EmptyConversationError.d.ts → api/resources/commons/errors/ServerError.d.ts} +1 -1
- package/api/resources/commons/errors/ServerError.js +14 -0
- package/api/resources/commons/errors/index.d.ts +3 -1
- package/api/resources/commons/errors/index.js +3 -1
- package/api/resources/commons/types/Feedback.d.ts +16 -0
- package/api/resources/commons/types/Feedback.js +4 -0
- package/api/resources/{conversation → commons}/types/FeedbackType.d.ts +3 -1
- package/{dist/api/resources/conversation → api/resources/commons}/types/FeedbackType.js +2 -0
- package/api/resources/commons/types/User.d.ts +1 -0
- package/api/resources/commons/types/index.d.ts +2 -0
- package/api/resources/commons/types/index.js +2 -0
- package/api/resources/conversation/client/Client.d.ts +61 -29
- package/api/resources/conversation/client/Client.js +215 -109
- package/api/resources/conversation/index.d.ts +0 -1
- package/api/resources/conversation/index.js +0 -1
- package/api/resources/conversation/types/ActionExecutionRequest.d.ts +10 -0
- package/api/resources/conversation/types/ActionExecutionRequest.js +4 -0
- package/api/resources/conversation/types/ActionExecutionResponse.d.ts +7 -0
- package/api/resources/conversation/types/ActionExecutionResponse.js +4 -0
- package/api/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
- package/api/resources/conversation/types/FeedbackRequest.d.ts +1 -8
- package/api/resources/conversation/types/UserMessage.d.ts +1 -0
- package/api/resources/conversation/types/index.d.ts +2 -1
- package/api/resources/conversation/types/index.js +2 -1
- package/api/resources/index.d.ts +4 -2
- package/api/resources/index.js +4 -2
- package/api/resources/knowledge/client/Client.d.ts +30 -34
- package/api/resources/knowledge/client/Client.js +94 -121
- package/api/resources/knowledge/index.d.ts +0 -1
- package/api/resources/knowledge/index.js +0 -1
- package/api/resources/knowledge/types/KnowledgeBaseVersion.d.ts +1 -1
- package/api/resources/knowledge/types/KnowledgeDocument.d.ts +1 -1
- package/api/resources/knowledge/types/index.d.ts +0 -1
- package/api/resources/knowledge/types/index.js +0 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/dist/Client.d.ts +6 -0
- package/dist/Client.js +10 -0
- package/dist/api/resources/action/client/Client.d.ts +78 -0
- package/dist/api/resources/action/client/Client.js +304 -0
- package/dist/api/resources/action/client/index.d.ts +1 -0
- package/dist/api/resources/action/client/index.js +1 -0
- package/dist/api/resources/action/index.d.ts +2 -0
- package/dist/api/resources/action/index.js +2 -0
- package/dist/api/resources/action/types/Action.d.ts +23 -0
- package/dist/api/resources/action/types/Action.js +4 -0
- package/dist/api/resources/action/types/ActionParameter.d.ts +8 -0
- package/dist/api/resources/action/types/ActionParameter.js +4 -0
- package/dist/api/resources/action/types/index.d.ts +2 -0
- package/dist/api/resources/action/types/index.js +2 -0
- package/dist/api/resources/actionSet/client/Client.d.ts +71 -0
- package/dist/api/resources/actionSet/client/Client.js +297 -0
- package/dist/api/resources/actionSet/client/index.d.ts +1 -0
- package/dist/api/resources/actionSet/client/index.js +1 -0
- package/dist/api/resources/actionSet/index.d.ts +2 -0
- package/dist/api/resources/actionSet/index.js +2 -0
- package/dist/api/resources/actionSet/types/ActionSetBase.d.ts +9 -0
- package/dist/api/resources/actionSet/types/ActionSetBase.js +4 -0
- package/dist/api/resources/actionSet/types/ActionSetRequest.d.ts +6 -0
- package/dist/api/resources/actionSet/types/ActionSetRequest.js +4 -0
- package/dist/api/resources/actionSet/types/ActionSetResponse.d.ts +8 -0
- package/dist/api/resources/actionSet/types/ActionSetResponse.js +4 -0
- package/dist/api/resources/actionSet/types/index.d.ts +3 -0
- package/dist/api/resources/actionSet/types/index.js +3 -0
- package/{api/resources/conversation/errors/EmptyConversationError.d.ts → dist/api/resources/commons/errors/BadRequestError.d.ts} +1 -1
- package/dist/api/resources/{knowledge/errors/VersionInProgressError.js → commons/errors/BadRequestError.js} +3 -3
- package/dist/api/resources/commons/errors/NotFoundError.d.ts +8 -0
- package/{api/resources/commons/errors/AgentNotFoundError.js → dist/api/resources/commons/errors/NotFoundError.js} +3 -3
- package/dist/api/resources/commons/errors/ServerError.d.ts +8 -0
- package/dist/api/resources/commons/errors/ServerError.js +14 -0
- package/dist/api/resources/commons/errors/index.d.ts +3 -1
- package/dist/api/resources/commons/errors/index.js +3 -1
- package/dist/api/resources/commons/types/Feedback.d.ts +16 -0
- package/dist/api/resources/commons/types/Feedback.js +4 -0
- package/dist/api/resources/{conversation → commons}/types/FeedbackType.d.ts +3 -1
- package/{api/resources/conversation → dist/api/resources/commons}/types/FeedbackType.js +2 -0
- package/dist/api/resources/commons/types/User.d.ts +1 -0
- package/dist/api/resources/commons/types/index.d.ts +2 -0
- package/dist/api/resources/commons/types/index.js +2 -0
- package/dist/api/resources/conversation/client/Client.d.ts +61 -29
- package/dist/api/resources/conversation/client/Client.js +215 -109
- package/dist/api/resources/conversation/index.d.ts +0 -1
- package/dist/api/resources/conversation/index.js +0 -1
- package/dist/api/resources/conversation/types/ActionExecutionRequest.d.ts +10 -0
- package/dist/api/resources/conversation/types/ActionExecutionRequest.js +4 -0
- package/dist/api/resources/conversation/types/ActionExecutionResponse.d.ts +7 -0
- package/dist/api/resources/conversation/types/ActionExecutionResponse.js +4 -0
- package/dist/api/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
- package/dist/api/resources/conversation/types/FeedbackRequest.d.ts +1 -8
- package/dist/api/resources/conversation/types/UserMessage.d.ts +1 -0
- package/dist/api/resources/conversation/types/index.d.ts +2 -1
- package/dist/api/resources/conversation/types/index.js +2 -1
- package/dist/api/resources/index.d.ts +4 -2
- package/dist/api/resources/index.js +4 -2
- package/dist/api/resources/knowledge/client/Client.d.ts +30 -34
- package/dist/api/resources/knowledge/client/Client.js +94 -121
- package/dist/api/resources/knowledge/index.d.ts +0 -1
- package/dist/api/resources/knowledge/index.js +0 -1
- package/dist/api/resources/knowledge/types/KnowledgeBaseVersion.d.ts +1 -1
- package/dist/api/resources/knowledge/types/KnowledgeDocument.d.ts +1 -1
- package/dist/api/resources/knowledge/types/index.d.ts +0 -1
- package/dist/api/resources/knowledge/types/index.js +0 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/serialization/resources/action/index.d.ts +1 -0
- package/dist/serialization/resources/action/index.js +1 -0
- package/dist/serialization/resources/action/types/Action.d.ts +21 -0
- package/dist/serialization/resources/action/types/Action.js +16 -0
- package/dist/serialization/resources/action/types/ActionParameter.d.ts +14 -0
- package/dist/serialization/resources/action/types/ActionParameter.js +9 -0
- package/dist/serialization/resources/action/types/index.d.ts +2 -0
- package/dist/serialization/resources/action/types/index.js +2 -0
- package/dist/serialization/resources/actionSet/index.d.ts +1 -0
- package/dist/serialization/resources/actionSet/index.js +1 -0
- package/dist/serialization/resources/{knowledge/types/IdBody.d.ts → actionSet/types/ActionSetBase.d.ts} +4 -3
- package/dist/serialization/resources/actionSet/types/ActionSetBase.js +8 -0
- package/dist/serialization/resources/actionSet/types/ActionSetRequest.d.ts +12 -0
- package/dist/serialization/resources/actionSet/types/ActionSetRequest.js +6 -0
- package/dist/serialization/resources/actionSet/types/ActionSetResponse.d.ts +14 -0
- package/dist/serialization/resources/actionSet/types/ActionSetResponse.js +11 -0
- package/dist/serialization/resources/actionSet/types/index.d.ts +3 -0
- package/dist/serialization/resources/actionSet/types/index.js +3 -0
- package/dist/serialization/resources/commons/types/Feedback.d.ts +17 -0
- package/dist/serialization/resources/commons/types/Feedback.js +12 -0
- package/dist/serialization/resources/{conversation → commons}/types/FeedbackType.d.ts +1 -1
- package/dist/serialization/resources/{conversation → commons}/types/FeedbackType.js +1 -1
- package/dist/serialization/resources/commons/types/User.d.ts +1 -0
- package/dist/serialization/resources/commons/types/User.js +1 -0
- package/dist/serialization/resources/commons/types/index.d.ts +2 -0
- package/dist/serialization/resources/commons/types/index.js +2 -0
- package/dist/serialization/resources/conversation/types/ActionExecutionRequest.d.ts +15 -0
- package/dist/serialization/resources/conversation/types/ActionExecutionRequest.js +10 -0
- package/dist/serialization/resources/conversation/types/ActionExecutionResponse.d.ts +12 -0
- package/dist/serialization/resources/{knowledge/types/IdBody.js → conversation/types/ActionExecutionResponse.js} +2 -2
- package/dist/serialization/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
- package/dist/serialization/resources/conversation/types/BotActionFormResponse.js +1 -0
- package/dist/serialization/resources/conversation/types/FeedbackRequest.d.ts +2 -6
- package/dist/serialization/resources/conversation/types/FeedbackRequest.js +2 -7
- package/dist/serialization/resources/conversation/types/index.d.ts +2 -1
- package/dist/serialization/resources/conversation/types/index.js +2 -1
- package/dist/serialization/resources/index.d.ts +4 -0
- package/dist/serialization/resources/index.js +4 -0
- package/dist/serialization/resources/knowledge/types/index.d.ts +0 -1
- package/dist/serialization/resources/knowledge/types/index.js +0 -1
- package/package.json +1 -1
- package/serialization/resources/action/index.d.ts +1 -0
- package/serialization/resources/action/index.js +1 -0
- package/serialization/resources/action/types/Action.d.ts +21 -0
- package/serialization/resources/action/types/Action.js +16 -0
- package/serialization/resources/action/types/ActionParameter.d.ts +14 -0
- package/serialization/resources/action/types/ActionParameter.js +9 -0
- package/serialization/resources/action/types/index.d.ts +2 -0
- package/serialization/resources/action/types/index.js +2 -0
- package/serialization/resources/actionSet/index.d.ts +1 -0
- package/serialization/resources/actionSet/index.js +1 -0
- package/serialization/resources/{knowledge/types/IdBody.d.ts → actionSet/types/ActionSetBase.d.ts} +4 -3
- package/serialization/resources/actionSet/types/ActionSetBase.js +8 -0
- package/serialization/resources/actionSet/types/ActionSetRequest.d.ts +12 -0
- package/serialization/resources/actionSet/types/ActionSetRequest.js +6 -0
- package/serialization/resources/actionSet/types/ActionSetResponse.d.ts +14 -0
- package/serialization/resources/actionSet/types/ActionSetResponse.js +11 -0
- package/serialization/resources/actionSet/types/index.d.ts +3 -0
- package/serialization/resources/actionSet/types/index.js +3 -0
- package/serialization/resources/commons/types/Feedback.d.ts +17 -0
- package/serialization/resources/commons/types/Feedback.js +12 -0
- package/serialization/resources/{conversation → commons}/types/FeedbackType.d.ts +1 -1
- package/serialization/resources/{conversation → commons}/types/FeedbackType.js +1 -1
- package/serialization/resources/commons/types/User.d.ts +1 -0
- package/serialization/resources/commons/types/User.js +1 -0
- package/serialization/resources/commons/types/index.d.ts +2 -0
- package/serialization/resources/commons/types/index.js +2 -0
- package/serialization/resources/conversation/types/ActionExecutionRequest.d.ts +15 -0
- package/serialization/resources/conversation/types/ActionExecutionRequest.js +10 -0
- package/serialization/resources/conversation/types/ActionExecutionResponse.d.ts +12 -0
- package/serialization/resources/{knowledge/types/IdBody.js → conversation/types/ActionExecutionResponse.js} +2 -2
- package/serialization/resources/conversation/types/BotActionFormResponse.d.ts +1 -0
- package/serialization/resources/conversation/types/BotActionFormResponse.js +1 -0
- package/serialization/resources/conversation/types/FeedbackRequest.d.ts +2 -6
- package/serialization/resources/conversation/types/FeedbackRequest.js +2 -7
- package/serialization/resources/conversation/types/index.d.ts +2 -1
- package/serialization/resources/conversation/types/index.js +2 -1
- package/serialization/resources/index.d.ts +4 -0
- package/serialization/resources/index.js +4 -0
- package/serialization/resources/knowledge/types/index.d.ts +0 -1
- package/serialization/resources/knowledge/types/index.js +0 -1
- package/api/resources/conversation/errors/ConversationAlreadyExistsError.d.ts +0 -8
- package/api/resources/conversation/errors/ConversationAlreadyExistsError.js +0 -14
- package/api/resources/conversation/errors/ConversationMessageNotFoundError.d.ts +0 -8
- package/api/resources/conversation/errors/ConversationMessageNotFoundError.js +0 -14
- package/api/resources/conversation/errors/ConversationNotFoundError.d.ts +0 -8
- package/api/resources/conversation/errors/ConversationNotFoundError.js +0 -14
- package/api/resources/conversation/errors/InvalidConversationIdError.d.ts +0 -8
- package/api/resources/conversation/errors/InvalidConversationIdError.js +0 -14
- package/api/resources/conversation/errors/InvalidConversationMessageIdError.d.ts +0 -8
- package/api/resources/conversation/errors/InvalidConversationMessageIdError.js +0 -14
- package/api/resources/conversation/errors/InvalidFeedbackTypeError.d.ts +0 -8
- package/api/resources/conversation/errors/InvalidFeedbackTypeError.js +0 -14
- package/api/resources/conversation/errors/index.d.ts +0 -7
- package/api/resources/conversation/errors/index.js +0 -7
- package/api/resources/knowledge/errors/DocumentCreationError.d.ts +0 -7
- package/api/resources/knowledge/errors/DocumentCreationError.js +0 -13
- package/api/resources/knowledge/errors/DocumentNotFoundError.d.ts +0 -8
- package/api/resources/knowledge/errors/DocumentNotFoundError.js +0 -14
- package/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.d.ts +0 -8
- package/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.js +0 -14
- package/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.d.ts +0 -8
- package/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.js +0 -14
- package/api/resources/knowledge/errors/VersionInProgressError.d.ts +0 -8
- package/api/resources/knowledge/errors/VersionInProgressError.js +0 -14
- package/api/resources/knowledge/errors/VersionNotInProgressError.d.ts +0 -8
- package/api/resources/knowledge/errors/VersionNotInProgressError.js +0 -14
- package/api/resources/knowledge/errors/index.d.ts +0 -6
- package/api/resources/knowledge/errors/index.js +0 -6
- package/dist/api/resources/conversation/errors/ConversationAlreadyExistsError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/ConversationAlreadyExistsError.js +0 -14
- package/dist/api/resources/conversation/errors/ConversationMessageNotFoundError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/ConversationMessageNotFoundError.js +0 -14
- package/dist/api/resources/conversation/errors/ConversationNotFoundError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/ConversationNotFoundError.js +0 -14
- package/dist/api/resources/conversation/errors/EmptyConversationError.js +0 -14
- package/dist/api/resources/conversation/errors/InvalidConversationIdError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/InvalidConversationIdError.js +0 -14
- package/dist/api/resources/conversation/errors/InvalidConversationMessageIdError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/InvalidConversationMessageIdError.js +0 -14
- package/dist/api/resources/conversation/errors/InvalidFeedbackTypeError.d.ts +0 -8
- package/dist/api/resources/conversation/errors/InvalidFeedbackTypeError.js +0 -14
- package/dist/api/resources/conversation/errors/index.d.ts +0 -7
- package/dist/api/resources/conversation/errors/index.js +0 -7
- package/dist/api/resources/knowledge/errors/DocumentCreationError.d.ts +0 -7
- package/dist/api/resources/knowledge/errors/DocumentCreationError.js +0 -13
- package/dist/api/resources/knowledge/errors/DocumentNotFoundError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/DocumentNotFoundError.js +0 -14
- package/dist/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/IneligibleKnowledgeBaseError.js +0 -14
- package/dist/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/KnowledgeBaseNotFoundError.js +0 -14
- package/dist/api/resources/knowledge/errors/VersionInProgressError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/VersionNotInProgressError.d.ts +0 -8
- package/dist/api/resources/knowledge/errors/VersionNotInProgressError.js +0 -14
- package/dist/api/resources/knowledge/errors/index.d.ts +0 -6
- package/dist/api/resources/knowledge/errors/index.js +0 -6
- /package/api/resources/{knowledge/types/IdBody.js → action/types/Action.js} +0 -0
- /package/{dist/api/resources/knowledge/types/IdBody.js → api/resources/action/types/ActionParameter.js} +0 -0
|
@@ -26,21 +26,19 @@ export class Conversation {
|
|
|
26
26
|
* @param {MavenAGI.ConversationRequest} request
|
|
27
27
|
* @param {Conversation.RequestOptions} requestOptions - Request-specific configuration.
|
|
28
28
|
*
|
|
29
|
-
* @throws {@link MavenAGI.
|
|
30
|
-
* @throws {@link MavenAGI.
|
|
31
|
-
* @throws {@link MavenAGI.
|
|
32
|
-
* @throws {@link MavenAGI.EmptyConversationError}
|
|
33
|
-
* @throws {@link MavenAGI.AgentNotFoundError}
|
|
29
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
30
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
31
|
+
* @throws {@link MavenAGI.ServerError}
|
|
34
32
|
*
|
|
35
33
|
* @example
|
|
36
|
-
* await
|
|
34
|
+
* await client.conversation.initialize({
|
|
37
35
|
* messages: [{}],
|
|
38
36
|
* id: "string",
|
|
39
37
|
* context: {}
|
|
40
38
|
* })
|
|
41
39
|
*/
|
|
42
40
|
initialize(request, requestOptions) {
|
|
43
|
-
var _a, _b
|
|
41
|
+
var _a, _b;
|
|
44
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
43
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
46
44
|
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, "/v1/conversations"),
|
|
@@ -51,7 +49,7 @@ export class Conversation {
|
|
|
51
49
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
52
50
|
"X-Fern-Language": "JavaScript",
|
|
53
51
|
"X-Fern-SDK-Name": "mavenagi",
|
|
54
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
52
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.3",
|
|
55
53
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
56
54
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
57
55
|
},
|
|
@@ -70,37 +68,23 @@ export class Conversation {
|
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
70
|
if (_response.error.reason === "status-code") {
|
|
73
|
-
switch (
|
|
74
|
-
case
|
|
75
|
-
throw new MavenAGI.
|
|
76
|
-
unrecognizedObjectKeys: "passthrough",
|
|
77
|
-
allowUnrecognizedUnionMembers: true,
|
|
78
|
-
allowUnrecognizedEnumValues: true,
|
|
79
|
-
breadcrumbsPrefix: ["response"],
|
|
80
|
-
}));
|
|
81
|
-
case "InvalidConversationIdError":
|
|
82
|
-
throw new MavenAGI.InvalidConversationIdError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
71
|
+
switch (_response.error.statusCode) {
|
|
72
|
+
case 404:
|
|
73
|
+
throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
83
74
|
unrecognizedObjectKeys: "passthrough",
|
|
84
75
|
allowUnrecognizedUnionMembers: true,
|
|
85
76
|
allowUnrecognizedEnumValues: true,
|
|
86
77
|
breadcrumbsPrefix: ["response"],
|
|
87
78
|
}));
|
|
88
|
-
case
|
|
89
|
-
throw new MavenAGI.
|
|
79
|
+
case 400:
|
|
80
|
+
throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
90
81
|
unrecognizedObjectKeys: "passthrough",
|
|
91
82
|
allowUnrecognizedUnionMembers: true,
|
|
92
83
|
allowUnrecognizedEnumValues: true,
|
|
93
84
|
breadcrumbsPrefix: ["response"],
|
|
94
85
|
}));
|
|
95
|
-
case
|
|
96
|
-
throw new MavenAGI.
|
|
97
|
-
unrecognizedObjectKeys: "passthrough",
|
|
98
|
-
allowUnrecognizedUnionMembers: true,
|
|
99
|
-
allowUnrecognizedEnumValues: true,
|
|
100
|
-
breadcrumbsPrefix: ["response"],
|
|
101
|
-
}));
|
|
102
|
-
case "AgentNotFoundError":
|
|
103
|
-
throw new MavenAGI.AgentNotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
86
|
+
case 500:
|
|
87
|
+
throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
104
88
|
unrecognizedObjectKeys: "passthrough",
|
|
105
89
|
allowUnrecognizedUnionMembers: true,
|
|
106
90
|
allowUnrecognizedEnumValues: true,
|
|
@@ -131,17 +115,18 @@ export class Conversation {
|
|
|
131
115
|
/**
|
|
132
116
|
* Get a conversation
|
|
133
117
|
*
|
|
134
|
-
* @param {string} conversationId - The ID of
|
|
118
|
+
* @param {string} conversationId - The ID of the conversation to get
|
|
135
119
|
* @param {Conversation.RequestOptions} requestOptions - Request-specific configuration.
|
|
136
120
|
*
|
|
137
|
-
* @throws {@link MavenAGI.
|
|
138
|
-
* @throws {@link MavenAGI.
|
|
121
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
122
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
123
|
+
* @throws {@link MavenAGI.ServerError}
|
|
139
124
|
*
|
|
140
125
|
* @example
|
|
141
|
-
* await
|
|
126
|
+
* await client.conversation.get("string")
|
|
142
127
|
*/
|
|
143
128
|
get(conversationId, requestOptions) {
|
|
144
|
-
var _a, _b
|
|
129
|
+
var _a, _b;
|
|
145
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
146
131
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
147
132
|
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/conversations/${encodeURIComponent(conversationId)}`),
|
|
@@ -152,7 +137,7 @@ export class Conversation {
|
|
|
152
137
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
153
138
|
"X-Fern-Language": "JavaScript",
|
|
154
139
|
"X-Fern-SDK-Name": "mavenagi",
|
|
155
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
140
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.3",
|
|
156
141
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
157
142
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
158
143
|
},
|
|
@@ -170,16 +155,23 @@ export class Conversation {
|
|
|
170
155
|
});
|
|
171
156
|
}
|
|
172
157
|
if (_response.error.reason === "status-code") {
|
|
173
|
-
switch (
|
|
174
|
-
case
|
|
175
|
-
throw new MavenAGI.
|
|
158
|
+
switch (_response.error.statusCode) {
|
|
159
|
+
case 404:
|
|
160
|
+
throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
176
161
|
unrecognizedObjectKeys: "passthrough",
|
|
177
162
|
allowUnrecognizedUnionMembers: true,
|
|
178
163
|
allowUnrecognizedEnumValues: true,
|
|
179
164
|
breadcrumbsPrefix: ["response"],
|
|
180
165
|
}));
|
|
181
|
-
case
|
|
182
|
-
throw new MavenAGI.
|
|
166
|
+
case 400:
|
|
167
|
+
throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
168
|
+
unrecognizedObjectKeys: "passthrough",
|
|
169
|
+
allowUnrecognizedUnionMembers: true,
|
|
170
|
+
allowUnrecognizedEnumValues: true,
|
|
171
|
+
breadcrumbsPrefix: ["response"],
|
|
172
|
+
}));
|
|
173
|
+
case 500:
|
|
174
|
+
throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
183
175
|
unrecognizedObjectKeys: "passthrough",
|
|
184
176
|
allowUnrecognizedUnionMembers: true,
|
|
185
177
|
allowUnrecognizedEnumValues: true,
|
|
@@ -214,12 +206,12 @@ export class Conversation {
|
|
|
214
206
|
* @param {MavenAGI.ConversationMessageRequest[]} request
|
|
215
207
|
* @param {Conversation.RequestOptions} requestOptions - Request-specific configuration.
|
|
216
208
|
*
|
|
217
|
-
* @throws {@link MavenAGI.
|
|
218
|
-
* @throws {@link MavenAGI.
|
|
219
|
-
* @throws {@link MavenAGI.
|
|
209
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
210
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
211
|
+
* @throws {@link MavenAGI.ServerError}
|
|
220
212
|
*
|
|
221
213
|
* @example
|
|
222
|
-
* await
|
|
214
|
+
* await client.conversation.appendNewMessages("string", [{
|
|
223
215
|
* text: "string",
|
|
224
216
|
* userMessageType: MavenAGI.UserConversationMessageType.User,
|
|
225
217
|
* id: "string",
|
|
@@ -227,7 +219,7 @@ export class Conversation {
|
|
|
227
219
|
* }])
|
|
228
220
|
*/
|
|
229
221
|
appendNewMessages(conversationId, request, requestOptions) {
|
|
230
|
-
var _a, _b
|
|
222
|
+
var _a, _b;
|
|
231
223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
232
224
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
233
225
|
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/conversations/${encodeURIComponent(conversationId)}/messages`),
|
|
@@ -238,7 +230,7 @@ export class Conversation {
|
|
|
238
230
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
239
231
|
"X-Fern-Language": "JavaScript",
|
|
240
232
|
"X-Fern-SDK-Name": "mavenagi",
|
|
241
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
233
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.3",
|
|
242
234
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
243
235
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
244
236
|
},
|
|
@@ -259,23 +251,23 @@ export class Conversation {
|
|
|
259
251
|
});
|
|
260
252
|
}
|
|
261
253
|
if (_response.error.reason === "status-code") {
|
|
262
|
-
switch (
|
|
263
|
-
case
|
|
264
|
-
throw new MavenAGI.
|
|
254
|
+
switch (_response.error.statusCode) {
|
|
255
|
+
case 404:
|
|
256
|
+
throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
265
257
|
unrecognizedObjectKeys: "passthrough",
|
|
266
258
|
allowUnrecognizedUnionMembers: true,
|
|
267
259
|
allowUnrecognizedEnumValues: true,
|
|
268
260
|
breadcrumbsPrefix: ["response"],
|
|
269
261
|
}));
|
|
270
|
-
case
|
|
271
|
-
throw new MavenAGI.
|
|
262
|
+
case 400:
|
|
263
|
+
throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
272
264
|
unrecognizedObjectKeys: "passthrough",
|
|
273
265
|
allowUnrecognizedUnionMembers: true,
|
|
274
266
|
allowUnrecognizedEnumValues: true,
|
|
275
267
|
breadcrumbsPrefix: ["response"],
|
|
276
268
|
}));
|
|
277
|
-
case
|
|
278
|
-
throw new MavenAGI.
|
|
269
|
+
case 500:
|
|
270
|
+
throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
279
271
|
unrecognizedObjectKeys: "passthrough",
|
|
280
272
|
allowUnrecognizedUnionMembers: true,
|
|
281
273
|
allowUnrecognizedEnumValues: true,
|
|
@@ -310,18 +302,19 @@ export class Conversation {
|
|
|
310
302
|
* @param {MavenAGI.AskRequest} request
|
|
311
303
|
* @param {Conversation.RequestOptions} requestOptions - Request-specific configuration.
|
|
312
304
|
*
|
|
313
|
-
* @throws {@link MavenAGI.
|
|
314
|
-
* @throws {@link MavenAGI.
|
|
305
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
306
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
307
|
+
* @throws {@link MavenAGI.ServerError}
|
|
315
308
|
*
|
|
316
309
|
* @example
|
|
317
|
-
* await
|
|
310
|
+
* await client.conversation.ask("string", {
|
|
318
311
|
* id: "string",
|
|
319
312
|
* text: "string",
|
|
320
313
|
* context: {}
|
|
321
314
|
* })
|
|
322
315
|
*/
|
|
323
316
|
ask(conversationId, request, requestOptions) {
|
|
324
|
-
var _a, _b
|
|
317
|
+
var _a, _b;
|
|
325
318
|
return __awaiter(this, void 0, void 0, function* () {
|
|
326
319
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
327
320
|
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/conversations/${encodeURIComponent(conversationId)}/ask`),
|
|
@@ -332,7 +325,7 @@ export class Conversation {
|
|
|
332
325
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
333
326
|
"X-Fern-Language": "JavaScript",
|
|
334
327
|
"X-Fern-SDK-Name": "mavenagi",
|
|
335
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
328
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.3",
|
|
336
329
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
337
330
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
338
331
|
},
|
|
@@ -351,16 +344,23 @@ export class Conversation {
|
|
|
351
344
|
});
|
|
352
345
|
}
|
|
353
346
|
if (_response.error.reason === "status-code") {
|
|
354
|
-
switch (
|
|
355
|
-
case
|
|
356
|
-
throw new MavenAGI.
|
|
347
|
+
switch (_response.error.statusCode) {
|
|
348
|
+
case 404:
|
|
349
|
+
throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
350
|
+
unrecognizedObjectKeys: "passthrough",
|
|
351
|
+
allowUnrecognizedUnionMembers: true,
|
|
352
|
+
allowUnrecognizedEnumValues: true,
|
|
353
|
+
breadcrumbsPrefix: ["response"],
|
|
354
|
+
}));
|
|
355
|
+
case 400:
|
|
356
|
+
throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
357
357
|
unrecognizedObjectKeys: "passthrough",
|
|
358
358
|
allowUnrecognizedUnionMembers: true,
|
|
359
359
|
allowUnrecognizedEnumValues: true,
|
|
360
360
|
breadcrumbsPrefix: ["response"],
|
|
361
361
|
}));
|
|
362
|
-
case
|
|
363
|
-
throw new MavenAGI.
|
|
362
|
+
case 500:
|
|
363
|
+
throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
364
364
|
unrecognizedObjectKeys: "passthrough",
|
|
365
365
|
allowUnrecognizedUnionMembers: true,
|
|
366
366
|
allowUnrecognizedEnumValues: true,
|
|
@@ -392,7 +392,7 @@ export class Conversation {
|
|
|
392
392
|
* Ask a question
|
|
393
393
|
*/
|
|
394
394
|
askStream(conversationId, request, requestOptions) {
|
|
395
|
-
var _a, _b
|
|
395
|
+
var _a, _b;
|
|
396
396
|
return __awaiter(this, void 0, void 0, function* () {
|
|
397
397
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
398
398
|
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/conversations/${encodeURIComponent(conversationId)}/ask_stream`),
|
|
@@ -403,7 +403,7 @@ export class Conversation {
|
|
|
403
403
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
404
404
|
"X-Fern-Language": "JavaScript",
|
|
405
405
|
"X-Fern-SDK-Name": "mavenagi",
|
|
406
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
406
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.3",
|
|
407
407
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
408
408
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
409
409
|
},
|
|
@@ -433,9 +433,23 @@ export class Conversation {
|
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
435
|
if (_response.error.reason === "status-code") {
|
|
436
|
-
switch (
|
|
437
|
-
case
|
|
438
|
-
throw new MavenAGI.
|
|
436
|
+
switch (_response.error.statusCode) {
|
|
437
|
+
case 404:
|
|
438
|
+
throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
439
|
+
unrecognizedObjectKeys: "passthrough",
|
|
440
|
+
allowUnrecognizedUnionMembers: true,
|
|
441
|
+
allowUnrecognizedEnumValues: true,
|
|
442
|
+
breadcrumbsPrefix: ["response"],
|
|
443
|
+
}));
|
|
444
|
+
case 400:
|
|
445
|
+
throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
446
|
+
unrecognizedObjectKeys: "passthrough",
|
|
447
|
+
allowUnrecognizedUnionMembers: true,
|
|
448
|
+
allowUnrecognizedEnumValues: true,
|
|
449
|
+
breadcrumbsPrefix: ["response"],
|
|
450
|
+
}));
|
|
451
|
+
case 500:
|
|
452
|
+
throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
439
453
|
unrecognizedObjectKeys: "passthrough",
|
|
440
454
|
allowUnrecognizedUnionMembers: true,
|
|
441
455
|
allowUnrecognizedEnumValues: true,
|
|
@@ -470,19 +484,17 @@ export class Conversation {
|
|
|
470
484
|
* @param {MavenAGI.GenerateMavenSuggestionsRequest} request
|
|
471
485
|
* @param {Conversation.RequestOptions} requestOptions - Request-specific configuration.
|
|
472
486
|
*
|
|
473
|
-
* @throws {@link MavenAGI.
|
|
474
|
-
* @throws {@link MavenAGI.
|
|
475
|
-
* @throws {@link MavenAGI.
|
|
476
|
-
* @throws {@link MavenAGI.InvalidConversationMessageIdError}
|
|
477
|
-
* @throws {@link MavenAGI.AgentNotFoundError}
|
|
487
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
488
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
489
|
+
* @throws {@link MavenAGI.ServerError}
|
|
478
490
|
*
|
|
479
491
|
* @example
|
|
480
|
-
* await
|
|
492
|
+
* await client.conversation.generateMavenSuggestions("string", {
|
|
481
493
|
* messageIds: ["string"]
|
|
482
494
|
* })
|
|
483
495
|
*/
|
|
484
496
|
generateMavenSuggestions(conversationId, request, requestOptions) {
|
|
485
|
-
var _a, _b
|
|
497
|
+
var _a, _b;
|
|
486
498
|
return __awaiter(this, void 0, void 0, function* () {
|
|
487
499
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
488
500
|
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/conversations/${encodeURIComponent(conversationId)}/generate_maven_suggestions`),
|
|
@@ -493,7 +505,7 @@ export class Conversation {
|
|
|
493
505
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
494
506
|
"X-Fern-Language": "JavaScript",
|
|
495
507
|
"X-Fern-SDK-Name": "mavenagi",
|
|
496
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
508
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.3",
|
|
497
509
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
498
510
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
499
511
|
},
|
|
@@ -514,37 +526,112 @@ export class Conversation {
|
|
|
514
526
|
});
|
|
515
527
|
}
|
|
516
528
|
if (_response.error.reason === "status-code") {
|
|
517
|
-
switch (
|
|
518
|
-
case
|
|
519
|
-
throw new MavenAGI.
|
|
529
|
+
switch (_response.error.statusCode) {
|
|
530
|
+
case 404:
|
|
531
|
+
throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
520
532
|
unrecognizedObjectKeys: "passthrough",
|
|
521
533
|
allowUnrecognizedUnionMembers: true,
|
|
522
534
|
allowUnrecognizedEnumValues: true,
|
|
523
535
|
breadcrumbsPrefix: ["response"],
|
|
524
536
|
}));
|
|
525
|
-
case
|
|
526
|
-
throw new MavenAGI.
|
|
537
|
+
case 400:
|
|
538
|
+
throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
527
539
|
unrecognizedObjectKeys: "passthrough",
|
|
528
540
|
allowUnrecognizedUnionMembers: true,
|
|
529
541
|
allowUnrecognizedEnumValues: true,
|
|
530
542
|
breadcrumbsPrefix: ["response"],
|
|
531
543
|
}));
|
|
532
|
-
case
|
|
533
|
-
throw new MavenAGI.
|
|
544
|
+
case 500:
|
|
545
|
+
throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
546
|
+
unrecognizedObjectKeys: "passthrough",
|
|
547
|
+
allowUnrecognizedUnionMembers: true,
|
|
548
|
+
allowUnrecognizedEnumValues: true,
|
|
549
|
+
breadcrumbsPrefix: ["response"],
|
|
550
|
+
}));
|
|
551
|
+
default:
|
|
552
|
+
throw new errors.MavenAGIError({
|
|
553
|
+
statusCode: _response.error.statusCode,
|
|
554
|
+
body: _response.error.body,
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
switch (_response.error.reason) {
|
|
559
|
+
case "non-json":
|
|
560
|
+
throw new errors.MavenAGIError({
|
|
561
|
+
statusCode: _response.error.statusCode,
|
|
562
|
+
body: _response.error.rawBody,
|
|
563
|
+
});
|
|
564
|
+
case "timeout":
|
|
565
|
+
throw new errors.MavenAGITimeoutError();
|
|
566
|
+
case "unknown":
|
|
567
|
+
throw new errors.MavenAGIError({
|
|
568
|
+
message: _response.error.errorMessage,
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Create feedback
|
|
575
|
+
*
|
|
576
|
+
* @param {MavenAGI.FeedbackRequest} request
|
|
577
|
+
* @param {Conversation.RequestOptions} requestOptions - Request-specific configuration.
|
|
578
|
+
*
|
|
579
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
580
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
581
|
+
* @throws {@link MavenAGI.ServerError}
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* await client.conversation.createFeedback({
|
|
585
|
+
* id: "string",
|
|
586
|
+
* conversationId: "string",
|
|
587
|
+
* conversationMessageId: "string",
|
|
588
|
+
* type: MavenAGI.FeedbackType.ThumbsUp,
|
|
589
|
+
* text: "string"
|
|
590
|
+
* })
|
|
591
|
+
*/
|
|
592
|
+
createFeedback(request, requestOptions) {
|
|
593
|
+
var _a, _b;
|
|
594
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
595
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
596
|
+
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, "/v1/conversations/feedback"),
|
|
597
|
+
method: "POST",
|
|
598
|
+
headers: {
|
|
599
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
600
|
+
"X-Organization-Id": yield core.Supplier.get(this._options.organizationId),
|
|
601
|
+
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
602
|
+
"X-Fern-Language": "JavaScript",
|
|
603
|
+
"X-Fern-SDK-Name": "mavenagi",
|
|
604
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.3",
|
|
605
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
606
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
607
|
+
},
|
|
608
|
+
contentType: "application/json",
|
|
609
|
+
body: yield serializers.FeedbackRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
610
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
611
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
612
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
613
|
+
});
|
|
614
|
+
if (_response.ok) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
if (_response.error.reason === "status-code") {
|
|
618
|
+
switch (_response.error.statusCode) {
|
|
619
|
+
case 404:
|
|
620
|
+
throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
534
621
|
unrecognizedObjectKeys: "passthrough",
|
|
535
622
|
allowUnrecognizedUnionMembers: true,
|
|
536
623
|
allowUnrecognizedEnumValues: true,
|
|
537
624
|
breadcrumbsPrefix: ["response"],
|
|
538
625
|
}));
|
|
539
|
-
case
|
|
540
|
-
throw new MavenAGI.
|
|
626
|
+
case 400:
|
|
627
|
+
throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
541
628
|
unrecognizedObjectKeys: "passthrough",
|
|
542
629
|
allowUnrecognizedUnionMembers: true,
|
|
543
630
|
allowUnrecognizedEnumValues: true,
|
|
544
631
|
breadcrumbsPrefix: ["response"],
|
|
545
632
|
}));
|
|
546
|
-
case
|
|
547
|
-
throw new MavenAGI.
|
|
633
|
+
case 500:
|
|
634
|
+
throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
548
635
|
unrecognizedObjectKeys: "passthrough",
|
|
549
636
|
allowUnrecognizedUnionMembers: true,
|
|
550
637
|
allowUnrecognizedEnumValues: true,
|
|
@@ -573,27 +660,41 @@ export class Conversation {
|
|
|
573
660
|
});
|
|
574
661
|
}
|
|
575
662
|
/**
|
|
576
|
-
*
|
|
663
|
+
* Submit a filled out action form
|
|
577
664
|
*
|
|
578
|
-
* @param {
|
|
665
|
+
* @param {string} conversationId - The ID of a conversation the form being submitted belongs to
|
|
666
|
+
* @param {MavenAGI.ActionExecutionRequest} request
|
|
579
667
|
* @param {Conversation.RequestOptions} requestOptions - Request-specific configuration.
|
|
580
668
|
*
|
|
581
|
-
* @throws {@link MavenAGI.
|
|
582
|
-
* @throws {@link MavenAGI.
|
|
583
|
-
* @throws {@link MavenAGI.
|
|
669
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
670
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
671
|
+
* @throws {@link MavenAGI.ServerError}
|
|
584
672
|
*
|
|
585
673
|
* @example
|
|
586
|
-
* await
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
*
|
|
674
|
+
* await client.conversation.submitActionForm("string", {
|
|
675
|
+
* actionFormId: "string",
|
|
676
|
+
* userContext: {
|
|
677
|
+
* name: "string",
|
|
678
|
+
* id: {
|
|
679
|
+
* "string": "string"
|
|
680
|
+
* },
|
|
681
|
+
* email: "string",
|
|
682
|
+
* context: {
|
|
683
|
+
* "string": "string"
|
|
684
|
+
* }
|
|
685
|
+
* },
|
|
686
|
+
* parameters: {
|
|
687
|
+
* "string": {
|
|
688
|
+
* "key": "value"
|
|
689
|
+
* }
|
|
690
|
+
* }
|
|
590
691
|
* })
|
|
591
692
|
*/
|
|
592
|
-
|
|
593
|
-
var _a, _b
|
|
693
|
+
submitActionForm(conversationId, request, requestOptions) {
|
|
694
|
+
var _a, _b;
|
|
594
695
|
return __awaiter(this, void 0, void 0, function* () {
|
|
595
696
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
596
|
-
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production,
|
|
697
|
+
url: urlJoin((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.MavenAGIEnvironment.Production, `/v1/conversations/${encodeURIComponent(conversationId)}/submit-form`),
|
|
597
698
|
method: "POST",
|
|
598
699
|
headers: {
|
|
599
700
|
Authorization: yield this._getAuthorizationHeader(),
|
|
@@ -601,37 +702,42 @@ export class Conversation {
|
|
|
601
702
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
602
703
|
"X-Fern-Language": "JavaScript",
|
|
603
704
|
"X-Fern-SDK-Name": "mavenagi",
|
|
604
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
705
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.3",
|
|
605
706
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
606
707
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
607
708
|
},
|
|
608
709
|
contentType: "application/json",
|
|
609
|
-
body: yield serializers.
|
|
710
|
+
body: yield serializers.ActionExecutionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
610
711
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
611
712
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
612
713
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
613
714
|
});
|
|
614
715
|
if (_response.ok) {
|
|
615
|
-
return
|
|
716
|
+
return yield serializers.ActionExecutionResponse.parseOrThrow(_response.body, {
|
|
717
|
+
unrecognizedObjectKeys: "passthrough",
|
|
718
|
+
allowUnrecognizedUnionMembers: true,
|
|
719
|
+
allowUnrecognizedEnumValues: true,
|
|
720
|
+
breadcrumbsPrefix: ["response"],
|
|
721
|
+
});
|
|
616
722
|
}
|
|
617
723
|
if (_response.error.reason === "status-code") {
|
|
618
|
-
switch (
|
|
619
|
-
case
|
|
620
|
-
throw new MavenAGI.
|
|
724
|
+
switch (_response.error.statusCode) {
|
|
725
|
+
case 404:
|
|
726
|
+
throw new MavenAGI.NotFoundError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
621
727
|
unrecognizedObjectKeys: "passthrough",
|
|
622
728
|
allowUnrecognizedUnionMembers: true,
|
|
623
729
|
allowUnrecognizedEnumValues: true,
|
|
624
730
|
breadcrumbsPrefix: ["response"],
|
|
625
731
|
}));
|
|
626
|
-
case
|
|
627
|
-
throw new MavenAGI.
|
|
732
|
+
case 400:
|
|
733
|
+
throw new MavenAGI.BadRequestError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
628
734
|
unrecognizedObjectKeys: "passthrough",
|
|
629
735
|
allowUnrecognizedUnionMembers: true,
|
|
630
736
|
allowUnrecognizedEnumValues: true,
|
|
631
737
|
breadcrumbsPrefix: ["response"],
|
|
632
738
|
}));
|
|
633
|
-
case
|
|
634
|
-
throw new MavenAGI.
|
|
739
|
+
case 500:
|
|
740
|
+
throw new MavenAGI.ServerError(yield serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
635
741
|
unrecognizedObjectKeys: "passthrough",
|
|
636
742
|
allowUnrecognizedUnionMembers: true,
|
|
637
743
|
allowUnrecognizedEnumValues: true,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as MavenAGI from "../../../index";
|
|
5
|
+
export interface ActionExecutionRequest {
|
|
6
|
+
actionFormId: string;
|
|
7
|
+
userContext: MavenAGI.User;
|
|
8
|
+
/** Map of parameter names to values */
|
|
9
|
+
parameters: Record<string, unknown>;
|
|
10
|
+
}
|
|
@@ -2,11 +2,4 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as MavenAGI from "../../../index";
|
|
5
|
-
export
|
|
6
|
-
/** The ID of the conversation message the feedback is about */
|
|
7
|
-
conversationMessageId: string;
|
|
8
|
-
/** The feedback text */
|
|
9
|
-
text: string;
|
|
10
|
-
/** The type of feedback */
|
|
11
|
-
type: MavenAGI.FeedbackType;
|
|
12
|
-
}
|
|
5
|
+
export declare type FeedbackRequest = MavenAGI.Feedback;
|