@fencyai/js 0.1.168 → 0.1.170
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/lib/AgentTaskModel.d.ts.map +1 -1
- package/lib/api/agent-task-params/toStreamingChatCompletionTaskParams.d.ts +2 -0
- package/lib/api/agent-task-params/toStreamingChatCompletionTaskParams.d.ts.map +1 -1
- package/lib/api/agent-task-params/toStreamingChatCompletionTaskParams.js +4 -0
- package/lib/api/agent-task-params/toStructuredChatCompletionTaskParams.d.ts +2 -0
- package/lib/api/agent-task-params/toStructuredChatCompletionTaskParams.d.ts.map +1 -1
- package/lib/api/agent-task-params/toStructuredChatCompletionTaskParams.js +4 -0
- package/lib/api/createAgentTask.d.ts.map +1 -1
- package/lib/api/createAgentTask.js +9 -0
- package/lib/api/validateSamplingParameters.d.ts +2 -0
- package/lib/api/validateSamplingParameters.d.ts.map +1 -0
- package/lib/api/validateSamplingParameters.js +25 -0
- package/lib/openapi/ct-st/models/StreamingChatCompletionTaskTypeRequestDto.d.ts +2 -0
- package/lib/openapi/ct-st/models/StreamingChatCompletionTaskTypeRequestDto.d.ts.map +1 -1
- package/lib/openapi/ct-st/models/StructuredChatCompletionTaskTypeRequestDto.d.ts +2 -0
- package/lib/openapi/ct-st/models/StructuredChatCompletionTaskTypeRequestDto.d.ts.map +1 -1
- package/lib/types/CreateAgentTaskRequest.d.ts +4 -0
- package/lib/types/CreateAgentTaskRequest.d.ts.map +1 -1
- package/lib/utils/version.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentTaskModel.d.ts","sourceRoot":"","sources":["../src/AgentTaskModel.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,MAAM,MAAM,cAAc,GACpB,4BAA4B,GAC5B,2BAA2B,GAC3B,6BAA6B,GAC7B,2BAA2B,GAC3B,6BAA6B,GAC7B,yBAAyB,GACzB,8BAA8B,GAC9B,uBAAuB,GACvB,qBAAqB,GACrB,qBAAqB,GACrB,gBAAgB,GAChB,mBAAmB,GACnB,mBAAmB,CAAA;AACzB,cAAc;AACd,eAAO,MAAM,eAAe,EAAE,cAAc,EAc3C,CAAA;AAED,cAAc;AACd,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"AgentTaskModel.d.ts","sourceRoot":"","sources":["../src/AgentTaskModel.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,MAAM,MAAM,cAAc,GACpB,4BAA4B,GAC5B,2BAA2B,GAC3B,6BAA6B,GAC7B,2BAA2B,GAC3B,6BAA6B,GAC7B,yBAAyB,GACzB,8BAA8B,GAC9B,uBAAuB,GACvB,qBAAqB,GACrB,qBAAqB,GACrB,gBAAgB,GAChB,mBAAmB,GACnB,mBAAmB,CAAA;AACzB,cAAc;AACd,eAAO,MAAM,eAAe,EAAE,cAAc,EAc3C,CAAA;AAED,cAAc;AACd,eAAO,MAAM,qBAAqB,GAC9B,OAAO,MAAM,KACd,KAAK,IAAI,cAgBX,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CreateAgentTaskRequest } from '../../types/CreateAgentTaskRequest';
|
|
2
2
|
export declare function toStreamingChatCompletionTaskParams(task: CreateAgentTaskRequest['streamingChatCompletionTask']): {
|
|
3
|
+
topP?: number | null | undefined;
|
|
4
|
+
temperature?: number | null | undefined;
|
|
3
5
|
messages: {
|
|
4
6
|
role: import("../../openapi/ct-st").ModelMessageRole;
|
|
5
7
|
content: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStreamingChatCompletionTaskParams.d.ts","sourceRoot":"","sources":["../../../src/api/agent-task-params/toStreamingChatCompletionTaskParams.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAE3E,wBAAgB,mCAAmC,CAC/C,IAAI,EAAE,sBAAsB,CAAC,6BAA6B,CAAC
|
|
1
|
+
{"version":3,"file":"toStreamingChatCompletionTaskParams.d.ts","sourceRoot":"","sources":["../../../src/api/agent-task-params/toStreamingChatCompletionTaskParams.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAE3E,wBAAgB,mCAAmC,CAC/C,IAAI,EAAE,sBAAsB,CAAC,6BAA6B,CAAC;;;;;;;;cAiB9D"}
|
|
@@ -12,5 +12,9 @@ export function toStreamingChatCompletionTaskParams(task) {
|
|
|
12
12
|
content: message.content,
|
|
13
13
|
})),
|
|
14
14
|
model: task.model,
|
|
15
|
+
...(task.temperature !== undefined
|
|
16
|
+
? { temperature: task.temperature }
|
|
17
|
+
: {}),
|
|
18
|
+
...(task.topP !== undefined ? { topP: task.topP } : {}),
|
|
15
19
|
};
|
|
16
20
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CreateAgentTaskRequest } from '../../types/CreateAgentTaskRequest';
|
|
2
2
|
export declare function toStructuredChatCompletionTaskParams(task: CreateAgentTaskRequest['structuredChatCompletionTask']): {
|
|
3
|
+
topP?: number | null | undefined;
|
|
4
|
+
temperature?: number | null | undefined;
|
|
3
5
|
messages: {
|
|
4
6
|
role: import("../../openapi/ct-st").ModelMessageRole;
|
|
5
7
|
content: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStructuredChatCompletionTaskParams.d.ts","sourceRoot":"","sources":["../../../src/api/agent-task-params/toStructuredChatCompletionTaskParams.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAE3E,wBAAgB,oCAAoC,CAChD,IAAI,EAAE,sBAAsB,CAAC,8BAA8B,CAAC
|
|
1
|
+
{"version":3,"file":"toStructuredChatCompletionTaskParams.d.ts","sourceRoot":"","sources":["../../../src/api/agent-task-params/toStructuredChatCompletionTaskParams.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAE3E,wBAAgB,oCAAoC,CAChD,IAAI,EAAE,sBAAsB,CAAC,8BAA8B,CAAC;;;;;;;;;cAkB/D"}
|
|
@@ -13,5 +13,9 @@ export function toStructuredChatCompletionTaskParams(task) {
|
|
|
13
13
|
})),
|
|
14
14
|
jsonSchema: task.jsonSchema,
|
|
15
15
|
model: task.model,
|
|
16
|
+
...(task.temperature !== undefined
|
|
17
|
+
? { temperature: task.temperature }
|
|
18
|
+
: {}),
|
|
19
|
+
...(task.topP !== undefined ? { topP: task.topP } : {}),
|
|
16
20
|
};
|
|
17
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAgentTask.d.ts","sourceRoot":"","sources":["../../src/api/createAgentTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAKxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"createAgentTask.d.ts","sourceRoot":"","sources":["../../src/api/createAgentTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAKxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAI1E;;;GAGG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,sBAAsB,CAAA;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACtB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA2DnC"}
|
|
@@ -4,6 +4,7 @@ import { toMemoryChatTaskParams } from './agent-task-params/toMemoryChatTaskPara
|
|
|
4
4
|
import { toStructuredChatCompletionTaskParams } from './agent-task-params/toStructuredChatCompletionTaskParams';
|
|
5
5
|
import { toMemorySearchTaskParams } from './agent-task-params/toMemorySearchTaskParams';
|
|
6
6
|
import { getPackageVersion } from '../utils/version';
|
|
7
|
+
import { validateSamplingParameters } from './validateSamplingParameters';
|
|
7
8
|
/**
|
|
8
9
|
* Creates an agent task.
|
|
9
10
|
* @public
|
|
@@ -18,6 +19,14 @@ export async function createAgentTask(params) {
|
|
|
18
19
|
'X-Fency-Client-Token': params.clientToken,
|
|
19
20
|
'X-Fency-Stream-Token': params.streamToken,
|
|
20
21
|
};
|
|
22
|
+
const streaming = params.request.streamingChatCompletionTask;
|
|
23
|
+
if (streaming) {
|
|
24
|
+
validateSamplingParameters(streaming.model, streaming.temperature, streaming.topP);
|
|
25
|
+
}
|
|
26
|
+
const structured = params.request.structuredChatCompletionTask;
|
|
27
|
+
if (structured) {
|
|
28
|
+
validateSamplingParameters(structured.model, structured.temperature, structured.topP);
|
|
29
|
+
}
|
|
21
30
|
const response = await PubService.createAgentTask({
|
|
22
31
|
streamingChatCompletionTask: toStreamingChatCompletionTaskParams(params.request.streamingChatCompletionTask),
|
|
23
32
|
structuredChatCompletionTask: toStructuredChatCompletionTaskParams(params.request.structuredChatCompletionTask),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSamplingParameters.d.ts","sourceRoot":"","sources":["../../src/api/validateSamplingParameters.ts"],"names":[],"mappings":"AAAA,wBAAgB,0BAA0B,CACtC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAChC,IAAI,CAgCN"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function validateSamplingParameters(model, temperature, topP) {
|
|
2
|
+
const provider = model.split('/')[0];
|
|
3
|
+
if (temperature != null) {
|
|
4
|
+
switch (provider) {
|
|
5
|
+
case 'openai':
|
|
6
|
+
case 'google':
|
|
7
|
+
if (temperature < 0 || temperature > 2) {
|
|
8
|
+
throw new Error(`temperature must be between 0 and 2 for ${provider} models.`);
|
|
9
|
+
}
|
|
10
|
+
break;
|
|
11
|
+
case 'anthropic':
|
|
12
|
+
if (temperature < 0 || temperature > 1) {
|
|
13
|
+
throw new Error('temperature must be between 0 and 1 for Anthropic models.');
|
|
14
|
+
}
|
|
15
|
+
break;
|
|
16
|
+
default:
|
|
17
|
+
throw new Error(`Unknown model provider for sampling parameters: ${provider}.`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (topP != null) {
|
|
21
|
+
if (topP < 0 || topP > 1) {
|
|
22
|
+
throw new Error('topP must be between 0 and 1.');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -2,5 +2,7 @@ import type { ModelMessage } from './ModelMessage';
|
|
|
2
2
|
export type StreamingChatCompletionTaskTypeRequestDto = {
|
|
3
3
|
messages: Array<ModelMessage>;
|
|
4
4
|
model: string;
|
|
5
|
+
temperature?: number | null;
|
|
6
|
+
topP?: number | null;
|
|
5
7
|
};
|
|
6
8
|
//# sourceMappingURL=StreamingChatCompletionTaskTypeRequestDto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamingChatCompletionTaskTypeRequestDto.d.ts","sourceRoot":"","sources":["../../../../src/openapi/ct-st/models/StreamingChatCompletionTaskTypeRequestDto.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,MAAM,MAAM,yCAAyC,GAAG;IACpD,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"StreamingChatCompletionTaskTypeRequestDto.d.ts","sourceRoot":"","sources":["../../../../src/openapi/ct-st/models/StreamingChatCompletionTaskTypeRequestDto.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,MAAM,MAAM,yCAAyC,GAAG;IACpD,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructuredChatCompletionTaskTypeRequestDto.d.ts","sourceRoot":"","sources":["../../../../src/openapi/ct-st/models/StructuredChatCompletionTaskTypeRequestDto.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,MAAM,MAAM,0CAA0C,GAAG;IACrD,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"StructuredChatCompletionTaskTypeRequestDto.d.ts","sourceRoot":"","sources":["../../../../src/openapi/ct-st/models/StructuredChatCompletionTaskTypeRequestDto.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,MAAM,MAAM,0CAA0C,GAAG;IACrD,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC"}
|
|
@@ -6,6 +6,8 @@ export interface CreateAgentTaskRequest {
|
|
|
6
6
|
content: string;
|
|
7
7
|
}[];
|
|
8
8
|
model: string;
|
|
9
|
+
temperature?: number | null;
|
|
10
|
+
topP?: number | null;
|
|
9
11
|
};
|
|
10
12
|
structuredChatCompletionTask?: {
|
|
11
13
|
messages: {
|
|
@@ -14,6 +16,8 @@ export interface CreateAgentTaskRequest {
|
|
|
14
16
|
}[];
|
|
15
17
|
jsonSchema: string;
|
|
16
18
|
model: string;
|
|
19
|
+
temperature?: number | null;
|
|
20
|
+
topP?: number | null;
|
|
17
21
|
};
|
|
18
22
|
memoryChatTask?: {
|
|
19
23
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAgentTaskRequest.d.ts","sourceRoot":"","sources":["../../src/types/CreateAgentTaskRequest.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,MAAM,WAAW,sBAAsB;IACnC,2BAA2B,CAAC,EAAE;QAC1B,QAAQ,EAAE;YACN,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;YACrC,OAAO,EAAE,MAAM,CAAA;SAClB,EAAE,CAAA;QACH,KAAK,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"CreateAgentTaskRequest.d.ts","sourceRoot":"","sources":["../../src/types/CreateAgentTaskRequest.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,MAAM,WAAW,sBAAsB;IACnC,2BAA2B,CAAC,EAAE;QAC1B,QAAQ,EAAE;YACN,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;YACrC,OAAO,EAAE,MAAM,CAAA;SAClB,EAAE,CAAA;QACH,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KACvB,CAAA;IACD,4BAA4B,CAAC,EAAE;QAC3B,QAAQ,EAAE;YACN,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;YACrC,OAAO,EAAE,MAAM,CAAA;SAClB,EAAE,CAAA;QACH,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KACvB,CAAA;IACD,cAAc,CAAC,EAAE;QACb,QAAQ,EAAE;YACN,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;YACrC,OAAO,EAAE,MAAM,CAAA;SAClB,EAAE,CAAA;QACH,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,eAAe,EAAE,MAAM,CAAA;KAC1B,CAAA;IACD,gBAAgB,CAAC,EAAE;QACf,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,gBAAgB,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;QACtD,cAAc,CAAC,EAAE;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAA;KAC1C,CAAA;CACJ"}
|
package/lib/utils/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Browser-compatible version utility
|
|
2
2
|
// The version is set at build time and can be overridden if needed
|
|
3
3
|
// Build-time version constant - this should be updated during the build process
|
|
4
|
-
const SDK_VERSION = '0.1.
|
|
4
|
+
const SDK_VERSION = '0.1.170';
|
|
5
5
|
// Allow runtime override if needed
|
|
6
6
|
let versionOverride = null;
|
|
7
7
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fencyai/js",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.170",
|
|
4
|
+
"description": "JavaScript/TypeScript SDK for the Fency AI platform",
|
|
5
5
|
"author": "staklau <steinaageklaussen@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"ts-jest": "^29.1.1",
|
|
45
45
|
"typescript": "^5.3.3"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "0a0ccff2c49aeff24b7ea51afc605568398fd5c6"
|
|
48
48
|
}
|