@fonoster/sdk 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/node/Applications.d.ts +11 -0
- package/dist/node/Applications.js +20 -0
- package/dist/node/client/types/ApplicationsClient.d.ts +3 -1
- 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
package/README.md
CHANGED
|
@@ -711,6 +711,7 @@ Note that an active Fonoster deployment is required.
|
|
|
711
711
|
* [.updateApplication(request)](#Applications+updateApplication) ⇒ <code>Promise.<BaseApiObject></code>
|
|
712
712
|
* [.listApplications(request)](#Applications+listApplications) ⇒ <code>Promise.<ListApplicationsResponse></code>
|
|
713
713
|
* [.deleteApplication(ref)](#Applications+deleteApplication) ⇒ <code>Promise.<BaseApiObject></code>
|
|
714
|
+
* [.evaluateIntelligence(request)](#Applications+evaluateIntelligence) ⇒ <code>Promise.<ScenarioEvaluationReport></code>
|
|
714
715
|
|
|
715
716
|
<a name="new_Applications_new"></a>
|
|
716
717
|
|
|
@@ -930,6 +931,75 @@ apps
|
|
|
930
931
|
.then(console.log) // successful response
|
|
931
932
|
.catch(console.error); // an error occurred
|
|
932
933
|
```
|
|
934
|
+
<a name="Applications+evaluateIntelligence"></a>
|
|
935
|
+
|
|
936
|
+
### applications.evaluateIntelligence(request) ⇒ <code>Promise.<ScenarioEvaluationReport></code>
|
|
937
|
+
Evaluates the intelligence of an application.
|
|
938
|
+
|
|
939
|
+
**Kind**: instance method of [<code>Applications</code>](#Applications)
|
|
940
|
+
**Returns**: <code>Promise.<ScenarioEvaluationReport></code> - - The response object that contains the evaluation report
|
|
941
|
+
|
|
942
|
+
| Param | Type | Description |
|
|
943
|
+
| --- | --- | --- |
|
|
944
|
+
| request | <code>EvaluateIntelligenceRequest</code> | The request object that contains the necessary information to evaluate the intelligence of an application |
|
|
945
|
+
| request.intelligence.productRef | <code>string</code> | The product reference of the intelligence engine (e.g., llm.groq) |
|
|
946
|
+
| request.intelligence.config | <code>object</code> | The configuration object for the intelligence engine |
|
|
947
|
+
|
|
948
|
+
**Example**
|
|
949
|
+
```js
|
|
950
|
+
const apps = new SDK.Applications(client); // Existing client object
|
|
951
|
+
|
|
952
|
+
const request = {
|
|
953
|
+
intelligence: {
|
|
954
|
+
productRef: "llm.groq",
|
|
955
|
+
config: {
|
|
956
|
+
conversationSettings: {
|
|
957
|
+
firstMessage: "Hello, how can I help you today?",
|
|
958
|
+
systemPrompt: "You are a helpful assistant.",
|
|
959
|
+
systemErrorMessage: "I'm sorry, I didn't catch that. Can you say that again?",
|
|
960
|
+
goodbyeMessage: "Thank you for calling. Have a great day!",
|
|
961
|
+
languageModel: {
|
|
962
|
+
provider: "openai",
|
|
963
|
+
model: "gpt-4o"
|
|
964
|
+
},
|
|
965
|
+
testCases: {
|
|
966
|
+
evalsLanguageModel: {
|
|
967
|
+
provider: "openai",
|
|
968
|
+
model: "gpt-4o"
|
|
969
|
+
},
|
|
970
|
+
scenarios: [
|
|
971
|
+
{
|
|
972
|
+
ref: "Scenario 1",
|
|
973
|
+
description: "Scenario 1 description",
|
|
974
|
+
telephonyContext: {
|
|
975
|
+
callDirection: "FROM_PSTN",
|
|
976
|
+
ingressNumber: "1234567890",
|
|
977
|
+
callerNumber: "1234567890"
|
|
978
|
+
},
|
|
979
|
+
conversation: [
|
|
980
|
+
{
|
|
981
|
+
userInput: "Hello, how can I help you today?",
|
|
982
|
+
expected: {
|
|
983
|
+
text: {
|
|
984
|
+
type: "EXACT",
|
|
985
|
+
response: "Hello, how can I help you today?"
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
]
|
|
990
|
+
}
|
|
991
|
+
]
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
apps
|
|
999
|
+
.evaluateIntelligence(request)
|
|
1000
|
+
.then(console.log) // successful response
|
|
1001
|
+
.catch(console.error); // an error occurred
|
|
1002
|
+
```
|
|
933
1003
|
|
|
934
1004
|
<a name="Calls"></a>
|
|
935
1005
|
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { Application, BaseApiObject, CreateApplicationRequest, EvaluateIntelligenceRequest, EvaluateIntelligenceResponse, ListApplicationsRequest, ListApplicationsResponse, UpdateApplicationRequest } from "@fonoster/types";
|
|
20
20
|
import { FonosterClient } from "./client/types";
|
|
21
|
+
import { TestTokenResponse } from "./generated/node/applications_pb";
|
|
21
22
|
/**
|
|
22
23
|
* @classdesc Fonoster Applications, part of the Fonoster Voice Subsystem,
|
|
23
24
|
* allow you to create, update, retrieve, and delete Voice Applications.
|
|
@@ -268,5 +269,15 @@ declare class Applications {
|
|
|
268
269
|
* .catch(console.error); // an error occurred
|
|
269
270
|
*/
|
|
270
271
|
evaluateIntelligence(request: EvaluateIntelligenceRequest): Promise<EvaluateIntelligenceResponse>;
|
|
272
|
+
/**
|
|
273
|
+
* Creates an Ephemeral Agent token for test calls.
|
|
274
|
+
*
|
|
275
|
+
* @return {Promise<TestTokenResponse>} - The response object containing the ephemeral agent token and related info
|
|
276
|
+
* @example
|
|
277
|
+
* const apps = new SDK.Applications(client);
|
|
278
|
+
* const response = await apps.createTestToken();
|
|
279
|
+
* console.log(response.token); // JWT token for test call
|
|
280
|
+
*/
|
|
281
|
+
createTestToken(): Promise<TestTokenResponse.AsObject>;
|
|
271
282
|
}
|
|
272
283
|
export { Applications };
|
|
@@ -20,6 +20,7 @@ exports.Applications = void 0;
|
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
22
|
const types_1 = require("@fonoster/types");
|
|
23
|
+
const empty_pb_1 = require("google-protobuf/google/protobuf/empty_pb");
|
|
23
24
|
const struct_pb_1 = require("google-protobuf/google/protobuf/struct_pb");
|
|
24
25
|
const makeRpcRequest_1 = require("./client/makeRpcRequest");
|
|
25
26
|
const applications_pb_1 = require("./generated/node/applications_pb");
|
|
@@ -368,5 +369,24 @@ class Applications {
|
|
|
368
369
|
});
|
|
369
370
|
return response;
|
|
370
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Creates an Ephemeral Agent token for test calls.
|
|
374
|
+
*
|
|
375
|
+
* @return {Promise<TestTokenResponse>} - The response object containing the ephemeral agent token and related info
|
|
376
|
+
* @example
|
|
377
|
+
* const apps = new SDK.Applications(client);
|
|
378
|
+
* const response = await apps.createTestToken();
|
|
379
|
+
* console.log(response.token); // JWT token for test call
|
|
380
|
+
*/
|
|
381
|
+
async createTestToken() {
|
|
382
|
+
const applicationsClient = this.client.getApplicationsClient();
|
|
383
|
+
const response = await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
384
|
+
method: applicationsClient.createTestToken.bind(applicationsClient),
|
|
385
|
+
requestPBObjectConstructor: empty_pb_1.Empty,
|
|
386
|
+
metadata: this.client.getMetadata(),
|
|
387
|
+
request: {}
|
|
388
|
+
});
|
|
389
|
+
return response;
|
|
390
|
+
}
|
|
371
391
|
}
|
|
372
392
|
exports.Applications = Applications;
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { Empty } from "google-protobuf/google/protobuf/empty_pb";
|
|
20
|
+
import { Application, CreateApplicationRequest, CreateApplicationResponse, DeleteApplicationRequest, DeleteApplicationResponse, EvaluateIntelligenceRequest, EvaluateIntelligenceResponse, GetApplicationRequest, ListApplicationsRequest, ListApplicationsResponse, TestTokenResponse, UpdateApplicationRequest, UpdateApplicationResponse } from "../../generated/web/applications_pb";
|
|
20
21
|
import { ClientFunction } from "./common";
|
|
21
22
|
type ApplicationsClient = {
|
|
22
23
|
createApplication: ClientFunction<CreateApplicationRequest, CreateApplicationResponse>;
|
|
@@ -25,5 +26,6 @@ type ApplicationsClient = {
|
|
|
25
26
|
listApplications: ClientFunction<ListApplicationsRequest, ListApplicationsResponse>;
|
|
26
27
|
deleteApplication: ClientFunction<DeleteApplicationRequest, DeleteApplicationResponse>;
|
|
27
28
|
evaluateIntelligence: ClientFunction<EvaluateIntelligenceRequest, EvaluateIntelligenceResponse>;
|
|
29
|
+
createTestToken: ClientFunction<Empty, TestTokenResponse>;
|
|
28
30
|
};
|
|
29
31
|
export { ApplicationsClient };
|