@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.
- package/dist/agents/agentConfig.js +2 -2
- package/dist/agents/index.js +10 -9
- package/dist/functions/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/agents/agentConfig.ts +3 -2
- package/src/agents/index.ts +12 -17
- package/src/functions/index.ts +1 -1
- package/src/index.ts +1 -1
- package/test.js +2 -2
|
@@ -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,
|
package/dist/agents/index.js
CHANGED
|
@@ -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 {
|
|
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
|
|
22
|
-
* @param {string} configFilePath -
|
|
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
|
|
75
|
-
* For
|
|
76
|
-
*
|
|
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
|
-
|
|
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
|
|
94
|
+
export { AxCrew };
|
package/dist/functions/index.js
CHANGED
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,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,
|
package/src/agents/index.ts
CHANGED
|
@@ -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
|
|
5
|
-
import {
|
|
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
|
|
47
|
-
* @param {string} configFilePath -
|
|
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
|
|
113
|
-
* For
|
|
114
|
-
*
|
|
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
|
-
|
|
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
|
|
128
|
+
export { AxCrew };
|
package/src/functions/index.ts
CHANGED
package/src/index.ts
CHANGED
package/test.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Import the AgentCrew class
|
|
2
|
-
import
|
|
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
|
|
6
|
+
const crew = new AxCrew(configFilePath);
|
|
7
7
|
|
|
8
8
|
// Add agents by providing their names
|
|
9
9
|
const agentNames = ['Planner', 'Calculator', 'Manager'];
|