@docbrasil/api-systemmanager 1.1.81 → 1.1.82
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/api/ai/sessions.js +92 -2
- package/dist/bundle.cjs +92 -2
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +68 -0
- package/docs/AISession.html +730 -0
- package/docs/ai_sessions.js.html +92 -2
- package/package.json +1 -1
package/docs/ai_sessions.js.html
CHANGED
|
@@ -166,7 +166,7 @@ class AISession {
|
|
|
166
166
|
Joi.assert(params.documentId, Joi.string().required().error(new Error('documentId is required')));
|
|
167
167
|
|
|
168
168
|
const apiCall = self._client
|
|
169
|
-
.get(`/
|
|
169
|
+
.get(`/agents/session/document/${params.documentId}`, self._setHeader(authorization));
|
|
170
170
|
|
|
171
171
|
return self._returnData(await apiCall);
|
|
172
172
|
} catch (ex) {
|
|
@@ -228,7 +228,97 @@ class AISession {
|
|
|
228
228
|
const { documentId, ...payload } = params;
|
|
229
229
|
|
|
230
230
|
const apiCall = self._client
|
|
231
|
-
.patch(`/
|
|
231
|
+
.patch(`/agents/session/document/${documentId}`, payload, self._setHeader(authorization));
|
|
232
|
+
|
|
233
|
+
return self._returnData(await apiCall);
|
|
234
|
+
} catch (ex) {
|
|
235
|
+
throw ex;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
241
|
+
* @description Create a new agent session.
|
|
242
|
+
* Use this to create a session with full metadata before triggering execution.
|
|
243
|
+
* @param {object} params Parameters
|
|
244
|
+
* @param {string} params.agentType The agent type (e.g., 'doc-rlm-ingest')
|
|
245
|
+
* @param {object} [params.config] Agent configuration options
|
|
246
|
+
* @param {object} [params.metadata] Session metadata (documentId, pipelineVariant, analysisMode, etc.)
|
|
247
|
+
* @param {string} authorization Authorization token
|
|
248
|
+
* @return {Promise<object>} data The created session
|
|
249
|
+
* @return {string} data.sessionId The session ID
|
|
250
|
+
* @return {string} data.status The session status
|
|
251
|
+
* @public
|
|
252
|
+
* @async
|
|
253
|
+
* @example
|
|
254
|
+
*
|
|
255
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
256
|
+
* const api = new API();
|
|
257
|
+
* const authorization = '...';
|
|
258
|
+
* const params = {
|
|
259
|
+
* agentType: 'doc-rlm-ingest',
|
|
260
|
+
* metadata: {
|
|
261
|
+
* documentId: 'doc-123',
|
|
262
|
+
* documentName: 'Patient Report.pdf',
|
|
263
|
+
* pipelineVariant: 'A',
|
|
264
|
+
* analysisMode: 'full'
|
|
265
|
+
* }
|
|
266
|
+
* };
|
|
267
|
+
* const retData = await api.ai.sessions.create(params, authorization);
|
|
268
|
+
*/
|
|
269
|
+
async create(params, authorization) {
|
|
270
|
+
const self = this;
|
|
271
|
+
|
|
272
|
+
try {
|
|
273
|
+
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
274
|
+
Joi.assert(params.agentType, Joi.string().required().error(new Error('agentType is required')));
|
|
275
|
+
|
|
276
|
+
const apiCall = self._client
|
|
277
|
+
.post('/agents/create', params, self._setHeader(authorization));
|
|
278
|
+
|
|
279
|
+
return self._returnData(await apiCall);
|
|
280
|
+
} catch (ex) {
|
|
281
|
+
throw ex;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @author Myndware <augusto.pissarra@myndware.com>
|
|
287
|
+
* @description Start execution on an existing agent session.
|
|
288
|
+
* @param {object} params Parameters
|
|
289
|
+
* @param {string} params.sessionId The session ID to execute
|
|
290
|
+
* @param {object} [params.input] Execution input (documentId, options, etc.)
|
|
291
|
+
* @param {string} authorization Authorization token
|
|
292
|
+
* @return {Promise<object>} data The execution data
|
|
293
|
+
* @return {string} data.executionId The execution ID
|
|
294
|
+
* @return {string} data.status The execution status
|
|
295
|
+
* @public
|
|
296
|
+
* @async
|
|
297
|
+
* @example
|
|
298
|
+
*
|
|
299
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
300
|
+
* const api = new API();
|
|
301
|
+
* const authorization = '...';
|
|
302
|
+
* const params = {
|
|
303
|
+
* sessionId: 'session-abc-123',
|
|
304
|
+
* input: {
|
|
305
|
+
* documentId: 'doc-123',
|
|
306
|
+
* options: { pipelineVariant: 'A', analysisMode: 'full' }
|
|
307
|
+
* }
|
|
308
|
+
* };
|
|
309
|
+
* const retData = await api.ai.sessions.execute(params, authorization);
|
|
310
|
+
*/
|
|
311
|
+
async execute(params, authorization) {
|
|
312
|
+
const self = this;
|
|
313
|
+
|
|
314
|
+
try {
|
|
315
|
+
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
316
|
+
Joi.assert(params.sessionId, Joi.string().required().error(new Error('sessionId is required')));
|
|
317
|
+
|
|
318
|
+
const { sessionId, ...payload } = params;
|
|
319
|
+
|
|
320
|
+
const apiCall = self._client
|
|
321
|
+
.post(`/agents/${sessionId}/execute`, payload, self._setHeader(authorization));
|
|
232
322
|
|
|
233
323
|
return self._returnData(await apiCall);
|
|
234
324
|
} catch (ex) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docbrasil/api-systemmanager",
|
|
3
3
|
"description": "Module API System Manager",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.82",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
|
|
7
7
|
"doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",
|