agent-swarm-kit 1.0.228 → 1.0.230
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/README.md +25 -0
- package/build/index.cjs +34 -13
- package/build/index.mjs +34 -13
- package/package.json +2 -1
- package/types.d.ts +2 -2
package/README.md
CHANGED
|
@@ -346,6 +346,31 @@ See the **[Test Cases](https://github.com/tripolskypetr/agent-swarm-kit/blob/mas
|
|
|
346
346
|
|
|
347
347
|
---
|
|
348
348
|
|
|
349
|
+
## 🌍 Ecosystem
|
|
350
|
+
|
|
351
|
+
The `agent-swarm-kit` ecosystem extends beyond the core library, offering complementary tools to enhance your multi-agent AI development experience. One such tool is:
|
|
352
|
+
|
|
353
|
+
### Agent Tune Dataset Constructor
|
|
354
|
+
|
|
355
|
+
> **[Explore Agent Tune](https://agent-tune.github.io)**
|
|
356
|
+
|
|
357
|
+
The **Agent Tune Dataset Constructor** is a React-based tool designed for crafting fine-tuning datasets tailored for AI models, published on GitHub Pages at [agent-tune.github.io](https://agent-tune.github.io). It provides a dynamic, user-friendly interface with list and grid layouts, enabling you to define user inputs, preferred and non-preferred outputs, and multi-turn chat histories—complete with tool definitions and calls. Built with the `react-declarative` library and styled using Material-UI, it’s optimized for creating JSONL files compatible with OpenAI’s fine-tuning API.
|
|
358
|
+
|
|
359
|
+
#### Key Features
|
|
360
|
+
- **Dynamic Forms**: Build dataset entries with configurable user inputs, outputs, and tools (up to five per entry), featuring autocomplete for tool names and enum values.
|
|
361
|
+
- **Chat History**: Include conversational context with tool calls, supporting up to five messages per entry.
|
|
362
|
+
- **Data Management**: Import/export datasets as JSONL files (`SFT` and `DPO` both), with automatic `tool_call_id` generation, and persist changes to local storage.
|
|
363
|
+
- **Validation**: Ensures tool consistency, message order, and data integrity.
|
|
364
|
+
- **Ease of Use**: Navigate with breadcrumbs, save drafts, and export directly for fine-tuning with commands like `openai api fine_tunes.create`.
|
|
365
|
+
|
|
366
|
+
#### Use Case
|
|
367
|
+
Perfect for preparing training data to fine-tune agents within `agent-swarm-kit`, Agent Tune lets you define precise behaviors—like how a sales agent responds or a triage agent routes requests—before integrating them into your swarm. Export your dataset and fine-tune your models to enhance performance across your agent network.
|
|
368
|
+
|
|
369
|
+
#### Get Started
|
|
370
|
+
Visit [agent-tune.github.io](https://agent-tune.github.io) to try it out, or clone the repository to customize it further. Combine it with `agent-swarm-kit` for a seamless workflow from dataset creation to agent deployment.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
349
374
|
## 🤝 Contribute
|
|
350
375
|
|
|
351
376
|
We’d love your input! Fork the repo, submit a PR, or open an issue on **[GitHub](https://github.com/tripolskypetr/agent-swarm-kit)**.
|
package/build/index.cjs
CHANGED
|
@@ -8757,16 +8757,34 @@ const CREATE_EMBEDDING_FN = async (item, self) => {
|
|
|
8757
8757
|
id: item.id,
|
|
8758
8758
|
});
|
|
8759
8759
|
const index = await self.params.createIndex(item);
|
|
8760
|
-
const
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
embeddings = await self.params.
|
|
8764
|
-
|
|
8760
|
+
const result = [];
|
|
8761
|
+
if (typeof index === "string") {
|
|
8762
|
+
const hash = createSHA256Hash(index);
|
|
8763
|
+
let embeddings = await self.params.readEmbeddingCache(self.params.embedding, hash);
|
|
8764
|
+
if (!embeddings) {
|
|
8765
|
+
embeddings = await self.params.createEmbedding(index, self.params.embedding);
|
|
8766
|
+
await self.params.writeEmbeddingCache(embeddings, self.params.embedding, hash);
|
|
8767
|
+
}
|
|
8768
|
+
if (self.params.onCreate) {
|
|
8769
|
+
self.params.onCreate(index, embeddings, self.params.clientId, self.params.embedding);
|
|
8770
|
+
}
|
|
8771
|
+
result.push([embeddings, index]);
|
|
8765
8772
|
}
|
|
8766
|
-
|
|
8767
|
-
|
|
8773
|
+
else {
|
|
8774
|
+
for (const value of Object.values(index)) {
|
|
8775
|
+
const hash = createSHA256Hash(value);
|
|
8776
|
+
let embeddings = await self.params.readEmbeddingCache(self.params.embedding, hash);
|
|
8777
|
+
if (!embeddings) {
|
|
8778
|
+
embeddings = await self.params.createEmbedding(value, self.params.embedding);
|
|
8779
|
+
await self.params.writeEmbeddingCache(embeddings, self.params.embedding, hash);
|
|
8780
|
+
}
|
|
8781
|
+
if (self.params.onCreate) {
|
|
8782
|
+
self.params.onCreate(value, embeddings, self.params.clientId, self.params.embedding);
|
|
8783
|
+
}
|
|
8784
|
+
result.push([embeddings, value]);
|
|
8785
|
+
}
|
|
8768
8786
|
}
|
|
8769
|
-
return
|
|
8787
|
+
return result;
|
|
8770
8788
|
};
|
|
8771
8789
|
/**
|
|
8772
8790
|
* Waits for the ClientStorage instance to initialize by loading initial data and creating embeddings.
|
|
@@ -8992,12 +9010,15 @@ class ClientStorage {
|
|
|
8992
9010
|
this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
|
|
8993
9011
|
}
|
|
8994
9012
|
await Promise.all(Array.from(this._itemMap.values()).map(functoolsKit.execpool(async (item) => {
|
|
8995
|
-
|
|
8996
|
-
const
|
|
8997
|
-
|
|
8998
|
-
this.params.onCompare
|
|
9013
|
+
let maxScore = Number.NEGATIVE_INFINITY;
|
|
9014
|
+
for (const [targetEmbeddings, index] of await this._createEmbedding(item)) {
|
|
9015
|
+
const score = await this.params.calculateSimilarity(searchEmbeddings, targetEmbeddings);
|
|
9016
|
+
if (this.params.onCompare) {
|
|
9017
|
+
this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
|
|
9018
|
+
}
|
|
9019
|
+
maxScore = Math.max(score, maxScore);
|
|
8999
9020
|
}
|
|
9000
|
-
indexed.push(item,
|
|
9021
|
+
indexed.push(item, maxScore);
|
|
9001
9022
|
}, {
|
|
9002
9023
|
delay: 10,
|
|
9003
9024
|
maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
|
package/build/index.mjs
CHANGED
|
@@ -8755,16 +8755,34 @@ const CREATE_EMBEDDING_FN = async (item, self) => {
|
|
|
8755
8755
|
id: item.id,
|
|
8756
8756
|
});
|
|
8757
8757
|
const index = await self.params.createIndex(item);
|
|
8758
|
-
const
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
embeddings = await self.params.
|
|
8762
|
-
|
|
8758
|
+
const result = [];
|
|
8759
|
+
if (typeof index === "string") {
|
|
8760
|
+
const hash = createSHA256Hash(index);
|
|
8761
|
+
let embeddings = await self.params.readEmbeddingCache(self.params.embedding, hash);
|
|
8762
|
+
if (!embeddings) {
|
|
8763
|
+
embeddings = await self.params.createEmbedding(index, self.params.embedding);
|
|
8764
|
+
await self.params.writeEmbeddingCache(embeddings, self.params.embedding, hash);
|
|
8765
|
+
}
|
|
8766
|
+
if (self.params.onCreate) {
|
|
8767
|
+
self.params.onCreate(index, embeddings, self.params.clientId, self.params.embedding);
|
|
8768
|
+
}
|
|
8769
|
+
result.push([embeddings, index]);
|
|
8763
8770
|
}
|
|
8764
|
-
|
|
8765
|
-
|
|
8771
|
+
else {
|
|
8772
|
+
for (const value of Object.values(index)) {
|
|
8773
|
+
const hash = createSHA256Hash(value);
|
|
8774
|
+
let embeddings = await self.params.readEmbeddingCache(self.params.embedding, hash);
|
|
8775
|
+
if (!embeddings) {
|
|
8776
|
+
embeddings = await self.params.createEmbedding(value, self.params.embedding);
|
|
8777
|
+
await self.params.writeEmbeddingCache(embeddings, self.params.embedding, hash);
|
|
8778
|
+
}
|
|
8779
|
+
if (self.params.onCreate) {
|
|
8780
|
+
self.params.onCreate(value, embeddings, self.params.clientId, self.params.embedding);
|
|
8781
|
+
}
|
|
8782
|
+
result.push([embeddings, value]);
|
|
8783
|
+
}
|
|
8766
8784
|
}
|
|
8767
|
-
return
|
|
8785
|
+
return result;
|
|
8768
8786
|
};
|
|
8769
8787
|
/**
|
|
8770
8788
|
* Waits for the ClientStorage instance to initialize by loading initial data and creating embeddings.
|
|
@@ -8990,12 +9008,15 @@ class ClientStorage {
|
|
|
8990
9008
|
this.params.onCreate(search, searchEmbeddings, this.params.clientId, this.params.embedding);
|
|
8991
9009
|
}
|
|
8992
9010
|
await Promise.all(Array.from(this._itemMap.values()).map(execpool(async (item) => {
|
|
8993
|
-
|
|
8994
|
-
const
|
|
8995
|
-
|
|
8996
|
-
this.params.onCompare
|
|
9011
|
+
let maxScore = Number.NEGATIVE_INFINITY;
|
|
9012
|
+
for (const [targetEmbeddings, index] of await this._createEmbedding(item)) {
|
|
9013
|
+
const score = await this.params.calculateSimilarity(searchEmbeddings, targetEmbeddings);
|
|
9014
|
+
if (this.params.onCompare) {
|
|
9015
|
+
this.params.onCompare(search, index, score, this.params.clientId, this.params.embedding);
|
|
9016
|
+
}
|
|
9017
|
+
maxScore = Math.max(score, maxScore);
|
|
8997
9018
|
}
|
|
8998
|
-
indexed.push(item,
|
|
9019
|
+
indexed.push(item, maxScore);
|
|
8999
9020
|
}, {
|
|
9000
9021
|
delay: 10,
|
|
9001
9022
|
maxExec: GLOBAL_CONFIG.CC_STORAGE_SEARCH_POOL,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-swarm-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.230",
|
|
4
4
|
"description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Petr Tripolsky",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
73
73
|
"tslib": "2.7.0",
|
|
74
74
|
"typedoc": "0.27.9",
|
|
75
|
+
"undici": "6.21.2",
|
|
75
76
|
"worker-testbed": "1.0.10"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
package/types.d.ts
CHANGED
|
@@ -220,7 +220,7 @@ interface IStorageSchema<T extends IStorageData = IStorageData> {
|
|
|
220
220
|
* @param {T} item - The storage item to index.
|
|
221
221
|
* @returns {Promise<string> | string} The index string for the item, synchronously or asynchronously.
|
|
222
222
|
*/
|
|
223
|
-
createIndex(item: T): Promise<string> | string
|
|
223
|
+
createIndex(item: T): Promise<string> | string | Record<string, string> | Promise<Record<string, string>>;
|
|
224
224
|
/** The name of the embedding mechanism used for indexing and searching storage data. */
|
|
225
225
|
embedding: EmbeddingName;
|
|
226
226
|
/** The unique name of the storage within the swarm. */
|
|
@@ -6006,7 +6006,7 @@ declare class ClientStorage<T extends IStorageData = IStorageData> implements IS
|
|
|
6006
6006
|
* @returns {Promise<readonly [Embeddings, string]>} A tuple of embeddings (from Embedding.interface) and index string.
|
|
6007
6007
|
* @private
|
|
6008
6008
|
*/
|
|
6009
|
-
_createEmbedding: ((item: T) => Promise<readonly [Embeddings, string]>) & functools_kit.IClearableMemoize<string | number> & functools_kit.IControlMemoize<string | number, Promise<readonly [Embeddings, string]>>;
|
|
6009
|
+
_createEmbedding: ((item: T) => Promise<readonly [Embeddings, string][]>) & functools_kit.IClearableMemoize<string | number> & functools_kit.IControlMemoize<string | number, Promise<readonly [Embeddings, string][]>>;
|
|
6010
6010
|
/**
|
|
6011
6011
|
* Waits for the initialization of the storage, loading initial data and creating embeddings via WAIT_FOR_INIT_FN.
|
|
6012
6012
|
* Ensures initialization happens only once using singleshot, supporting StorageConnectionService’s lifecycle.
|