@smythos/sre 1.5.63 → 1.5.64

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.
@@ -14,6 +14,7 @@ export declare class Conversation extends EventEmitter {
14
14
  assistantName: any;
15
15
  private _reqMethods;
16
16
  private _toolsConfig;
17
+ private _toolStatusMap;
17
18
  private _endpoints;
18
19
  private _baseUrl;
19
20
  private _status;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smythos/sre",
3
- "version": "1.5.63",
3
+ "version": "1.5.64",
4
4
  "description": "Smyth Runtime Environment",
5
5
  "author": "Alaa-eddine KADDOURI",
6
6
  "license": "MIT",
@@ -117,8 +117,8 @@ export class APICall extends Component {
117
117
  // To support both old and new OAuth configuration, we check for both oauth_con_id and oauthService.
118
118
  logger.debug('checking oauth config', config?.data?.oauth_con_id, config?.data?.oauthService);
119
119
  if (
120
- (config?.data?.oauth_con_id !== undefined && config?.data?.oauth_con_id !== '' && config?.data?.oauth_con_id !== 'None') ||
121
- (config?.data?.oauthService !== '' && config.data.oauthService !== 'None')
120
+ (config?.data?.oauth_con_id && config.data.oauth_con_id !== 'None') ||
121
+ (config?.data?.oauthService && config.data.oauthService !== 'None')
122
122
  ) {
123
123
  const additionalParams = extractAdditionalParamsForOAuth1(reqConfig);
124
124
  const oauthHeaders = await generateOAuthHeaders(agent, config, reqConfig, logger, additionalParams);
@@ -52,6 +52,7 @@ export class Conversation extends EventEmitter {
52
52
 
53
53
  private _reqMethods;
54
54
  private _toolsConfig;
55
+ private _toolStatusMap: Record<string, string> = {};
55
56
  private _endpoints;
56
57
  private _baseUrl;
57
58
 
@@ -459,7 +460,9 @@ export class Conversation extends EventEmitter {
459
460
  //await beforeFunctionCall(llmMessage, toolsData[tool.index]);
460
461
  // TODO [Forhad]: Make sure toolsData[tool.index] and tool do the same thing
461
462
  this.emit('beforeToolCall', { tool, args }, llmMessage); //deprecated
462
- this.emit(TLLMEvent.ToolCall, { tool, _llmRequest: llmMessage });
463
+
464
+ const status = tool.name ? this._toolStatusMap?.[tool.name] : undefined;
465
+ this.emit(TLLMEvent.ToolCall, { tool, status, _llmRequest: llmMessage });
463
466
 
464
467
  const toolArgs = {
465
468
  type: tool?.type,
@@ -981,6 +984,16 @@ export class Conversation extends EventEmitter {
981
984
  this.systemPrompt = `Assistant Name : ${this.assistantName}\n\n${this.systemPrompt}`;
982
985
  }
983
986
 
987
+ this._toolStatusMap = agentData?.data?.components
988
+ ?.filter((component) => component.name === 'APIEndpoint')
989
+ .reduce((map, component) => {
990
+ if (component?.data?.endpoint) {
991
+ map[component.data.endpoint] =
992
+ component?.data?.status_message || `Calling ${component?.data?.endpointLabel || component.data.endpoint}`;
993
+ }
994
+ return map;
995
+ }, {});
996
+
984
997
  const spec = await agentDataConnector.getOpenAPIJSON(agentData, 'http://localhost/', this._agentVersion, true).catch((error) => null);
985
998
  return this.patchSpec(spec);
986
999
  }