@cognigy/rest-api-client 2025.15.1 → 2025.17.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 (76) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/build/apigroups/MetricsAPIGroup_2_0.js +10 -0
  3. package/build/apigroups/ResourcesAPIGroup_2_0.js +6 -0
  4. package/build/apigroups/SimulationAPIGroup_2_0.js +4 -0
  5. package/build/shared/charts/descriptors/data/debugMessage.js +13 -3
  6. package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +48 -49
  7. package/build/shared/charts/descriptors/logic/if/if.js +2 -2
  8. package/build/shared/charts/descriptors/logic/switch/switch.js +30 -21
  9. package/build/shared/charts/descriptors/message/question/question.js +3 -3
  10. package/build/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +2 -2
  11. package/build/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +31 -2
  12. package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +40 -24
  13. package/build/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +4 -4
  14. package/build/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +36 -21
  15. package/build/shared/charts/descriptors/transcripts/addTranscriptStep.js +3 -3
  16. package/build/shared/charts/descriptors/transcripts/getTranscript.js +23 -3
  17. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +3 -0
  18. package/build/shared/generativeAI/getPrompt.js +75 -0
  19. package/build/shared/generativeAI/utils/generativeAIPrompts.js +613 -0
  20. package/build/shared/generativeAI/utils/prompts/contextAwareUserQueryRephrasing.js +84 -0
  21. package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +2 -0
  22. package/build/shared/interfaces/messageAPI/handover.js +6 -0
  23. package/build/shared/interfaces/resources/IGetAiAgentJobsTools.js +3 -0
  24. package/build/shared/interfaces/resources/IKnowledgeDescriptor.js +38 -5
  25. package/build/shared/interfaces/resources/ILargeLanguageModel.js +16 -1
  26. package/build/shared/interfaces/restAPI/metrics/callCounter/v3.0/ICallCounterPreAggregatedValue_3_0.js +3 -0
  27. package/build/shared/interfaces/restAPI/metrics/callCounter/v3.0/IGetCallCounterOrganisationRest_3_0.js +3 -0
  28. package/build/shared/interfaces/restAPI/metrics/callCounter/v3.0/IGetCallCounterRest_3_0.js +3 -0
  29. package/build/shared/interfaces/restAPI/metrics/callCounter/v3.0/index.js +3 -0
  30. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IAiAgentJobNodeWithTools_2_0.js +65 -0
  31. package/build/shared/interfaces/restAPI/resources/aiAgent/v2.0/IGetAiAgentJobAndToolsRest_2_0 .js +4 -0
  32. package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/IIndexKnowledgeDescriptorsRest_2_0.js +3 -0
  33. package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/extension/IRunKnowledgeExtensionRest_2_0.js +3 -0
  34. package/build/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/index.js +16 -0
  35. package/build/shared/interfaces/restAPI/simulation/simulationRunBatch/IStopSimulationRunBatchRest_2_0.js +3 -0
  36. package/build/shared/interfaces/security/ICallCounterPreAggregatedValue.js +3 -0
  37. package/build/test.js +39 -0
  38. package/dist/esm/apigroups/MetricsAPIGroup_2_0.js +10 -0
  39. package/dist/esm/apigroups/ResourcesAPIGroup_2_0.js +6 -0
  40. package/dist/esm/apigroups/SimulationAPIGroup_2_0.js +4 -0
  41. package/dist/esm/shared/charts/descriptors/data/debugMessage.js +13 -3
  42. package/dist/esm/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +48 -50
  43. package/dist/esm/shared/charts/descriptors/logic/if/if.js +2 -2
  44. package/dist/esm/shared/charts/descriptors/logic/switch/switch.js +30 -21
  45. package/dist/esm/shared/charts/descriptors/message/question/question.js +3 -3
  46. package/dist/esm/shared/charts/descriptors/message/question/utils/validateQuestionAnswer.js +4 -3
  47. package/dist/esm/shared/charts/descriptors/nlu/generativeSlotFiller/prompt.js +29 -1
  48. package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +39 -23
  49. package/dist/esm/shared/charts/descriptors/service/aiAgent/helpers/createToolDefinitions.js +4 -4
  50. package/dist/esm/shared/charts/descriptors/service/llmPrompt/LLMPromptV2.js +43 -28
  51. package/dist/esm/shared/charts/descriptors/transcripts/addTranscriptStep.js +3 -3
  52. package/dist/esm/shared/charts/descriptors/transcripts/getTranscript.js +23 -3
  53. package/dist/esm/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +3 -0
  54. package/dist/esm/shared/generativeAI/getPrompt.js +68 -0
  55. package/dist/esm/shared/generativeAI/utils/generativeAIPrompts.js +610 -0
  56. package/dist/esm/shared/generativeAI/utils/prompts/contextAwareUserQueryRephrasing.js +81 -0
  57. package/dist/esm/shared/interfaces/generativeAI/IGenerativeAIModels.js +2 -0
  58. package/dist/esm/shared/interfaces/messageAPI/handover.js +6 -0
  59. package/dist/esm/shared/interfaces/resources/IGetAiAgentJobsTools.js +2 -0
  60. package/dist/esm/shared/interfaces/resources/IKnowledgeDescriptor.js +37 -5
  61. package/dist/esm/shared/interfaces/resources/ILargeLanguageModel.js +14 -0
  62. package/dist/esm/shared/interfaces/restAPI/management/authentication/ICreateJWTToken.js +1 -0
  63. package/dist/esm/shared/interfaces/restAPI/metrics/callCounter/v3.0/ICallCounterPreAggregatedValue_3_0.js +2 -0
  64. package/dist/esm/shared/interfaces/restAPI/metrics/callCounter/v3.0/IGetCallCounterOrganisationRest_3_0.js +2 -0
  65. package/dist/esm/shared/interfaces/restAPI/metrics/callCounter/v3.0/IGetCallCounterRest_3_0.js +2 -0
  66. package/dist/esm/shared/interfaces/restAPI/metrics/callCounter/v3.0/index.js +2 -0
  67. package/dist/esm/shared/interfaces/restAPI/resources/aiAgent/v2.0/IAiAgentJobNodeWithTools_2_0.js +65 -0
  68. package/dist/esm/shared/interfaces/restAPI/resources/aiAgent/v2.0/IGetAiAgentJobAndToolsRest_2_0 .js +3 -0
  69. package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/IIndexKnowledgeDescriptorsRest_2_0.js +2 -0
  70. package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/extension/IRunKnowledgeExtensionRest_2_0.js +2 -0
  71. package/dist/esm/shared/interfaces/restAPI/resources/knowledgeStore/v2.0/index.js +2 -1
  72. package/dist/esm/shared/interfaces/restAPI/simulation/simulationRunBatch/IStopSimulationRunBatchRest_2_0.js +2 -0
  73. package/dist/esm/shared/interfaces/security/ICallCounterPreAggregatedValue.js +2 -0
  74. package/dist/esm/test.js +39 -0
  75. package/package.json +1 -1
  76. package/types/index.d.ts +299 -42
@@ -0,0 +1,81 @@
1
+ const contextAwareUserQueryRephrasingBasePrompt = `You are classifying and rephrasing user queries. Your rephrased user queries will be used as input for RAG and other LLM calls.
2
+
3
+ Instructions:
4
+ - Do not respond to the user query as in a real conversation.
5
+ - Determine whether the latest user query relates to the recent chat history.
6
+ - If it does, rephrase the latest user query, possibly including details from the previous chat history.
7
+ - If it does not, respond with "false".
8
+
9
+ What follows are some example conversations, followed last by the real conversation which you are working on.`;
10
+ const example1 = [
11
+ { role: "user", content: "Hi, my name is Micheal. I'm looking for support regarding an issue." },
12
+ { role: "assistant", content: "Great, let's get you connected with an agent. What is your customer ID?" },
13
+ { role: "user", content: "My ID is S0-F45T" },
14
+ { role: "assistant", content: "false" },
15
+ ];
16
+ const example2 = [
17
+ { role: "user", content: "The Toyota Proace City looks quite nice. I'm looking to fit a bunch of stuff in the car. How much capacity does it have?" },
18
+ { role: "assistant", content: "There are two variants: L1 has 3,8 m3 loading volume and L2 has 4,4 m3 loading volume." },
19
+ { role: "user", content: "And how much can I load?" },
20
+ { role: "assistant", content: "What is the maximum payload and towing capacity of the Toyota Proace City?" },
21
+ ];
22
+ const example3 = [
23
+ { role: "user", content: "I am looking for a new smartphone." },
24
+ { role: "assistant", content: "What features are you interested in?" },
25
+ { role: "user", content: "I want a good camera and long battery life." },
26
+ { role: "assistant", content: "Great! Are you looking for a specific brand or operating system, like Android or iOS?" },
27
+ { role: "user", content: "I prefer Android devices." },
28
+ { role: "assistant", content: "Do you have a budget in mind?" },
29
+ { role: "user", content: "I would like to keep it under $800." },
30
+ { role: "user", content: "Can you recommend a model?" },
31
+ { role: "assistant", content: "Can you suggest an Android smartphone under $800 with a good camera and long battery life?" },
32
+ ];
33
+ export const contextAwareUserQueryRephrasingChatPrompt = [
34
+ {
35
+ role: "system",
36
+ content: contextAwareUserQueryRephrasingBasePrompt,
37
+ },
38
+ ...example1,
39
+ ...example2,
40
+ ...example3,
41
+ ];
42
+ const mapExampleToPrompt = (example) => {
43
+ return example.map(message => message.role === "user" ? `User: ${message.content}` : `Assistant: ${message.content}`).join("\n");
44
+ };
45
+ export const alternativeContextAwareUserQueryRephrasingChatPrompt = [
46
+ {
47
+ role: "system",
48
+ content: `# Role and Objective
49
+ You are classifying and rephrasing user queries. Your rephrased user queries will be used as input for RAG and other LLM calls.
50
+
51
+ # Instructions
52
+ - Do not respond to the user query as in a real conversation.
53
+ - Determine whether the latest user query relates to the previous messages.
54
+ - If it does relate, rephrase the latest user query, possibly including details from the previous messages.
55
+ - If it does not relate, respond with "false".
56
+
57
+ ## Rephrasing
58
+ - View the previous messages and look at related context in the immediate past.
59
+ - Pull relevant context from those messages and include them in the rephrased user query.
60
+ - Such context include, but is not limited to, user or product information, names, and dates.
61
+
62
+ # Output Format
63
+ - Rephrased user query
64
+ - or false, if unrelated to the previous messages
65
+
66
+ # Examples
67
+
68
+ ## Example 1
69
+ ${mapExampleToPrompt(example1)}
70
+
71
+ ## Example 2
72
+ ${mapExampleToPrompt(example2)}
73
+
74
+ ## Example 3
75
+ ${mapExampleToPrompt(example3)}
76
+
77
+ # Final instructions and prompt to think step by step
78
+ - Let’s think step-by-step.`,
79
+ },
80
+ ];
81
+ //# sourceMappingURL=contextAwareUserQueryRephrasing.js.map
@@ -33,6 +33,7 @@ export const generativeAIModels = [
33
33
  "claude-sonnet-4-0",
34
34
  "text-bison@001",
35
35
  "custom-model",
36
+ "custom-embedding-model",
36
37
  "gemini-1.0-pro",
37
38
  "gemini-1.5-pro",
38
39
  "gemini-1.5-flash",
@@ -50,6 +51,7 @@ export const generativeAIModels = [
50
51
  "pixtral-large-latest",
51
52
  "mistral-medium-latest",
52
53
  "mistral-small-latest",
54
+ "text-davinci-003",
53
55
  ...embeddingModels,
54
56
  ];
55
57
  export const generativeAIProviders = [
@@ -130,6 +130,12 @@ export const createHandoverRequestDataSchema = {
130
130
  enableHandoverConnectMessageRingCentralEngage: {
131
131
  type: "boolean"
132
132
  },
133
+ enableHandoverDisconnectMessageSalesforceMIAW: {
134
+ type: "boolean"
135
+ },
136
+ enableHandoverConnectMessageSalesforceMIAW: {
137
+ type: "boolean"
138
+ },
133
139
  "notifySessionId": {
134
140
  "type": "string",
135
141
  },
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IGetAiAgentJobsTools.js.map
@@ -1,4 +1,4 @@
1
- import { nodeDescriptorSchema, nodeFieldSchema, } from "./INodeDescriptorSet";
1
+ import { nodeDescriptorSchema, nodeFieldSchema } from "./INodeDescriptorSet";
2
2
  export const knowledgeFieldTypes = [
3
3
  "text",
4
4
  "rule",
@@ -17,13 +17,13 @@ export const knowledgeFieldTypes = [
17
17
  "daterange",
18
18
  "connection",
19
19
  "condition",
20
- "description",
20
+ "description"
21
21
  ];
22
22
  export const knowledgeFieldSchema = {
23
23
  title: "knowledgeFieldSchema",
24
24
  type: "object",
25
25
  additionalProperties: false,
26
- properties: Object.assign(Object.assign({}, nodeFieldSchema.properties), { type: { type: "string", enum: [...knowledgeFieldTypes] }, key: { type: "string", minLength: 1, maxLength: 200 } }),
26
+ properties: Object.assign(Object.assign({}, nodeFieldSchema.properties), { type: { type: "string", enum: [...knowledgeFieldTypes] }, key: { type: "string", minLength: 1, maxLength: 200 } })
27
27
  };
28
28
  const { type, summary, defaultLabel, sections, form } = nodeDescriptorSchema.properties;
29
29
  export const knowledgeDescriptorSchema = {
@@ -36,7 +36,39 @@ export const knowledgeDescriptorSchema = {
36
36
  summary,
37
37
  sections,
38
38
  form,
39
- fields: { type: "array", items: knowledgeFieldSchema },
40
- },
39
+ fields: { type: "array", items: knowledgeFieldSchema }
40
+ }
41
+ };
42
+ const filterNonConfigFields = ({ type }) => !["description"].includes(type);
43
+ export const buildConfigValidationSchema = (fields) => ({
44
+ type: "object",
45
+ additionalProperties: false,
46
+ required: (fields || []).filter(filterNonConfigFields).map(({ key }) => key),
47
+ properties: Object.assign({}, (fields || []).filter(filterNonConfigFields).reduce((result, field) => (Object.assign(Object.assign({}, result), { [field.key]: mapFieldToSchema(field) })), {}))
48
+ });
49
+ const mapFieldToSchema = ({ type, params }) => {
50
+ switch (type) {
51
+ case "checkbox":
52
+ case "toggle":
53
+ return { type: "boolean" };
54
+ case "number":
55
+ case "slider":
56
+ return { type: "number" };
57
+ case "textArray":
58
+ return {
59
+ type: "array",
60
+ minLength: (params === null || params === void 0 ? void 0 : params.required) ? 1 : 0
61
+ };
62
+ case "json":
63
+ return {
64
+ type: ["object", "array"],
65
+ additionalProperties: true
66
+ };
67
+ default:
68
+ return {
69
+ type: "string",
70
+ minLength: (params === null || params === void 0 ? void 0 : params.required) ? 1 : 0
71
+ };
72
+ }
41
73
  };
42
74
  //# sourceMappingURL=IKnowledgeDescriptor.js.map
@@ -54,6 +54,7 @@ export const openAICompatibleMetaSchema = {
54
54
  customModel: { type: "string" },
55
55
  baseCustomUrl: { type: "string" },
56
56
  customAuthHeader: { type: "string" },
57
+ embeddingVectorSize: { type: "number" },
57
58
  }
58
59
  };
59
60
  export const azureOpenAIMetaSchema = {
@@ -159,4 +160,17 @@ export const largeLanguageModelSchema = {
159
160
  properties: Object.assign(Object.assign(Object.assign({}, largeLanguageModelDataSchema.properties), entityMetaSchema.properties), { projectReference: { type: "string", format: "mongo-id" }, organisationReference: { type: "string", format: "mongo-id" }, referenceId: { type: "string", format: "uuid" } })
160
161
  };
161
162
  export const largeLanguageModelQuerySchema = createQuerySchema("largeLanguageModelQuerySchema", largeLanguageModelSchema);
163
+ export const isIGraphLargeLanguageModel = (resource) => {
164
+ return (resource &&
165
+ resource.type === "largeLanguageModel" &&
166
+ resource._id &&
167
+ resource.name &&
168
+ resource.referenceId &&
169
+ resource.properties &&
170
+ resource.properties.modelType &&
171
+ resource.properties.createdAt &&
172
+ resource.properties.createdBy &&
173
+ resource.properties.lastChanged &&
174
+ resource.properties.lastChangedBy);
175
+ };
162
176
  //# sourceMappingURL=ILargeLanguageModel.js.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ICreateJWTToken.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ICallCounterPreAggregatedValue_3_0.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IGetCallCounterOrganisationRest_3_0.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IGetCallCounterRest_3_0.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @openapi
3
+ * components:
4
+ * schemas:
5
+ * IAiAgentJobNodeWithTools_2_0:
6
+ * type: object
7
+ * properties:
8
+ * _id:
9
+ * type: string
10
+ * referenceId:
11
+ * type: string
12
+ * type:
13
+ * type: string
14
+ * example: "aiAgentJob"
15
+ * label:
16
+ * type: string
17
+ * comment:
18
+ * type: string
19
+ * commentColor:
20
+ * type: string
21
+ * analyticsLabel:
22
+ * type: string
23
+ * nullable: true
24
+ * isDisabled:
25
+ * type: boolean
26
+ * isEntryPoint:
27
+ * type: boolean
28
+ * extension:
29
+ * type: string
30
+ * config:
31
+ * type: object
32
+ * description: Job node configuration (content varies by implementation)
33
+ * tools:
34
+ * type: array
35
+ * items:
36
+ * $ref: '#/components/schemas/IAiAgentJobToolNode_2_0'
37
+ * IAiAgentJobToolNode_2_0:
38
+ * type: object
39
+ * properties:
40
+ * _id:
41
+ * type: string
42
+ * referenceId:
43
+ * type: string
44
+ * type:
45
+ * type: string
46
+ * label:
47
+ * type: string
48
+ * comment:
49
+ * type: string
50
+ * commentColor:
51
+ * type: string
52
+ * analyticsLabel:
53
+ * type: string
54
+ * nullable: true
55
+ * isDisabled:
56
+ * type: boolean
57
+ * isEntryPoint:
58
+ * type: boolean
59
+ * extension:
60
+ * type: string
61
+ * config:
62
+ * type: object
63
+ * description: Tool node configuration (content varies by tool type)
64
+ */
65
+ //# sourceMappingURL=IAiAgentJobNodeWithTools_2_0.js.map
@@ -0,0 +1,3 @@
1
+ /* Interfaces */
2
+ export {};
3
+ //# sourceMappingURL=IGetAiAgentJobAndToolsRest_2_0%20.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IIndexKnowledgeDescriptorsRest_2_0.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IRunKnowledgeExtensionRest_2_0.js.map
@@ -1,2 +1,3 @@
1
- export {};
1
+ export * from "./IIndexKnowledgeDescriptorsRest_2_0";
2
+ export * from "./extension/IRunKnowledgeExtensionRest_2_0";
2
3
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IStopSimulationRunBatchRest_2_0.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ICallCounterPreAggregatedValue.js.map
@@ -0,0 +1,39 @@
1
+ /* import { RestAPIClient, TRestAPIClient } from "./RestAPIClient";
2
+ import * as fs from "fs";
3
+ const FormData = require("form-data");
4
+
5
+ const OAUTH_CLIENT_ID = "cognigy-ui";
6
+ const OAUTH_CLIENT_SECRET =
7
+ "KR7yxR3rAhZ9sEn923dZ5KeNs9SVuwBjHxXKpmqtvSNXw5xWz35Y5YRtTBt96Jaa";
8
+ const baseUrl = "https://api.test";
9
+
10
+ const instance = new RestAPIClient({
11
+ numberOfRetries: 2,
12
+ baseUrl,
13
+ versions: {
14
+ administration: "2.0",
15
+ external: "2.0",
16
+ metrics: "2.0",
17
+ resources: "2.0",
18
+ sessions: "2.0"
19
+ },
20
+ timeout: 10000
21
+ });
22
+
23
+ (async () => {
24
+
25
+ const base64SnapshotString = fs.readFileSync('./src/IDE/fixtures/snapshots/overrideSnapshotConnections_project.csnap')
26
+ const form = new FormData();
27
+
28
+ form.append("projectId", projectId);
29
+ form.append("file", base64SnapshotString, "snapshot.csnap");
30
+
31
+ const slot = await instance.uploadExtension({
32
+ projectId: "your-project-id"
33
+ fs.readFileSync('./src/IDE/fixtures/snapshots/overrideSnapshotConnections_project.csnap'),
34
+ user: "your-user-id",
35
+ });
36
+ console.log(slot);
37
+ })();
38
+ */
39
+ //# sourceMappingURL=test.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognigy/rest-api-client",
3
- "version": "2025.15.1",
3
+ "version": "2025.17.0",
4
4
  "description": "Cognigy REST-Client",
5
5
  "main": "build/index.js",
6
6
  "module": "dist/esm/index.js",