openloops 0.1.29 → 0.1.30

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.
@@ -1,6 +1,7 @@
1
1
  import { CurrentUser, CurrentSession } from '../common/base/index.js';
2
2
  import { Logger } from '../common/logger/index.js';
3
3
  import { Chat } from '../services/chats/entities/chat.entity.js';
4
+ import { ChatSettingsProps } from '../services/chats/entities/chat-settings.entity.js';
4
5
  import { AgentTask } from '../services/chats/entities/agent-task.entity.js';
5
6
  import { Tool, BaseParams } from '../tools/tool.js';
6
7
  import { SkillRunOptions } from '../skills/skill.js';
@@ -9,6 +10,7 @@ export interface RunContext {
9
10
  identity?: AgentIdentity;
10
11
  task?: AgentTask;
11
12
  chat: Chat;
13
+ chatOptions?: ChatSettingsProps;
12
14
  currentUser: CurrentUser;
13
15
  currentSession?: CurrentSession;
14
16
  currentMessage: string;
@@ -19,7 +21,7 @@ export interface RunContext {
19
21
  limit?: number;
20
22
  }) => ScoredTool[];
21
23
  baseParams: BaseParams;
22
- skillParams: Pick<SkillRunOptions, 'sessionId' | 'answerId' | 'userMessage' | 'currentUser' | 'currentSession' | 'chat'>;
24
+ skillParams: Pick<SkillRunOptions, 'provider' | 'modelName' | 'sessionId' | 'answerId' | 'userMessage' | 'currentUser' | 'currentSession' | 'chat'>;
23
25
  reply: (content: string) => void;
24
26
  setNextNode: (node?: string | AgentLoopNode) => void;
25
27
  logger: Logger;
@@ -2,6 +2,7 @@ import 'reflect-metadata';
2
2
  import { CurrentUser, CurrentSession } from '../common/base/index.js';
3
3
  import { McpServer } from '../services/mcp-servers/entities/index.js';
4
4
  import { Chat } from '../services/chats/entities/chat.entity.js';
5
+ import { ChatSettingsProps } from '../services/chats/entities/chat-settings.entity.js';
5
6
  import { Tool } from '../tools/tool.js';
6
7
  import { AgentLoop } from './agent-loop';
7
8
  export declare const AGENT_ERROR_CODES: {
@@ -22,12 +23,6 @@ interface ChatInput {
22
23
  chatId?: string;
23
24
  messageId?: string;
24
25
  }
25
- interface ChatOptions {
26
- loopName?: string;
27
- modelName?: 'string';
28
- isPrivateSession?: boolean;
29
- notifyOnCompletion?: boolean;
30
- }
31
26
  type HookType = 'pre_execution' | 'post_execution';
32
27
  export declare class Agent {
33
28
  private readonly updateChatUseCase;
@@ -57,7 +52,7 @@ export declare class Agent {
57
52
  get lastAssistantAnswer(): string | undefined;
58
53
  run(props: {
59
54
  input: ChatInput;
60
- options?: ChatOptions;
55
+ options?: ChatSettingsProps;
61
56
  currentUser: CurrentUser;
62
57
  currentSession?: CurrentSession;
63
58
  }): Promise<{
@@ -287,6 +287,7 @@ class Agent {
287
287
  identity: this._identity,
288
288
  task: this.currentChat.activeTask,
289
289
  chat: this.currentChat,
290
+ chatOptions: this.chatOptions,
290
291
  currentUser: this.currentUser,
291
292
  currentSession: this.currentSession,
292
293
  currentMessage: this.currentMessage,
@@ -299,6 +300,8 @@ class Agent {
299
300
  answerId: this.answerId
300
301
  },
301
302
  skillParams: {
303
+ provider: this.chatOptions?.modelProvider,
304
+ modelName: this.chatOptions?.modelName,
302
305
  sessionId,
303
306
  answerId: this.answerId,
304
307
  userMessage: this.currentMessage,
@@ -264,6 +264,7 @@ class Agent {
264
264
  identity: this._identity,
265
265
  task: this.currentChat.activeTask,
266
266
  chat: this.currentChat,
267
+ chatOptions: this.chatOptions,
267
268
  currentUser: this.currentUser,
268
269
  currentSession: this.currentSession,
269
270
  currentMessage: this.currentMessage,
@@ -276,6 +277,8 @@ class Agent {
276
277
  answerId: this.answerId
277
278
  },
278
279
  skillParams: {
280
+ provider: this.chatOptions?.modelProvider,
281
+ modelName: this.chatOptions?.modelName,
279
282
  sessionId,
280
283
  answerId: this.answerId,
281
284
  userMessage: this.currentMessage,
@@ -1,6 +1,7 @@
1
1
  export interface ChatSettingsProps {
2
2
  notifyOnCompletion?: boolean;
3
3
  isPrivateSession?: boolean;
4
+ modelProvider?: string;
4
5
  modelName?: string;
5
6
  loopName?: string;
6
7
  }
@@ -8,12 +9,14 @@ export declare class ChatSettings {
8
9
  private readonly props;
9
10
  notifyOnCompletion?: boolean | undefined;
10
11
  isPrivateSession?: boolean | undefined;
12
+ modelProvider?: string | undefined;
11
13
  modelName?: string | undefined;
12
14
  loopName?: string | undefined;
13
- constructor(props: ChatSettingsProps, notifyOnCompletion?: boolean | undefined, isPrivateSession?: boolean | undefined, modelName?: string | undefined, loopName?: string | undefined);
15
+ constructor(props: ChatSettingsProps, notifyOnCompletion?: boolean | undefined, isPrivateSession?: boolean | undefined, modelProvider?: string | undefined, modelName?: string | undefined, loopName?: string | undefined);
14
16
  static fromJSON(props: ChatSettingsProps): ChatSettings;
15
17
  toJSON(): ChatSettingsProps;
16
18
  setLoopName(loopName: string): void;
19
+ setModelProvider(modelProvider: string): void;
17
20
  setModelName(modelName: string): void;
18
21
  setNotifyOnCompletion(notifyOnCompletion: boolean): void;
19
22
  setIsPrivateSession(isPrivateSession: boolean): void;
@@ -22,16 +22,18 @@ __export(chat_settings_entity_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(chat_settings_entity_exports);
24
24
  class ChatSettings {
25
- constructor(props, notifyOnCompletion, isPrivateSession, modelName, loopName) {
25
+ constructor(props, notifyOnCompletion, isPrivateSession, modelProvider, modelName, loopName) {
26
26
  this.props = props;
27
27
  this.notifyOnCompletion = notifyOnCompletion;
28
28
  this.isPrivateSession = isPrivateSession;
29
+ this.modelProvider = modelProvider;
29
30
  this.modelName = modelName;
30
31
  this.loopName = loopName;
31
32
  }
32
33
  props;
33
34
  notifyOnCompletion;
34
35
  isPrivateSession;
36
+ modelProvider;
35
37
  modelName;
36
38
  loopName;
37
39
  static fromJSON(props) {
@@ -39,6 +41,7 @@ class ChatSettings {
39
41
  props,
40
42
  props.notifyOnCompletion,
41
43
  props.isPrivateSession,
44
+ props.modelProvider,
42
45
  props.modelName,
43
46
  props.loopName
44
47
  );
@@ -47,6 +50,7 @@ class ChatSettings {
47
50
  return {
48
51
  notifyOnCompletion: this.notifyOnCompletion,
49
52
  isPrivateSession: this.isPrivateSession,
53
+ modelProvider: this.modelProvider,
50
54
  modelName: this.modelName,
51
55
  loopName: this.loopName
52
56
  };
@@ -54,6 +58,9 @@ class ChatSettings {
54
58
  setLoopName(loopName) {
55
59
  this.loopName = loopName;
56
60
  }
61
+ setModelProvider(modelProvider) {
62
+ this.modelProvider = modelProvider;
63
+ }
57
64
  setModelName(modelName) {
58
65
  this.modelName = modelName;
59
66
  }
@@ -1,15 +1,17 @@
1
1
  import "../../../chunk-CF3WOMB3.mjs";
2
2
  class ChatSettings {
3
- constructor(props, notifyOnCompletion, isPrivateSession, modelName, loopName) {
3
+ constructor(props, notifyOnCompletion, isPrivateSession, modelProvider, modelName, loopName) {
4
4
  this.props = props;
5
5
  this.notifyOnCompletion = notifyOnCompletion;
6
6
  this.isPrivateSession = isPrivateSession;
7
+ this.modelProvider = modelProvider;
7
8
  this.modelName = modelName;
8
9
  this.loopName = loopName;
9
10
  }
10
11
  props;
11
12
  notifyOnCompletion;
12
13
  isPrivateSession;
14
+ modelProvider;
13
15
  modelName;
14
16
  loopName;
15
17
  static fromJSON(props) {
@@ -17,6 +19,7 @@ class ChatSettings {
17
19
  props,
18
20
  props.notifyOnCompletion,
19
21
  props.isPrivateSession,
22
+ props.modelProvider,
20
23
  props.modelName,
21
24
  props.loopName
22
25
  );
@@ -25,6 +28,7 @@ class ChatSettings {
25
28
  return {
26
29
  notifyOnCompletion: this.notifyOnCompletion,
27
30
  isPrivateSession: this.isPrivateSession,
31
+ modelProvider: this.modelProvider,
28
32
  modelName: this.modelName,
29
33
  loopName: this.loopName
30
34
  };
@@ -32,6 +36,9 @@ class ChatSettings {
32
36
  setLoopName(loopName) {
33
37
  this.loopName = loopName;
34
38
  }
39
+ setModelProvider(modelProvider) {
40
+ this.modelProvider = modelProvider;
41
+ }
35
42
  setModelName(modelName) {
36
43
  this.modelName = modelName;
37
44
  }
@@ -8,6 +8,8 @@ export interface SkillProps {
8
8
  systemInstructions: Record<string, any>;
9
9
  }
10
10
  export interface SkillRunOptions<TInput = Record<string, any>> {
11
+ provider?: string;
12
+ modelName?: string;
11
13
  sessionId: string;
12
14
  answerId: string;
13
15
  userMessage?: string;
@@ -38,7 +38,7 @@ class Skill {
38
38
  this.systemInstructions = props.systemInstructions;
39
39
  }
40
40
  async run(options) {
41
- const { sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
41
+ const { provider, modelName, sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
42
42
  try {
43
43
  const llmClient = import_tsyringe.container.resolve(import_llm_client.LLMClient);
44
44
  const currentCountryCode = currentSession?.location?.country;
@@ -88,6 +88,8 @@ class Skill {
88
88
  }
89
89
  };
90
90
  const response = await llmClient.complete({
91
+ provider,
92
+ modelName,
91
93
  sessionId,
92
94
  answerId,
93
95
  origin: this.name,
@@ -16,7 +16,7 @@ class Skill {
16
16
  this.systemInstructions = props.systemInstructions;
17
17
  }
18
18
  async run(options) {
19
- const { sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
19
+ const { provider, modelName, sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
20
20
  try {
21
21
  const llmClient = container.resolve(LLMClient);
22
22
  const currentCountryCode = currentSession?.location?.country;
@@ -66,6 +66,8 @@ class Skill {
66
66
  }
67
67
  };
68
68
  const response = await llmClient.complete({
69
+ provider,
70
+ modelName,
69
71
  sessionId,
70
72
  answerId,
71
73
  origin: this.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openloops",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "Framework to build AI Agents",
5
5
  "author": {
6
6
  "name": "Jose Barcos",