agent-swarm-kit 1.0.155 → 1.0.157
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/build/index.cjs +146 -1
- package/build/index.mjs +146 -1
- package/package.json +1 -1
- package/types.d.ts +27 -2
package/build/index.cjs
CHANGED
|
@@ -15926,6 +15926,10 @@ var SchemaUtils = /** @class */ (function () {
|
|
|
15926
15926
|
*/
|
|
15927
15927
|
var Schema = new SchemaUtils();
|
|
15928
15928
|
|
|
15929
|
+
/**
|
|
15930
|
+
* @see https://github.com/ollama/ollama/blob/86a622cbdc69e9fd501764ff7565e977fc98f00a/server/model.go#L158
|
|
15931
|
+
*/
|
|
15932
|
+
var TOOL_PROTOCOL_PROMPT = functoolsKit.str.newline("For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:", "<tool_call>", "{\"name\": <function-name>, \"arguments\": <args-json-object>}", "</tool_call>");
|
|
15929
15933
|
var AdapterUtils = /** @class */ (function () {
|
|
15930
15934
|
function AdapterUtils() {
|
|
15931
15935
|
var _this = this;
|
|
@@ -15955,7 +15959,77 @@ var AdapterUtils = /** @class */ (function () {
|
|
|
15955
15959
|
return __generator(this, function (_e) {
|
|
15956
15960
|
switch (_e.label) {
|
|
15957
15961
|
case 0:
|
|
15958
|
-
LoggerAdapter.logClient(clientId, "AdapterUtils
|
|
15962
|
+
LoggerAdapter.logClient(clientId, "AdapterUtils fromOpenAI completion", JSON.stringify(rawMessages));
|
|
15963
|
+
messages = rawMessages.map(function (_a) {
|
|
15964
|
+
var role = _a.role, tool_call_id = _a.tool_call_id, tool_calls = _a.tool_calls, content = _a.content;
|
|
15965
|
+
return ({
|
|
15966
|
+
role: role,
|
|
15967
|
+
tool_call_id: tool_call_id,
|
|
15968
|
+
content: content,
|
|
15969
|
+
tool_calls: tool_calls === null || tool_calls === void 0 ? void 0 : tool_calls.map(function (_a) {
|
|
15970
|
+
var f = _a.function, rest = __rest(_a, ["function"]);
|
|
15971
|
+
return (__assign(__assign({}, rest), { function: {
|
|
15972
|
+
name: f.name,
|
|
15973
|
+
arguments: JSON.stringify(f.arguments),
|
|
15974
|
+
} }));
|
|
15975
|
+
}),
|
|
15976
|
+
});
|
|
15977
|
+
});
|
|
15978
|
+
return [4 /*yield*/, openai.chat.completions.create({
|
|
15979
|
+
model: model,
|
|
15980
|
+
messages: messages,
|
|
15981
|
+
tools: tools,
|
|
15982
|
+
temperature: 0,
|
|
15983
|
+
seed: 0,
|
|
15984
|
+
response_format: response_format,
|
|
15985
|
+
})];
|
|
15986
|
+
case 1:
|
|
15987
|
+
_c = __read.apply(void 0, [(_e.sent()).choices, 1]), _d = _c[0].message, content = _d.content, role = _d.role, tool_calls = _d.tool_calls;
|
|
15988
|
+
return [2 /*return*/, {
|
|
15989
|
+
content: content,
|
|
15990
|
+
mode: mode,
|
|
15991
|
+
agentName: agentName,
|
|
15992
|
+
role: role,
|
|
15993
|
+
tool_calls: tool_calls === null || tool_calls === void 0 ? void 0 : tool_calls.map(function (_a) {
|
|
15994
|
+
var f = _a.function, rest = __rest(_a, ["function"]);
|
|
15995
|
+
return (__assign(__assign({}, rest), { function: {
|
|
15996
|
+
name: f.name,
|
|
15997
|
+
arguments: JSON.parse(f.arguments),
|
|
15998
|
+
} }));
|
|
15999
|
+
}),
|
|
16000
|
+
}];
|
|
16001
|
+
}
|
|
16002
|
+
});
|
|
16003
|
+
}); };
|
|
16004
|
+
};
|
|
16005
|
+
/**
|
|
16006
|
+
* Creates a function to interact with LMStudio's chat completions.
|
|
16007
|
+
*
|
|
16008
|
+
* @param {any} openai - The LMStudio instance.
|
|
16009
|
+
* @param {string} [model="saiga_yandexgpt_8b_gguf"] - The model to use for completions.
|
|
16010
|
+
* @param {Object} [response_format] - The format of the response.
|
|
16011
|
+
* @returns {Function} - A function that takes completion arguments and returns a response from LMStudio.
|
|
16012
|
+
*/
|
|
16013
|
+
this.fromLMStudio = function (openai, model, response_format) {
|
|
16014
|
+
if (model === void 0) { model = "saiga_yandexgpt_8b_gguf"; }
|
|
16015
|
+
/**
|
|
16016
|
+
* Handles the completion request to LMStudio.
|
|
16017
|
+
*
|
|
16018
|
+
* @param {ICompletionArgs} args - The arguments for the completion request.
|
|
16019
|
+
* @param {string} args.agentName - The name of the agent.
|
|
16020
|
+
* @param {Array} args.messages - The messages to send to LMStudio.
|
|
16021
|
+
* @param {string} args.mode - The mode of the completion.
|
|
16022
|
+
* @param {Array} args.tools - The tools to use for the completion.
|
|
16023
|
+
* @param {string} args.clientId - The client ID.
|
|
16024
|
+
* @returns {Promise<Object>} - The response from LMStudio.
|
|
16025
|
+
*/
|
|
16026
|
+
return function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
16027
|
+
var messages, _c, _d, content, role, tool_calls;
|
|
16028
|
+
var agentName = _b.agentName, rawMessages = _b.messages, mode = _b.mode, tools = _b.tools, clientId = _b.clientId;
|
|
16029
|
+
return __generator(this, function (_e) {
|
|
16030
|
+
switch (_e.label) {
|
|
16031
|
+
case 0:
|
|
16032
|
+
LoggerAdapter.logClient(clientId, "AdapterUtils fromLMStudio completion", JSON.stringify(rawMessages));
|
|
15959
16033
|
messages = rawMessages.map(function (_a) {
|
|
15960
16034
|
var role = _a.role, tool_call_id = _a.tool_call_id, tool_calls = _a.tool_calls, content = _a.content;
|
|
15961
16035
|
return ({
|
|
@@ -15975,6 +16049,8 @@ var AdapterUtils = /** @class */ (function () {
|
|
|
15975
16049
|
model: model,
|
|
15976
16050
|
messages: messages,
|
|
15977
16051
|
tools: tools,
|
|
16052
|
+
temperature: 0,
|
|
16053
|
+
seed: 0,
|
|
15978
16054
|
response_format: response_format,
|
|
15979
16055
|
})];
|
|
15980
16056
|
case 1:
|
|
@@ -15996,6 +16072,75 @@ var AdapterUtils = /** @class */ (function () {
|
|
|
15996
16072
|
});
|
|
15997
16073
|
}); };
|
|
15998
16074
|
};
|
|
16075
|
+
/**
|
|
16076
|
+
* Creates a function to interact with Ollama's chat completions.
|
|
16077
|
+
*
|
|
16078
|
+
* @param {any} ollama - The Ollama instance.
|
|
16079
|
+
* @param {string} [model="nemotron-mini:4b"] - The model to use for completions.
|
|
16080
|
+
* @param {string} [tool_call_protocol=TOOL_PROTOCOL_PROMPT] - The protocol for tool calls.
|
|
16081
|
+
* @returns {Function} - A function that takes completion arguments and returns a response from Ollama.
|
|
16082
|
+
*/
|
|
16083
|
+
this.fromOllama = function (ollama, model, tool_call_protocol) {
|
|
16084
|
+
if (model === void 0) { model = "nemotron-mini:4b"; }
|
|
16085
|
+
if (tool_call_protocol === void 0) { tool_call_protocol = TOOL_PROTOCOL_PROMPT; }
|
|
16086
|
+
/**
|
|
16087
|
+
* Handles the completion request to Ollama.
|
|
16088
|
+
*
|
|
16089
|
+
* @param {ICompletionArgs} args - The arguments for the completion request.
|
|
16090
|
+
* @param {string} args.agentName - The name of the agent.
|
|
16091
|
+
* @param {Array} args.messages - The messages to send to Ollama.
|
|
16092
|
+
* @param {string} args.mode - The mode of the completion.
|
|
16093
|
+
* @param {Array} args.tools - The tools to use for the completion.
|
|
16094
|
+
* @param {string} args.clientId - The client ID.
|
|
16095
|
+
* @returns {Promise<Object>} - The response from Ollama.
|
|
16096
|
+
*/
|
|
16097
|
+
return function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
16098
|
+
var messages, response;
|
|
16099
|
+
var _c;
|
|
16100
|
+
var agentName = _b.agentName, rawMessages = _b.messages, mode = _b.mode, tools = _b.tools, clientId = _b.clientId;
|
|
16101
|
+
return __generator(this, function (_d) {
|
|
16102
|
+
switch (_d.label) {
|
|
16103
|
+
case 0:
|
|
16104
|
+
LoggerAdapter.logClient(clientId, "AdapterUtils fromOllama completion", JSON.stringify(rawMessages));
|
|
16105
|
+
messages = __spreadArray([], __read(rawMessages), false);
|
|
16106
|
+
if (tool_call_protocol) {
|
|
16107
|
+
messages.unshift({
|
|
16108
|
+
agentName: agentName,
|
|
16109
|
+
mode: "tool",
|
|
16110
|
+
role: "system",
|
|
16111
|
+
content: tool_call_protocol,
|
|
16112
|
+
});
|
|
16113
|
+
}
|
|
16114
|
+
return [4 /*yield*/, ollama.chat({
|
|
16115
|
+
model: model,
|
|
16116
|
+
keep_alive: "24h",
|
|
16117
|
+
options: {
|
|
16118
|
+
temperature: 0,
|
|
16119
|
+
seed: 0,
|
|
16120
|
+
},
|
|
16121
|
+
messages: messages.map(function (message) {
|
|
16122
|
+
var _a;
|
|
16123
|
+
return ({
|
|
16124
|
+
content: message.content,
|
|
16125
|
+
role: message.role,
|
|
16126
|
+
tool_calls: (_a = message.tool_calls) === null || _a === void 0 ? void 0 : _a.map(function (call) { return ({
|
|
16127
|
+
function: call.function,
|
|
16128
|
+
}); }),
|
|
16129
|
+
});
|
|
16130
|
+
}),
|
|
16131
|
+
tools: tools,
|
|
16132
|
+
})];
|
|
16133
|
+
case 1:
|
|
16134
|
+
response = _d.sent();
|
|
16135
|
+
return [2 /*return*/, __assign(__assign({}, response.message), { tool_calls: (_c = response.message.tool_calls) === null || _c === void 0 ? void 0 : _c.map(function (call) { return ({
|
|
16136
|
+
function: call.function,
|
|
16137
|
+
type: "function",
|
|
16138
|
+
id: functoolsKit.randomString(),
|
|
16139
|
+
}); }), mode: mode, agentName: agentName, role: response.message.role })];
|
|
16140
|
+
}
|
|
16141
|
+
});
|
|
16142
|
+
}); };
|
|
16143
|
+
};
|
|
15999
16144
|
}
|
|
16000
16145
|
return AdapterUtils;
|
|
16001
16146
|
}());
|
package/build/index.mjs
CHANGED
|
@@ -15924,6 +15924,10 @@ var SchemaUtils = /** @class */ (function () {
|
|
|
15924
15924
|
*/
|
|
15925
15925
|
var Schema = new SchemaUtils();
|
|
15926
15926
|
|
|
15927
|
+
/**
|
|
15928
|
+
* @see https://github.com/ollama/ollama/blob/86a622cbdc69e9fd501764ff7565e977fc98f00a/server/model.go#L158
|
|
15929
|
+
*/
|
|
15930
|
+
var TOOL_PROTOCOL_PROMPT = str.newline("For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:", "<tool_call>", "{\"name\": <function-name>, \"arguments\": <args-json-object>}", "</tool_call>");
|
|
15927
15931
|
var AdapterUtils = /** @class */ (function () {
|
|
15928
15932
|
function AdapterUtils() {
|
|
15929
15933
|
var _this = this;
|
|
@@ -15953,7 +15957,77 @@ var AdapterUtils = /** @class */ (function () {
|
|
|
15953
15957
|
return __generator(this, function (_e) {
|
|
15954
15958
|
switch (_e.label) {
|
|
15955
15959
|
case 0:
|
|
15956
|
-
LoggerAdapter.logClient(clientId, "AdapterUtils
|
|
15960
|
+
LoggerAdapter.logClient(clientId, "AdapterUtils fromOpenAI completion", JSON.stringify(rawMessages));
|
|
15961
|
+
messages = rawMessages.map(function (_a) {
|
|
15962
|
+
var role = _a.role, tool_call_id = _a.tool_call_id, tool_calls = _a.tool_calls, content = _a.content;
|
|
15963
|
+
return ({
|
|
15964
|
+
role: role,
|
|
15965
|
+
tool_call_id: tool_call_id,
|
|
15966
|
+
content: content,
|
|
15967
|
+
tool_calls: tool_calls === null || tool_calls === void 0 ? void 0 : tool_calls.map(function (_a) {
|
|
15968
|
+
var f = _a.function, rest = __rest(_a, ["function"]);
|
|
15969
|
+
return (__assign(__assign({}, rest), { function: {
|
|
15970
|
+
name: f.name,
|
|
15971
|
+
arguments: JSON.stringify(f.arguments),
|
|
15972
|
+
} }));
|
|
15973
|
+
}),
|
|
15974
|
+
});
|
|
15975
|
+
});
|
|
15976
|
+
return [4 /*yield*/, openai.chat.completions.create({
|
|
15977
|
+
model: model,
|
|
15978
|
+
messages: messages,
|
|
15979
|
+
tools: tools,
|
|
15980
|
+
temperature: 0,
|
|
15981
|
+
seed: 0,
|
|
15982
|
+
response_format: response_format,
|
|
15983
|
+
})];
|
|
15984
|
+
case 1:
|
|
15985
|
+
_c = __read.apply(void 0, [(_e.sent()).choices, 1]), _d = _c[0].message, content = _d.content, role = _d.role, tool_calls = _d.tool_calls;
|
|
15986
|
+
return [2 /*return*/, {
|
|
15987
|
+
content: content,
|
|
15988
|
+
mode: mode,
|
|
15989
|
+
agentName: agentName,
|
|
15990
|
+
role: role,
|
|
15991
|
+
tool_calls: tool_calls === null || tool_calls === void 0 ? void 0 : tool_calls.map(function (_a) {
|
|
15992
|
+
var f = _a.function, rest = __rest(_a, ["function"]);
|
|
15993
|
+
return (__assign(__assign({}, rest), { function: {
|
|
15994
|
+
name: f.name,
|
|
15995
|
+
arguments: JSON.parse(f.arguments),
|
|
15996
|
+
} }));
|
|
15997
|
+
}),
|
|
15998
|
+
}];
|
|
15999
|
+
}
|
|
16000
|
+
});
|
|
16001
|
+
}); };
|
|
16002
|
+
};
|
|
16003
|
+
/**
|
|
16004
|
+
* Creates a function to interact with LMStudio's chat completions.
|
|
16005
|
+
*
|
|
16006
|
+
* @param {any} openai - The LMStudio instance.
|
|
16007
|
+
* @param {string} [model="saiga_yandexgpt_8b_gguf"] - The model to use for completions.
|
|
16008
|
+
* @param {Object} [response_format] - The format of the response.
|
|
16009
|
+
* @returns {Function} - A function that takes completion arguments and returns a response from LMStudio.
|
|
16010
|
+
*/
|
|
16011
|
+
this.fromLMStudio = function (openai, model, response_format) {
|
|
16012
|
+
if (model === void 0) { model = "saiga_yandexgpt_8b_gguf"; }
|
|
16013
|
+
/**
|
|
16014
|
+
* Handles the completion request to LMStudio.
|
|
16015
|
+
*
|
|
16016
|
+
* @param {ICompletionArgs} args - The arguments for the completion request.
|
|
16017
|
+
* @param {string} args.agentName - The name of the agent.
|
|
16018
|
+
* @param {Array} args.messages - The messages to send to LMStudio.
|
|
16019
|
+
* @param {string} args.mode - The mode of the completion.
|
|
16020
|
+
* @param {Array} args.tools - The tools to use for the completion.
|
|
16021
|
+
* @param {string} args.clientId - The client ID.
|
|
16022
|
+
* @returns {Promise<Object>} - The response from LMStudio.
|
|
16023
|
+
*/
|
|
16024
|
+
return function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
16025
|
+
var messages, _c, _d, content, role, tool_calls;
|
|
16026
|
+
var agentName = _b.agentName, rawMessages = _b.messages, mode = _b.mode, tools = _b.tools, clientId = _b.clientId;
|
|
16027
|
+
return __generator(this, function (_e) {
|
|
16028
|
+
switch (_e.label) {
|
|
16029
|
+
case 0:
|
|
16030
|
+
LoggerAdapter.logClient(clientId, "AdapterUtils fromLMStudio completion", JSON.stringify(rawMessages));
|
|
15957
16031
|
messages = rawMessages.map(function (_a) {
|
|
15958
16032
|
var role = _a.role, tool_call_id = _a.tool_call_id, tool_calls = _a.tool_calls, content = _a.content;
|
|
15959
16033
|
return ({
|
|
@@ -15973,6 +16047,8 @@ var AdapterUtils = /** @class */ (function () {
|
|
|
15973
16047
|
model: model,
|
|
15974
16048
|
messages: messages,
|
|
15975
16049
|
tools: tools,
|
|
16050
|
+
temperature: 0,
|
|
16051
|
+
seed: 0,
|
|
15976
16052
|
response_format: response_format,
|
|
15977
16053
|
})];
|
|
15978
16054
|
case 1:
|
|
@@ -15994,6 +16070,75 @@ var AdapterUtils = /** @class */ (function () {
|
|
|
15994
16070
|
});
|
|
15995
16071
|
}); };
|
|
15996
16072
|
};
|
|
16073
|
+
/**
|
|
16074
|
+
* Creates a function to interact with Ollama's chat completions.
|
|
16075
|
+
*
|
|
16076
|
+
* @param {any} ollama - The Ollama instance.
|
|
16077
|
+
* @param {string} [model="nemotron-mini:4b"] - The model to use for completions.
|
|
16078
|
+
* @param {string} [tool_call_protocol=TOOL_PROTOCOL_PROMPT] - The protocol for tool calls.
|
|
16079
|
+
* @returns {Function} - A function that takes completion arguments and returns a response from Ollama.
|
|
16080
|
+
*/
|
|
16081
|
+
this.fromOllama = function (ollama, model, tool_call_protocol) {
|
|
16082
|
+
if (model === void 0) { model = "nemotron-mini:4b"; }
|
|
16083
|
+
if (tool_call_protocol === void 0) { tool_call_protocol = TOOL_PROTOCOL_PROMPT; }
|
|
16084
|
+
/**
|
|
16085
|
+
* Handles the completion request to Ollama.
|
|
16086
|
+
*
|
|
16087
|
+
* @param {ICompletionArgs} args - The arguments for the completion request.
|
|
16088
|
+
* @param {string} args.agentName - The name of the agent.
|
|
16089
|
+
* @param {Array} args.messages - The messages to send to Ollama.
|
|
16090
|
+
* @param {string} args.mode - The mode of the completion.
|
|
16091
|
+
* @param {Array} args.tools - The tools to use for the completion.
|
|
16092
|
+
* @param {string} args.clientId - The client ID.
|
|
16093
|
+
* @returns {Promise<Object>} - The response from Ollama.
|
|
16094
|
+
*/
|
|
16095
|
+
return function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
16096
|
+
var messages, response;
|
|
16097
|
+
var _c;
|
|
16098
|
+
var agentName = _b.agentName, rawMessages = _b.messages, mode = _b.mode, tools = _b.tools, clientId = _b.clientId;
|
|
16099
|
+
return __generator(this, function (_d) {
|
|
16100
|
+
switch (_d.label) {
|
|
16101
|
+
case 0:
|
|
16102
|
+
LoggerAdapter.logClient(clientId, "AdapterUtils fromOllama completion", JSON.stringify(rawMessages));
|
|
16103
|
+
messages = __spreadArray([], __read(rawMessages), false);
|
|
16104
|
+
if (tool_call_protocol) {
|
|
16105
|
+
messages.unshift({
|
|
16106
|
+
agentName: agentName,
|
|
16107
|
+
mode: "tool",
|
|
16108
|
+
role: "system",
|
|
16109
|
+
content: tool_call_protocol,
|
|
16110
|
+
});
|
|
16111
|
+
}
|
|
16112
|
+
return [4 /*yield*/, ollama.chat({
|
|
16113
|
+
model: model,
|
|
16114
|
+
keep_alive: "24h",
|
|
16115
|
+
options: {
|
|
16116
|
+
temperature: 0,
|
|
16117
|
+
seed: 0,
|
|
16118
|
+
},
|
|
16119
|
+
messages: messages.map(function (message) {
|
|
16120
|
+
var _a;
|
|
16121
|
+
return ({
|
|
16122
|
+
content: message.content,
|
|
16123
|
+
role: message.role,
|
|
16124
|
+
tool_calls: (_a = message.tool_calls) === null || _a === void 0 ? void 0 : _a.map(function (call) { return ({
|
|
16125
|
+
function: call.function,
|
|
16126
|
+
}); }),
|
|
16127
|
+
});
|
|
16128
|
+
}),
|
|
16129
|
+
tools: tools,
|
|
16130
|
+
})];
|
|
16131
|
+
case 1:
|
|
16132
|
+
response = _d.sent();
|
|
16133
|
+
return [2 /*return*/, __assign(__assign({}, response.message), { tool_calls: (_c = response.message.tool_calls) === null || _c === void 0 ? void 0 : _c.map(function (call) { return ({
|
|
16134
|
+
function: call.function,
|
|
16135
|
+
type: "function",
|
|
16136
|
+
id: randomString(),
|
|
16137
|
+
}); }), mode: mode, agentName: agentName, role: response.message.role })];
|
|
16138
|
+
}
|
|
16139
|
+
});
|
|
16140
|
+
}); };
|
|
16141
|
+
};
|
|
15997
16142
|
}
|
|
15998
16143
|
return AdapterUtils;
|
|
15999
16144
|
}());
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as di_scoped from 'di-scoped';
|
|
2
2
|
import * as functools_kit from 'functools-kit';
|
|
3
3
|
import { SortedArray, Subject } from 'functools-kit';
|
|
4
|
-
import { ICompletionArgs as ICompletionArgs$1 } from 'src/interfaces/Completion.interface';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Interface representing the context.
|
|
@@ -5730,13 +5729,39 @@ declare class AdapterUtils {
|
|
|
5730
5729
|
*/
|
|
5731
5730
|
fromOpenAI: (openai: any, model?: string, response_format?: {
|
|
5732
5731
|
type: string;
|
|
5733
|
-
}) => ({ agentName, messages: rawMessages, mode, tools, clientId, }: ICompletionArgs
|
|
5732
|
+
}) => ({ agentName, messages: rawMessages, mode, tools, clientId, }: ICompletionArgs) => Promise<{
|
|
5734
5733
|
content: any;
|
|
5735
5734
|
mode: ExecutionMode;
|
|
5736
5735
|
agentName: string;
|
|
5737
5736
|
role: any;
|
|
5738
5737
|
tool_calls: any;
|
|
5739
5738
|
}>;
|
|
5739
|
+
/**
|
|
5740
|
+
* Creates a function to interact with LMStudio's chat completions.
|
|
5741
|
+
*
|
|
5742
|
+
* @param {any} openai - The LMStudio instance.
|
|
5743
|
+
* @param {string} [model="saiga_yandexgpt_8b_gguf"] - The model to use for completions.
|
|
5744
|
+
* @param {Object} [response_format] - The format of the response.
|
|
5745
|
+
* @returns {Function} - A function that takes completion arguments and returns a response from LMStudio.
|
|
5746
|
+
*/
|
|
5747
|
+
fromLMStudio: (openai: any, model?: string, response_format?: {
|
|
5748
|
+
type: string;
|
|
5749
|
+
}) => ({ agentName, messages: rawMessages, mode, tools, clientId, }: ICompletionArgs) => Promise<{
|
|
5750
|
+
content: any;
|
|
5751
|
+
mode: ExecutionMode;
|
|
5752
|
+
agentName: string;
|
|
5753
|
+
role: any;
|
|
5754
|
+
tool_calls: any;
|
|
5755
|
+
}>;
|
|
5756
|
+
/**
|
|
5757
|
+
* Creates a function to interact with Ollama's chat completions.
|
|
5758
|
+
*
|
|
5759
|
+
* @param {any} ollama - The Ollama instance.
|
|
5760
|
+
* @param {string} [model="nemotron-mini:4b"] - The model to use for completions.
|
|
5761
|
+
* @param {string} [tool_call_protocol=TOOL_PROTOCOL_PROMPT] - The protocol for tool calls.
|
|
5762
|
+
* @returns {Function} - A function that takes completion arguments and returns a response from Ollama.
|
|
5763
|
+
*/
|
|
5764
|
+
fromOllama: (ollama: any, model?: string, tool_call_protocol?: string) => ({ agentName, messages: rawMessages, mode, tools, clientId, }: ICompletionArgs) => Promise<any>;
|
|
5740
5765
|
}
|
|
5741
5766
|
/**
|
|
5742
5767
|
* An instance of AdapterUtils.
|