@amitdeshmukh/ax-crew 1.0.1 → 1.0.4

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,8 +1,8 @@
1
1
  import fs from 'fs';
2
2
  import yaml from 'js-yaml';
3
- import { PROVIDER_API_KEYS } from '../config/index';
4
- import { functions as importedFunctions } from '../functions/index';
5
3
  import { AxAIAnthropic, AxAIOpenAI, AxAIAzureOpenAI, AxAICohere, AxAIDeepSeek, AxAIGoogleGemini, AxAIGroq, AxAIHuggingFace, AxAIMistral, AxAIOllama, AxAITogether } from '@ax-llm/ax';
4
+ import { PROVIDER_API_KEYS } from '../config/index.js';
5
+ import { functions as importedFunctions } from '../functions/index.js';
6
6
  // Define a mapping from provider names to their respective constructors
7
7
  const AIConstructors = {
8
8
  'anthropic': AxAIAnthropic,
@@ -1,7 +1,7 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { getAgentConfigParams } from './agentConfig';
3
2
  import { AxAgent } from '@ax-llm/ax';
4
- import { createState } from '../state/createState';
3
+ import { getAgentConfigParams } from './agentConfig.js';
4
+ import { createState } from '../state/createState.js';
5
5
  // Extend the AxAgent class to include shared state functionality
6
6
  class StatefulAxAgent extends AxAgent {
7
7
  constructor(ai, options, state) {
@@ -18,8 +18,8 @@ class StatefulAxAgent extends AxAgent {
18
18
  */
19
19
  class AxCrew {
20
20
  /**
21
- * Creates an instance of AgentCrew.
22
- * @param {string} configFilePath - The file path to the agent configuration.
21
+ * Creates an instance of AxCrew.
22
+ * @param {string} configFilePath - Path to the agent config file.
23
23
  * @param {string} [crewId=uuidv4()] - The unique identifier for the crew.
24
24
  */
25
25
  constructor(configFilePath, crewId = uuidv4()) {
@@ -71,12 +71,13 @@ class AxCrew {
71
71
  }
72
72
  }
73
73
  /**
74
- * Sets up agents by their names.
75
- * For each name provided, it will add the agent to the crew if it's not already present.
76
- * @param {string[]} agentNames - An array of agent names to set up.
74
+ * Sets up agents in the crew by name.
75
+ * For an array of Agent names provided, it adds
76
+ * the agent to the crew if not already present.
77
+ * @param {string[]} agentNames - An array of agent names to configure.
77
78
  * @returns {Map<string, StatefulAxAgent> | null} A map of agent names to their corresponding instances.
78
79
  */
79
- setupAgents(agentNames) {
80
+ addAgentsToCrew(agentNames) {
80
81
  agentNames.forEach(agentName => {
81
82
  this.addAgent(agentName);
82
83
  });
@@ -90,4 +91,4 @@ class AxCrew {
90
91
  this.state.reset();
91
92
  }
92
93
  }
93
- export default AxCrew;
94
+ export { AxCrew };
@@ -1,4 +1,4 @@
1
- import { CurrentDateTime, DaysBetweenDates } from './dateTime';
1
+ import { CurrentDateTime, DaysBetweenDates } from './dateTime.js';
2
2
  const functions = {
3
3
  CurrentDateTime,
4
4
  DaysBetweenDates
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import AxCrew from './agents/index.js';
1
+ import { AxCrew } from './agents/index.js';
2
2
  export { AxCrew };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@amitdeshmukh/ax-crew",
4
- "version": "1.0.1",
4
+ "version": "1.0.4",
5
5
  "description": "Build and launch a crew of AI agents with shared state. Built with axllm.dev",
6
6
  "main": "dist/index.js",
7
7
  "engines": {
@@ -1,11 +1,12 @@
1
1
  import fs from 'fs';
2
2
  import yaml from 'js-yaml';
3
- import { PROVIDER_API_KEYS } from '../config/index';
4
- import { functions as importedFunctions } from '../functions/index';
5
3
 
6
4
  import { AxAIAnthropic, AxAIOpenAI, AxAIAzureOpenAI, AxAICohere, AxAIDeepSeek, AxAIGoogleGemini, AxAIGroq, AxAIHuggingFace, AxAIMistral, AxAIOllama, AxAITogether } from '@ax-llm/ax';
7
5
  import type { AxAI, AxModelConfig, AxFunction, AxSignature } from '@ax-llm/ax';
8
6
 
7
+ import { PROVIDER_API_KEYS } from '../config/index.js';
8
+ import { functions as importedFunctions } from '../functions/index.js';
9
+
9
10
  // Define a mapping from provider names to their respective constructors
10
11
  const AIConstructors: Record<string, any> = {
11
12
  'anthropic': AxAIAnthropic,
@@ -1,15 +1,10 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { getAgentConfigParams } from './agentConfig';
3
2
  import { AxAgent, AxAI } from '@ax-llm/ax';
4
- import type { AxSignature, AxAgentic, AxFunction, AxAIService } from '@ax-llm/ax';
5
- import { createState, StateInstance } from '../state/createState';
6
-
7
-
8
- // Define interfaces for the agent configurations and return types
9
- interface Agents {
10
- [key: string]: StatefulAxAgent;
11
- }
3
+ import type { AxSignature, AxAgentic, AxFunction } from '@ax-llm/ax';
4
+ import { getAgentConfigParams } from './agentConfig.js';
5
+ import { createState, StateInstance } from '../state/createState.js';
12
6
 
7
+ // Define the interface for the agent configuration
13
8
  interface AgentConfigParams {
14
9
  ai: AxAI;
15
10
  name: string;
@@ -32,7 +27,6 @@ class StatefulAxAgent extends AxAgent<any, any> {
32
27
  }
33
28
  }
34
29
 
35
-
36
30
  /**
37
31
  * Represents a crew of agents with shared state functionality.
38
32
  */
@@ -43,8 +37,8 @@ class AxCrew {
43
37
  state: StateInstance;
44
38
 
45
39
  /**
46
- * Creates an instance of AgentCrew.
47
- * @param {string} configFilePath - The file path to the agent configuration.
40
+ * Creates an instance of AxCrew.
41
+ * @param {string} configFilePath - Path to the agent config file.
48
42
  * @param {string} [crewId=uuidv4()] - The unique identifier for the crew.
49
43
  */
50
44
  constructor(configFilePath: string, crewId: string = uuidv4()) {
@@ -109,12 +103,13 @@ class AxCrew {
109
103
  }
110
104
 
111
105
  /**
112
- * Sets up agents by their names.
113
- * For each name provided, it will add the agent to the crew if it's not already present.
114
- * @param {string[]} agentNames - An array of agent names to set up.
106
+ * Sets up agents in the crew by name.
107
+ * For an array of Agent names provided, it adds
108
+ * the agent to the crew if not already present.
109
+ * @param {string[]} agentNames - An array of agent names to configure.
115
110
  * @returns {Map<string, StatefulAxAgent> | null} A map of agent names to their corresponding instances.
116
111
  */
117
- setupAgents(agentNames: string[]): Map<string, StatefulAxAgent> | null {
112
+ addAgentsToCrew(agentNames: string[]): Map<string, StatefulAxAgent> | null {
118
113
  agentNames.forEach(agentName => {
119
114
  this.addAgent(agentName);
120
115
  });
@@ -130,4 +125,4 @@ class AxCrew {
130
125
  }
131
126
  }
132
127
 
133
- export default AxCrew;
128
+ export { AxCrew };
@@ -1,4 +1,4 @@
1
- import { CurrentDateTime, DaysBetweenDates } from './dateTime';
1
+ import { CurrentDateTime, DaysBetweenDates } from './dateTime.js';
2
2
 
3
3
  const functions = {
4
4
  CurrentDateTime,
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- import AxCrew from './agents/index.js';
1
+ import { AxCrew } from './agents/index.js';
2
2
 
3
3
  export { AxCrew };
package/test.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // Import the AgentCrew class
2
- import AgentCrew from './dist/agents/index.js';
2
+ import AxCrew from './dist/agents/index.js';
3
3
 
4
4
  // Create a new instance of AgentCrew
5
5
  const configFilePath = './agent_config.example.yaml';
6
- const crew = new AgentCrew(configFilePath);
6
+ const crew = new AxCrew(configFilePath);
7
7
 
8
8
  // Add agents by providing their names
9
9
  const agentNames = ['Planner', 'Calculator', 'Manager'];