@fonoster/sdk 0.13.4 → 0.13.5
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/dist/node/Applications.d.ts +63 -1
- package/dist/node/Applications.js +102 -0
- package/dist/node/client/types/ApplicationsClient.d.ts +2 -1
- package/dist/node/generated/node/applications_grpc_pb.js +34 -0
- package/dist/node/generated/node/applications_pb.js +1312 -0
- package/dist/node/generated/web/ApplicationsServiceClientPb.ts +43 -0
- package/dist/node/generated/web/applications_pb.d.ts +162 -0
- package/dist/node/generated/web/applications_pb.js +1312 -0
- package/dist/node/tsconfig.tsbuildinfo +1 -1
- package/dist/web/fonoster.min.js +1 -1
- package/dist/web/index.esm.js +1 -1
- package/package.json +4 -4
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { Application, BaseApiObject, CreateApplicationRequest, ListApplicationsRequest, ListApplicationsResponse, UpdateApplicationRequest } from "@fonoster/types";
|
|
19
|
+
import { Application, BaseApiObject, CreateApplicationRequest, EvaluateIntelligenceRequest, EvaluateIntelligenceResponse, ListApplicationsRequest, ListApplicationsResponse, UpdateApplicationRequest } from "@fonoster/types";
|
|
20
20
|
import { FonosterClient } from "./client/types";
|
|
21
21
|
/**
|
|
22
22
|
* @classdesc Fonoster Applications, part of the Fonoster Voice Subsystem,
|
|
@@ -206,5 +206,67 @@ declare class Applications {
|
|
|
206
206
|
* .catch(console.error); // an error occurred
|
|
207
207
|
*/
|
|
208
208
|
deleteApplication(ref: string): Promise<BaseApiObject>;
|
|
209
|
+
/**
|
|
210
|
+
* Evaluates the intelligence of an application.
|
|
211
|
+
*
|
|
212
|
+
* @param {EvaluateIntelligenceRequest} request - The request object that contains the necessary information to evaluate the intelligence of an application
|
|
213
|
+
* @param {string} request.intelligence.productRef - The product reference of the intelligence engine (e.g., llm.groq)
|
|
214
|
+
* @param {object} request.intelligence.config - The configuration object for the intelligence engine
|
|
215
|
+
* @return {Promise<ScenarioEvaluationReport>} - The response object that contains the evaluation report
|
|
216
|
+
* @example
|
|
217
|
+
* const apps = new SDK.Applications(client); // Existing client object
|
|
218
|
+
*
|
|
219
|
+
* const request = {
|
|
220
|
+
* intelligence: {
|
|
221
|
+
* productRef: "llm.groq",
|
|
222
|
+
* config: {
|
|
223
|
+
* conversationSettings: {
|
|
224
|
+
* firstMessage: "Hello, how can I help you today?",
|
|
225
|
+
* systemPrompt: "You are a helpful assistant.",
|
|
226
|
+
* systemErrorMessage: "I'm sorry, I didn't catch that. Can you say that again?",
|
|
227
|
+
* goodbyeMessage: "Thank you for calling. Have a great day!",
|
|
228
|
+
* languageModel: {
|
|
229
|
+
* provider: "openai",
|
|
230
|
+
* model: "gpt-4o"
|
|
231
|
+
* },
|
|
232
|
+
* testCases: {
|
|
233
|
+
* evalsLanguageModel: {
|
|
234
|
+
* provider: "openai",
|
|
235
|
+
* model: "gpt-4o"
|
|
236
|
+
* },
|
|
237
|
+
* scenarios: [
|
|
238
|
+
* {
|
|
239
|
+
* ref: "Scenario 1",
|
|
240
|
+
* description: "Scenario 1 description",
|
|
241
|
+
* telephonyContext: {
|
|
242
|
+
* callDirection: "FROM_PSTN",
|
|
243
|
+
* ingressNumber: "1234567890",
|
|
244
|
+
* callerNumber: "1234567890"
|
|
245
|
+
* },
|
|
246
|
+
* conversation: [
|
|
247
|
+
* {
|
|
248
|
+
* userInput: "Hello, how can I help you today?",
|
|
249
|
+
* expected: {
|
|
250
|
+
* text: {
|
|
251
|
+
* type: "EXACT",
|
|
252
|
+
* response: "Hello, how can I help you today?"
|
|
253
|
+
* }
|
|
254
|
+
* }
|
|
255
|
+
* }
|
|
256
|
+
* ]
|
|
257
|
+
* }
|
|
258
|
+
* ]
|
|
259
|
+
* }
|
|
260
|
+
* }
|
|
261
|
+
* }
|
|
262
|
+
* }
|
|
263
|
+
* };
|
|
264
|
+
*
|
|
265
|
+
* apps
|
|
266
|
+
* .evaluateIntelligence(request)
|
|
267
|
+
* .then(console.log) // successful response
|
|
268
|
+
* .catch(console.error); // an error occurred
|
|
269
|
+
*/
|
|
270
|
+
evaluateIntelligence(request: EvaluateIntelligenceRequest): Promise<EvaluateIntelligenceResponse>;
|
|
209
271
|
}
|
|
210
272
|
export { Applications };
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Applications = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const types_1 = require("@fonoster/types");
|
|
23
|
+
const struct_pb_1 = require("google-protobuf/google/protobuf/struct_pb");
|
|
4
24
|
const makeRpcRequest_1 = require("./client/makeRpcRequest");
|
|
5
25
|
const applications_pb_1 = require("./generated/node/applications_pb");
|
|
6
26
|
const utils_1 = require("./utils");
|
|
@@ -261,5 +281,87 @@ class Applications {
|
|
|
261
281
|
request: { ref }
|
|
262
282
|
});
|
|
263
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Evaluates the intelligence of an application.
|
|
286
|
+
*
|
|
287
|
+
* @param {EvaluateIntelligenceRequest} request - The request object that contains the necessary information to evaluate the intelligence of an application
|
|
288
|
+
* @param {string} request.intelligence.productRef - The product reference of the intelligence engine (e.g., llm.groq)
|
|
289
|
+
* @param {object} request.intelligence.config - The configuration object for the intelligence engine
|
|
290
|
+
* @return {Promise<ScenarioEvaluationReport>} - The response object that contains the evaluation report
|
|
291
|
+
* @example
|
|
292
|
+
* const apps = new SDK.Applications(client); // Existing client object
|
|
293
|
+
*
|
|
294
|
+
* const request = {
|
|
295
|
+
* intelligence: {
|
|
296
|
+
* productRef: "llm.groq",
|
|
297
|
+
* config: {
|
|
298
|
+
* conversationSettings: {
|
|
299
|
+
* firstMessage: "Hello, how can I help you today?",
|
|
300
|
+
* systemPrompt: "You are a helpful assistant.",
|
|
301
|
+
* systemErrorMessage: "I'm sorry, I didn't catch that. Can you say that again?",
|
|
302
|
+
* goodbyeMessage: "Thank you for calling. Have a great day!",
|
|
303
|
+
* languageModel: {
|
|
304
|
+
* provider: "openai",
|
|
305
|
+
* model: "gpt-4o"
|
|
306
|
+
* },
|
|
307
|
+
* testCases: {
|
|
308
|
+
* evalsLanguageModel: {
|
|
309
|
+
* provider: "openai",
|
|
310
|
+
* model: "gpt-4o"
|
|
311
|
+
* },
|
|
312
|
+
* scenarios: [
|
|
313
|
+
* {
|
|
314
|
+
* ref: "Scenario 1",
|
|
315
|
+
* description: "Scenario 1 description",
|
|
316
|
+
* telephonyContext: {
|
|
317
|
+
* callDirection: "FROM_PSTN",
|
|
318
|
+
* ingressNumber: "1234567890",
|
|
319
|
+
* callerNumber: "1234567890"
|
|
320
|
+
* },
|
|
321
|
+
* conversation: [
|
|
322
|
+
* {
|
|
323
|
+
* userInput: "Hello, how can I help you today?",
|
|
324
|
+
* expected: {
|
|
325
|
+
* text: {
|
|
326
|
+
* type: "EXACT",
|
|
327
|
+
* response: "Hello, how can I help you today?"
|
|
328
|
+
* }
|
|
329
|
+
* }
|
|
330
|
+
* }
|
|
331
|
+
* ]
|
|
332
|
+
* }
|
|
333
|
+
* ]
|
|
334
|
+
* }
|
|
335
|
+
* }
|
|
336
|
+
* }
|
|
337
|
+
* }
|
|
338
|
+
* };
|
|
339
|
+
*
|
|
340
|
+
* apps
|
|
341
|
+
* .evaluateIntelligence(request)
|
|
342
|
+
* .then(console.log) // successful response
|
|
343
|
+
* .catch(console.error); // an error occurred
|
|
344
|
+
*/
|
|
345
|
+
async evaluateIntelligence(request) {
|
|
346
|
+
const applicationsClient = this.client.getApplicationsClient();
|
|
347
|
+
const response = await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
348
|
+
method: applicationsClient.evaluateIntelligence.bind(applicationsClient),
|
|
349
|
+
requestPBObjectConstructor: applications_pb_1.EvaluateIntelligenceRequest,
|
|
350
|
+
metadata: this.client.getMetadata(),
|
|
351
|
+
request: {
|
|
352
|
+
intelligence: {
|
|
353
|
+
productRef: request.intelligence.productRef,
|
|
354
|
+
config: struct_pb_1.Struct.fromJavaScript(request.intelligence.config)
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
enumMapping: [["ExpectedTextType", types_1.ExpectedTextType]],
|
|
358
|
+
objectMapping: [["intelligence", applications_pb_1.ProductContainer]],
|
|
359
|
+
repeatableObjectMapping: [
|
|
360
|
+
["resultsList", applications_pb_1.ScenarioEvaluationReport],
|
|
361
|
+
["stepsList", applications_pb_1.StepEvaluationReport]
|
|
362
|
+
]
|
|
363
|
+
});
|
|
364
|
+
return response;
|
|
365
|
+
}
|
|
264
366
|
}
|
|
265
367
|
exports.Applications = Applications;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { Application, CreateApplicationRequest, CreateApplicationResponse, DeleteApplicationRequest, DeleteApplicationResponse, GetApplicationRequest, ListApplicationsRequest, ListApplicationsResponse, UpdateApplicationRequest, UpdateApplicationResponse } from "../../generated/web/applications_pb";
|
|
19
|
+
import { Application, CreateApplicationRequest, CreateApplicationResponse, DeleteApplicationRequest, DeleteApplicationResponse, EvaluateIntelligenceRequest, EvaluateIntelligenceResponse, GetApplicationRequest, ListApplicationsRequest, ListApplicationsResponse, UpdateApplicationRequest, UpdateApplicationResponse } from "../../generated/web/applications_pb";
|
|
20
20
|
import { ClientFunction } from "./common";
|
|
21
21
|
type ApplicationsClient = {
|
|
22
22
|
createApplication: ClientFunction<CreateApplicationRequest, CreateApplicationResponse>;
|
|
@@ -24,5 +24,6 @@ type ApplicationsClient = {
|
|
|
24
24
|
updateApplication: ClientFunction<UpdateApplicationRequest, UpdateApplicationResponse>;
|
|
25
25
|
listApplications: ClientFunction<ListApplicationsRequest, ListApplicationsResponse>;
|
|
26
26
|
deleteApplication: ClientFunction<DeleteApplicationRequest, DeleteApplicationResponse>;
|
|
27
|
+
evaluateIntelligence: ClientFunction<EvaluateIntelligenceRequest, EvaluateIntelligenceResponse>;
|
|
27
28
|
};
|
|
28
29
|
export { ApplicationsClient };
|
|
@@ -78,6 +78,28 @@ function deserialize_fonoster_applications_v1beta2_DeleteApplicationResponse(buf
|
|
|
78
78
|
return applications_pb.DeleteApplicationResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
function serialize_fonoster_applications_v1beta2_EvaluateIntelligenceRequest(arg) {
|
|
82
|
+
if (!(arg instanceof applications_pb.EvaluateIntelligenceRequest)) {
|
|
83
|
+
throw new Error('Expected argument of type fonoster.applications.v1beta2.EvaluateIntelligenceRequest');
|
|
84
|
+
}
|
|
85
|
+
return Buffer.from(arg.serializeBinary());
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function deserialize_fonoster_applications_v1beta2_EvaluateIntelligenceRequest(buffer_arg) {
|
|
89
|
+
return applications_pb.EvaluateIntelligenceRequest.deserializeBinary(new Uint8Array(buffer_arg));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function serialize_fonoster_applications_v1beta2_EvaluateIntelligenceResponse(arg) {
|
|
93
|
+
if (!(arg instanceof applications_pb.EvaluateIntelligenceResponse)) {
|
|
94
|
+
throw new Error('Expected argument of type fonoster.applications.v1beta2.EvaluateIntelligenceResponse');
|
|
95
|
+
}
|
|
96
|
+
return Buffer.from(arg.serializeBinary());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function deserialize_fonoster_applications_v1beta2_EvaluateIntelligenceResponse(buffer_arg) {
|
|
100
|
+
return applications_pb.EvaluateIntelligenceResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
101
|
+
}
|
|
102
|
+
|
|
81
103
|
function serialize_fonoster_applications_v1beta2_GetApplicationRequest(arg) {
|
|
82
104
|
if (!(arg instanceof applications_pb.GetApplicationRequest)) {
|
|
83
105
|
throw new Error('Expected argument of type fonoster.applications.v1beta2.GetApplicationRequest');
|
|
@@ -196,6 +218,18 @@ deleteApplication: {
|
|
|
196
218
|
responseSerialize: serialize_fonoster_applications_v1beta2_DeleteApplicationResponse,
|
|
197
219
|
responseDeserialize: deserialize_fonoster_applications_v1beta2_DeleteApplicationResponse,
|
|
198
220
|
},
|
|
221
|
+
// Evaluate the intellgence for an Autopilot application
|
|
222
|
+
evaluateIntelligence: {
|
|
223
|
+
path: '/fonoster.applications.v1beta2.Applications/EvaluateIntelligence',
|
|
224
|
+
requestStream: false,
|
|
225
|
+
responseStream: false,
|
|
226
|
+
requestType: applications_pb.EvaluateIntelligenceRequest,
|
|
227
|
+
responseType: applications_pb.EvaluateIntelligenceResponse,
|
|
228
|
+
requestSerialize: serialize_fonoster_applications_v1beta2_EvaluateIntelligenceRequest,
|
|
229
|
+
requestDeserialize: deserialize_fonoster_applications_v1beta2_EvaluateIntelligenceRequest,
|
|
230
|
+
responseSerialize: serialize_fonoster_applications_v1beta2_EvaluateIntelligenceResponse,
|
|
231
|
+
responseDeserialize: deserialize_fonoster_applications_v1beta2_EvaluateIntelligenceResponse,
|
|
232
|
+
},
|
|
199
233
|
};
|
|
200
234
|
|
|
201
235
|
exports.ApplicationsClient = grpc.makeGenericClientConstructor(ApplicationsService, 'Applications');
|