supercompat 2.12.0 → 2.14.0
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/index.cjs +785 -233
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +561 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -395,6 +395,9 @@ __export(src_exports, {
|
|
|
395
395
|
mistralClientAdapter: function() {
|
|
396
396
|
return mistralClientAdapter;
|
|
397
397
|
},
|
|
398
|
+
ollamaClientAdapter: function() {
|
|
399
|
+
return ollamaClientAdapter;
|
|
400
|
+
},
|
|
398
401
|
openaiClientAdapter: function() {
|
|
399
402
|
return openaiClientAdapter;
|
|
400
403
|
},
|
|
@@ -406,6 +409,9 @@ __export(src_exports, {
|
|
|
406
409
|
},
|
|
407
410
|
supercompat: function() {
|
|
408
411
|
return supercompat;
|
|
412
|
+
},
|
|
413
|
+
togetherClientAdapter: function() {
|
|
414
|
+
return togetherClientAdapter;
|
|
409
415
|
}
|
|
410
416
|
});
|
|
411
417
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -1733,9 +1739,730 @@ var get5 = function(param) {
|
|
|
1733
1739
|
})
|
|
1734
1740
|
];
|
|
1735
1741
|
}
|
|
1736
|
-
return [
|
|
1737
|
-
2
|
|
1738
|
-
];
|
|
1742
|
+
return [
|
|
1743
|
+
2
|
|
1744
|
+
];
|
|
1745
|
+
});
|
|
1746
|
+
});
|
|
1747
|
+
return function(_url, _options) {
|
|
1748
|
+
return _ref.apply(this, arguments);
|
|
1749
|
+
};
|
|
1750
|
+
}();
|
|
1751
|
+
};
|
|
1752
|
+
// src/adapters/client/anthropicClientAdapter/models/index.ts
|
|
1753
|
+
var models7 = function(param) {
|
|
1754
|
+
var anthropic = param.anthropic;
|
|
1755
|
+
return {
|
|
1756
|
+
get: get5({
|
|
1757
|
+
anthropic: anthropic
|
|
1758
|
+
})
|
|
1759
|
+
};
|
|
1760
|
+
};
|
|
1761
|
+
// src/adapters/client/anthropicClientAdapter/completions/post.ts
|
|
1762
|
+
var import_radash3 = require("radash");
|
|
1763
|
+
// src/lib/messages/nonEmptyMessages.ts
|
|
1764
|
+
var import_radash2 = require("radash");
|
|
1765
|
+
var nonEmptyMessages = function(param) {
|
|
1766
|
+
var messages3 = param.messages;
|
|
1767
|
+
var result = [];
|
|
1768
|
+
messages3.forEach(function(message) {
|
|
1769
|
+
return result.push(_object_spread_props(_object_spread({}, message), {
|
|
1770
|
+
content: (0, import_radash2.isEmpty)(message.content) ? "-" : message.content
|
|
1771
|
+
}));
|
|
1772
|
+
});
|
|
1773
|
+
return result;
|
|
1774
|
+
};
|
|
1775
|
+
// src/lib/messages/firstUserMessages.ts
|
|
1776
|
+
var firstUserMessages = function(param) {
|
|
1777
|
+
var messages3 = param.messages;
|
|
1778
|
+
var firstMessage = messages3[0];
|
|
1779
|
+
if (!firstMessage) return messages3;
|
|
1780
|
+
if (firstMessage.role !== "user") {
|
|
1781
|
+
return [
|
|
1782
|
+
{
|
|
1783
|
+
role: "user",
|
|
1784
|
+
content: "-"
|
|
1785
|
+
}
|
|
1786
|
+
].concat(_to_consumable_array(messages3));
|
|
1787
|
+
}
|
|
1788
|
+
return messages3;
|
|
1789
|
+
};
|
|
1790
|
+
// src/adapters/client/anthropicClientAdapter/completions/serializeTools.ts
|
|
1791
|
+
var serializeTools = function(param) {
|
|
1792
|
+
var tools = param.tools;
|
|
1793
|
+
return (tools !== null && tools !== void 0 ? tools : []).map(function(tool) {
|
|
1794
|
+
if (tool.type === "function") {
|
|
1795
|
+
var _tool_function_parameters;
|
|
1796
|
+
return {
|
|
1797
|
+
name: tool.function.name,
|
|
1798
|
+
description: tool.function.description,
|
|
1799
|
+
input_schema: (_tool_function_parameters = tool.function.parameters) !== null && _tool_function_parameters !== void 0 ? _tool_function_parameters : {
|
|
1800
|
+
type: "object"
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
return tool;
|
|
1805
|
+
});
|
|
1806
|
+
};
|
|
1807
|
+
// src/adapters/client/anthropicClientAdapter/completions/serializeMessages/serializeMessage.ts
|
|
1808
|
+
var serializeMessage2 = function(param) {
|
|
1809
|
+
var message = param.message;
|
|
1810
|
+
if (message.role === "user") {
|
|
1811
|
+
return {
|
|
1812
|
+
role: "user",
|
|
1813
|
+
content: message.content
|
|
1814
|
+
};
|
|
1815
|
+
} else if (message.role === "assistant") {
|
|
1816
|
+
var _message_tool_calls;
|
|
1817
|
+
return {
|
|
1818
|
+
role: "assistant",
|
|
1819
|
+
content: [
|
|
1820
|
+
{
|
|
1821
|
+
type: "text",
|
|
1822
|
+
text: message.content
|
|
1823
|
+
}
|
|
1824
|
+
].concat(_to_consumable_array(((_message_tool_calls = message.tool_calls) !== null && _message_tool_calls !== void 0 ? _message_tool_calls : []).map(function(toolCall) {
|
|
1825
|
+
return {
|
|
1826
|
+
type: "tool_use",
|
|
1827
|
+
id: toolCall.id,
|
|
1828
|
+
name: toolCall.function.name,
|
|
1829
|
+
input: toolCall.function.arguments ? JSON.parse(toolCall.function.arguments) : {}
|
|
1830
|
+
};
|
|
1831
|
+
})))
|
|
1832
|
+
};
|
|
1833
|
+
} else if (message.role === "tool") {
|
|
1834
|
+
return {
|
|
1835
|
+
role: "user",
|
|
1836
|
+
content: [
|
|
1837
|
+
{
|
|
1838
|
+
type: "tool_result",
|
|
1839
|
+
tool_use_id: message.tool_call_id,
|
|
1840
|
+
content: message.content
|
|
1841
|
+
}
|
|
1842
|
+
]
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
};
|
|
1846
|
+
// src/adapters/client/anthropicClientAdapter/completions/serializeMessages/index.ts
|
|
1847
|
+
var serializeMessages = function(param) {
|
|
1848
|
+
var messages3 = param.messages;
|
|
1849
|
+
return messages3.map(function(message) {
|
|
1850
|
+
return serializeMessage2({
|
|
1851
|
+
message: message
|
|
1852
|
+
});
|
|
1853
|
+
});
|
|
1854
|
+
};
|
|
1855
|
+
// src/adapters/client/anthropicClientAdapter/completions/post.ts
|
|
1856
|
+
var post5 = function(param) {
|
|
1857
|
+
var anthropic = param.anthropic;
|
|
1858
|
+
return /*#__PURE__*/ function() {
|
|
1859
|
+
var _ref = _async_to_generator(function(_url, options) {
|
|
1860
|
+
var body, messages3, _ref, systemMessages, otherMessages, system, chatMessages, resultOptions, response, stream, data, error;
|
|
1861
|
+
return _ts_generator(this, function(_state) {
|
|
1862
|
+
switch(_state.label){
|
|
1863
|
+
case 0:
|
|
1864
|
+
body = JSON.parse(options.body);
|
|
1865
|
+
messages3 = body.messages;
|
|
1866
|
+
_ref = _sliced_to_array((0, import_radash3.fork)(messages3, function(message) {
|
|
1867
|
+
return message.role === "system";
|
|
1868
|
+
}), 2), systemMessages = _ref[0], otherMessages = _ref[1];
|
|
1869
|
+
system = systemMessages.map(function(message) {
|
|
1870
|
+
return message.content;
|
|
1871
|
+
}).join("\n");
|
|
1872
|
+
chatMessages = nonEmptyMessages({
|
|
1873
|
+
messages: firstUserMessages({
|
|
1874
|
+
messages: alternatingMessages({
|
|
1875
|
+
messages: otherMessages
|
|
1876
|
+
})
|
|
1877
|
+
})
|
|
1878
|
+
});
|
|
1879
|
+
resultOptions = _object_spread_props(_object_spread({}, (0, import_radash3.omit)(body, [
|
|
1880
|
+
"response_format"
|
|
1881
|
+
])), {
|
|
1882
|
+
stream: body.stream ? (0, import_radash3.isEmpty)(body.tools) : false,
|
|
1883
|
+
system: system,
|
|
1884
|
+
messages: serializeMessages({
|
|
1885
|
+
messages: chatMessages
|
|
1886
|
+
}),
|
|
1887
|
+
max_tokens: 4096,
|
|
1888
|
+
tools: serializeTools({
|
|
1889
|
+
tools: body.tools
|
|
1890
|
+
})
|
|
1891
|
+
});
|
|
1892
|
+
if (!body.stream) return [
|
|
1893
|
+
3,
|
|
1894
|
+
2
|
|
1895
|
+
];
|
|
1896
|
+
return [
|
|
1897
|
+
4,
|
|
1898
|
+
anthropic.messages.stream(resultOptions)
|
|
1899
|
+
];
|
|
1900
|
+
case 1:
|
|
1901
|
+
response = _state.sent();
|
|
1902
|
+
stream = new ReadableStream({
|
|
1903
|
+
start: function start(controller) {
|
|
1904
|
+
return _async_to_generator(function() {
|
|
1905
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, delta, messageDelta, delta1, messageDelta1, messageDelta2, err;
|
|
1906
|
+
return _ts_generator(this, function(_state) {
|
|
1907
|
+
switch(_state.label){
|
|
1908
|
+
case 0:
|
|
1909
|
+
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
1910
|
+
_state.label = 1;
|
|
1911
|
+
case 1:
|
|
1912
|
+
_state.trys.push([
|
|
1913
|
+
1,
|
|
1914
|
+
6,
|
|
1915
|
+
7,
|
|
1916
|
+
12
|
|
1917
|
+
]);
|
|
1918
|
+
_iterator = _async_iterator(response);
|
|
1919
|
+
_state.label = 2;
|
|
1920
|
+
case 2:
|
|
1921
|
+
return [
|
|
1922
|
+
4,
|
|
1923
|
+
_iterator.next()
|
|
1924
|
+
];
|
|
1925
|
+
case 3:
|
|
1926
|
+
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
1927
|
+
3,
|
|
1928
|
+
5
|
|
1929
|
+
];
|
|
1930
|
+
_value = _step.value;
|
|
1931
|
+
chunk = _value;
|
|
1932
|
+
if (chunk.type === "content_block_delta") {
|
|
1933
|
+
delta = chunk.delta.type === "input_json_delta" ? {
|
|
1934
|
+
tool_calls: [
|
|
1935
|
+
{
|
|
1936
|
+
index: 0,
|
|
1937
|
+
function: {
|
|
1938
|
+
arguments: chunk.delta.partial_json
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
]
|
|
1942
|
+
} : {
|
|
1943
|
+
content: chunk.delta.text
|
|
1944
|
+
};
|
|
1945
|
+
messageDelta = {
|
|
1946
|
+
id: "chatcmpl-".concat((0, import_radash3.uid)(29)),
|
|
1947
|
+
object: "chat.completion.chunk",
|
|
1948
|
+
choices: [
|
|
1949
|
+
{
|
|
1950
|
+
index: chunk.index,
|
|
1951
|
+
delta: delta
|
|
1952
|
+
}
|
|
1953
|
+
]
|
|
1954
|
+
};
|
|
1955
|
+
controller.enqueue("data: ".concat(JSON.stringify(messageDelta), "\n\n"));
|
|
1956
|
+
} else if (chunk.type === "content_block_start") {
|
|
1957
|
+
delta1 = chunk.content_block.type === "tool_use" ? {
|
|
1958
|
+
content: null,
|
|
1959
|
+
tool_calls: [
|
|
1960
|
+
{
|
|
1961
|
+
index: 0,
|
|
1962
|
+
id: chunk.content_block.id,
|
|
1963
|
+
type: "function",
|
|
1964
|
+
function: {
|
|
1965
|
+
name: chunk.content_block.name,
|
|
1966
|
+
arguments: ""
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
]
|
|
1970
|
+
} : {
|
|
1971
|
+
content: chunk.content_block.text
|
|
1972
|
+
};
|
|
1973
|
+
messageDelta1 = {
|
|
1974
|
+
id: "chatcmpl-".concat((0, import_radash3.uid)(29)),
|
|
1975
|
+
object: "chat.completion.chunk",
|
|
1976
|
+
choices: [
|
|
1977
|
+
{
|
|
1978
|
+
index: chunk.index,
|
|
1979
|
+
delta: delta1
|
|
1980
|
+
}
|
|
1981
|
+
]
|
|
1982
|
+
};
|
|
1983
|
+
controller.enqueue("data: ".concat(JSON.stringify(messageDelta1), "\n\n"));
|
|
1984
|
+
} else if (chunk.type === "message_start") {
|
|
1985
|
+
messageDelta2 = {
|
|
1986
|
+
id: "chatcmpl-".concat((0, import_radash3.uid)(29)),
|
|
1987
|
+
object: "chat.completion.chunk",
|
|
1988
|
+
choices: [
|
|
1989
|
+
{
|
|
1990
|
+
index: 0,
|
|
1991
|
+
delta: {
|
|
1992
|
+
content: ""
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
]
|
|
1996
|
+
};
|
|
1997
|
+
controller.enqueue("data: ".concat(JSON.stringify(messageDelta2), "\n\n"));
|
|
1998
|
+
}
|
|
1999
|
+
_state.label = 4;
|
|
2000
|
+
case 4:
|
|
2001
|
+
_iteratorAbruptCompletion = false;
|
|
2002
|
+
return [
|
|
2003
|
+
3,
|
|
2004
|
+
2
|
|
2005
|
+
];
|
|
2006
|
+
case 5:
|
|
2007
|
+
return [
|
|
2008
|
+
3,
|
|
2009
|
+
12
|
|
2010
|
+
];
|
|
2011
|
+
case 6:
|
|
2012
|
+
err = _state.sent();
|
|
2013
|
+
_didIteratorError = true;
|
|
2014
|
+
_iteratorError = err;
|
|
2015
|
+
return [
|
|
2016
|
+
3,
|
|
2017
|
+
12
|
|
2018
|
+
];
|
|
2019
|
+
case 7:
|
|
2020
|
+
_state.trys.push([
|
|
2021
|
+
7,
|
|
2022
|
+
,
|
|
2023
|
+
10,
|
|
2024
|
+
11
|
|
2025
|
+
]);
|
|
2026
|
+
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
2027
|
+
3,
|
|
2028
|
+
9
|
|
2029
|
+
];
|
|
2030
|
+
return [
|
|
2031
|
+
4,
|
|
2032
|
+
_iterator.return()
|
|
2033
|
+
];
|
|
2034
|
+
case 8:
|
|
2035
|
+
_state.sent();
|
|
2036
|
+
_state.label = 9;
|
|
2037
|
+
case 9:
|
|
2038
|
+
return [
|
|
2039
|
+
3,
|
|
2040
|
+
11
|
|
2041
|
+
];
|
|
2042
|
+
case 10:
|
|
2043
|
+
if (_didIteratorError) {
|
|
2044
|
+
throw _iteratorError;
|
|
2045
|
+
}
|
|
2046
|
+
return [
|
|
2047
|
+
7
|
|
2048
|
+
];
|
|
2049
|
+
case 11:
|
|
2050
|
+
return [
|
|
2051
|
+
7
|
|
2052
|
+
];
|
|
2053
|
+
case 12:
|
|
2054
|
+
controller.close();
|
|
2055
|
+
return [
|
|
2056
|
+
2
|
|
2057
|
+
];
|
|
2058
|
+
}
|
|
2059
|
+
});
|
|
2060
|
+
})();
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
return [
|
|
2064
|
+
2,
|
|
2065
|
+
new Response(stream, {
|
|
2066
|
+
headers: {
|
|
2067
|
+
"Content-Type": "text/event-stream"
|
|
2068
|
+
}
|
|
2069
|
+
})
|
|
2070
|
+
];
|
|
2071
|
+
case 2:
|
|
2072
|
+
_state.trys.push([
|
|
2073
|
+
2,
|
|
2074
|
+
4,
|
|
2075
|
+
,
|
|
2076
|
+
5
|
|
2077
|
+
]);
|
|
2078
|
+
return [
|
|
2079
|
+
4,
|
|
2080
|
+
anthropic.messages.create(resultOptions)
|
|
2081
|
+
];
|
|
2082
|
+
case 3:
|
|
2083
|
+
data = _state.sent();
|
|
2084
|
+
return [
|
|
2085
|
+
2,
|
|
2086
|
+
new Response(JSON.stringify({
|
|
2087
|
+
data: data
|
|
2088
|
+
}), {
|
|
2089
|
+
status: 200,
|
|
2090
|
+
headers: {
|
|
2091
|
+
"Content-Type": "application/json"
|
|
2092
|
+
}
|
|
2093
|
+
})
|
|
2094
|
+
];
|
|
2095
|
+
case 4:
|
|
2096
|
+
error = _state.sent();
|
|
2097
|
+
return [
|
|
2098
|
+
2,
|
|
2099
|
+
new Response(JSON.stringify({
|
|
2100
|
+
error: error
|
|
2101
|
+
}), {
|
|
2102
|
+
status: 500,
|
|
2103
|
+
headers: {
|
|
2104
|
+
"Content-Type": "application/json"
|
|
2105
|
+
}
|
|
2106
|
+
})
|
|
2107
|
+
];
|
|
2108
|
+
case 5:
|
|
2109
|
+
return [
|
|
2110
|
+
2
|
|
2111
|
+
];
|
|
2112
|
+
}
|
|
2113
|
+
});
|
|
2114
|
+
});
|
|
2115
|
+
return function(_url, options) {
|
|
2116
|
+
return _ref.apply(this, arguments);
|
|
2117
|
+
};
|
|
2118
|
+
}();
|
|
2119
|
+
};
|
|
2120
|
+
// src/adapters/client/anthropicClientAdapter/completions/index.ts
|
|
2121
|
+
var completions5 = function(param) {
|
|
2122
|
+
var anthropic = param.anthropic;
|
|
2123
|
+
return {
|
|
2124
|
+
post: post5({
|
|
2125
|
+
anthropic: anthropic
|
|
2126
|
+
})
|
|
2127
|
+
};
|
|
2128
|
+
};
|
|
2129
|
+
// src/adapters/client/anthropicClientAdapter/index.ts
|
|
2130
|
+
var anthropicClientAdapter = function(param) {
|
|
2131
|
+
var anthropic = param.anthropic;
|
|
2132
|
+
return {
|
|
2133
|
+
client: anthropic,
|
|
2134
|
+
requestHandlers: {
|
|
2135
|
+
"^/v1/models$": models7({
|
|
2136
|
+
anthropic: anthropic
|
|
2137
|
+
}),
|
|
2138
|
+
"^/v1/chat/completions$": completions5({
|
|
2139
|
+
anthropic: anthropic
|
|
2140
|
+
})
|
|
2141
|
+
}
|
|
2142
|
+
};
|
|
2143
|
+
};
|
|
2144
|
+
// src/adapters/client/togetherClientAdapter/models/get.ts
|
|
2145
|
+
var get6 = function(param) {
|
|
2146
|
+
var together = param.together;
|
|
2147
|
+
return /*#__PURE__*/ function() {
|
|
2148
|
+
var _ref = _async_to_generator(function(_url, _options) {
|
|
2149
|
+
var data, error;
|
|
2150
|
+
return _ts_generator(this, function(_state) {
|
|
2151
|
+
switch(_state.label){
|
|
2152
|
+
case 0:
|
|
2153
|
+
_state.trys.push([
|
|
2154
|
+
0,
|
|
2155
|
+
2,
|
|
2156
|
+
,
|
|
2157
|
+
3
|
|
2158
|
+
]);
|
|
2159
|
+
return [
|
|
2160
|
+
4,
|
|
2161
|
+
together.models.list()
|
|
2162
|
+
];
|
|
2163
|
+
case 1:
|
|
2164
|
+
data = _state.sent();
|
|
2165
|
+
return [
|
|
2166
|
+
2,
|
|
2167
|
+
new Response(JSON.stringify({
|
|
2168
|
+
type: "list",
|
|
2169
|
+
// @ts-ignore-next-line
|
|
2170
|
+
data: data.body
|
|
2171
|
+
}), {
|
|
2172
|
+
status: 200,
|
|
2173
|
+
headers: {
|
|
2174
|
+
"Content-Type": "application/json"
|
|
2175
|
+
}
|
|
2176
|
+
})
|
|
2177
|
+
];
|
|
2178
|
+
case 2:
|
|
2179
|
+
error = _state.sent();
|
|
2180
|
+
return [
|
|
2181
|
+
2,
|
|
2182
|
+
new Response(JSON.stringify({
|
|
2183
|
+
error: error
|
|
2184
|
+
}), {
|
|
2185
|
+
status: 500,
|
|
2186
|
+
headers: {
|
|
2187
|
+
"Content-Type": "application/json"
|
|
2188
|
+
}
|
|
2189
|
+
})
|
|
2190
|
+
];
|
|
2191
|
+
case 3:
|
|
2192
|
+
return [
|
|
2193
|
+
2
|
|
2194
|
+
];
|
|
2195
|
+
}
|
|
2196
|
+
});
|
|
2197
|
+
});
|
|
2198
|
+
return function(_url, _options) {
|
|
2199
|
+
return _ref.apply(this, arguments);
|
|
2200
|
+
};
|
|
2201
|
+
}();
|
|
2202
|
+
};
|
|
2203
|
+
// src/adapters/client/togetherClientAdapter/models/index.ts
|
|
2204
|
+
var models8 = function(param) {
|
|
2205
|
+
var together = param.together;
|
|
2206
|
+
return {
|
|
2207
|
+
get: get6({
|
|
2208
|
+
together: together
|
|
2209
|
+
})
|
|
2210
|
+
};
|
|
2211
|
+
};
|
|
2212
|
+
// src/adapters/client/togetherClientAdapter/completions/post.ts
|
|
2213
|
+
var post6 = function(param) {
|
|
2214
|
+
var together = param.together;
|
|
2215
|
+
return /*#__PURE__*/ function() {
|
|
2216
|
+
var _ref = _async_to_generator(function(_url, options) {
|
|
2217
|
+
var body, response, stream, data, error;
|
|
2218
|
+
return _ts_generator(this, function(_state) {
|
|
2219
|
+
switch(_state.label){
|
|
2220
|
+
case 0:
|
|
2221
|
+
body = JSON.parse(options.body);
|
|
2222
|
+
if (!body.stream) return [
|
|
2223
|
+
3,
|
|
2224
|
+
2
|
|
2225
|
+
];
|
|
2226
|
+
return [
|
|
2227
|
+
4,
|
|
2228
|
+
together.chat.completions.create(body)
|
|
2229
|
+
];
|
|
2230
|
+
case 1:
|
|
2231
|
+
response = _state.sent();
|
|
2232
|
+
console.dir({
|
|
2233
|
+
response: response
|
|
2234
|
+
}, {
|
|
2235
|
+
depth: null
|
|
2236
|
+
});
|
|
2237
|
+
stream = new ReadableStream({
|
|
2238
|
+
start: function start(controller) {
|
|
2239
|
+
return _async_to_generator(function() {
|
|
2240
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
|
|
2241
|
+
return _ts_generator(this, function(_state) {
|
|
2242
|
+
switch(_state.label){
|
|
2243
|
+
case 0:
|
|
2244
|
+
_iteratorAbruptCompletion = false, _didIteratorError = false;
|
|
2245
|
+
_state.label = 1;
|
|
2246
|
+
case 1:
|
|
2247
|
+
_state.trys.push([
|
|
2248
|
+
1,
|
|
2249
|
+
6,
|
|
2250
|
+
7,
|
|
2251
|
+
12
|
|
2252
|
+
]);
|
|
2253
|
+
_iterator = _async_iterator(response);
|
|
2254
|
+
_state.label = 2;
|
|
2255
|
+
case 2:
|
|
2256
|
+
return [
|
|
2257
|
+
4,
|
|
2258
|
+
_iterator.next()
|
|
2259
|
+
];
|
|
2260
|
+
case 3:
|
|
2261
|
+
if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
|
|
2262
|
+
3,
|
|
2263
|
+
5
|
|
2264
|
+
];
|
|
2265
|
+
_value = _step.value;
|
|
2266
|
+
chunk = _value;
|
|
2267
|
+
controller.enqueue("data: ".concat(JSON.stringify(chunk), "\n\n"));
|
|
2268
|
+
_state.label = 4;
|
|
2269
|
+
case 4:
|
|
2270
|
+
_iteratorAbruptCompletion = false;
|
|
2271
|
+
return [
|
|
2272
|
+
3,
|
|
2273
|
+
2
|
|
2274
|
+
];
|
|
2275
|
+
case 5:
|
|
2276
|
+
return [
|
|
2277
|
+
3,
|
|
2278
|
+
12
|
|
2279
|
+
];
|
|
2280
|
+
case 6:
|
|
2281
|
+
err = _state.sent();
|
|
2282
|
+
_didIteratorError = true;
|
|
2283
|
+
_iteratorError = err;
|
|
2284
|
+
return [
|
|
2285
|
+
3,
|
|
2286
|
+
12
|
|
2287
|
+
];
|
|
2288
|
+
case 7:
|
|
2289
|
+
_state.trys.push([
|
|
2290
|
+
7,
|
|
2291
|
+
,
|
|
2292
|
+
10,
|
|
2293
|
+
11
|
|
2294
|
+
]);
|
|
2295
|
+
if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
|
|
2296
|
+
3,
|
|
2297
|
+
9
|
|
2298
|
+
];
|
|
2299
|
+
return [
|
|
2300
|
+
4,
|
|
2301
|
+
_iterator.return()
|
|
2302
|
+
];
|
|
2303
|
+
case 8:
|
|
2304
|
+
_state.sent();
|
|
2305
|
+
_state.label = 9;
|
|
2306
|
+
case 9:
|
|
2307
|
+
return [
|
|
2308
|
+
3,
|
|
2309
|
+
11
|
|
2310
|
+
];
|
|
2311
|
+
case 10:
|
|
2312
|
+
if (_didIteratorError) {
|
|
2313
|
+
throw _iteratorError;
|
|
2314
|
+
}
|
|
2315
|
+
return [
|
|
2316
|
+
7
|
|
2317
|
+
];
|
|
2318
|
+
case 11:
|
|
2319
|
+
return [
|
|
2320
|
+
7
|
|
2321
|
+
];
|
|
2322
|
+
case 12:
|
|
2323
|
+
controller.close();
|
|
2324
|
+
return [
|
|
2325
|
+
2
|
|
2326
|
+
];
|
|
2327
|
+
}
|
|
2328
|
+
});
|
|
2329
|
+
})();
|
|
2330
|
+
}
|
|
2331
|
+
});
|
|
2332
|
+
return [
|
|
2333
|
+
2,
|
|
2334
|
+
new Response(stream, {
|
|
2335
|
+
headers: {
|
|
2336
|
+
"Content-Type": "text/event-stream"
|
|
2337
|
+
}
|
|
2338
|
+
})
|
|
2339
|
+
];
|
|
2340
|
+
case 2:
|
|
2341
|
+
_state.trys.push([
|
|
2342
|
+
2,
|
|
2343
|
+
4,
|
|
2344
|
+
,
|
|
2345
|
+
5
|
|
2346
|
+
]);
|
|
2347
|
+
return [
|
|
2348
|
+
4,
|
|
2349
|
+
together.chat.completions.create(body)
|
|
2350
|
+
];
|
|
2351
|
+
case 3:
|
|
2352
|
+
data = _state.sent();
|
|
2353
|
+
console.dir({
|
|
2354
|
+
data: data
|
|
2355
|
+
}, {
|
|
2356
|
+
depth: null
|
|
2357
|
+
});
|
|
2358
|
+
return [
|
|
2359
|
+
2,
|
|
2360
|
+
new Response(JSON.stringify({
|
|
2361
|
+
data: data
|
|
2362
|
+
}), {
|
|
2363
|
+
status: 200,
|
|
2364
|
+
headers: {
|
|
2365
|
+
"Content-Type": "application/json"
|
|
2366
|
+
}
|
|
2367
|
+
})
|
|
2368
|
+
];
|
|
2369
|
+
case 4:
|
|
2370
|
+
error = _state.sent();
|
|
2371
|
+
return [
|
|
2372
|
+
2,
|
|
2373
|
+
new Response(JSON.stringify({
|
|
2374
|
+
error: error
|
|
2375
|
+
}), {
|
|
2376
|
+
status: 500,
|
|
2377
|
+
headers: {
|
|
2378
|
+
"Content-Type": "application/json"
|
|
2379
|
+
}
|
|
2380
|
+
})
|
|
2381
|
+
];
|
|
2382
|
+
case 5:
|
|
2383
|
+
return [
|
|
2384
|
+
2
|
|
2385
|
+
];
|
|
2386
|
+
}
|
|
2387
|
+
});
|
|
2388
|
+
});
|
|
2389
|
+
return function(_url, options) {
|
|
2390
|
+
return _ref.apply(this, arguments);
|
|
2391
|
+
};
|
|
2392
|
+
}();
|
|
2393
|
+
};
|
|
2394
|
+
// src/adapters/client/togetherClientAdapter/completions/index.ts
|
|
2395
|
+
var completions6 = function(param) {
|
|
2396
|
+
var together = param.together;
|
|
2397
|
+
return {
|
|
2398
|
+
post: post6({
|
|
2399
|
+
together: together
|
|
2400
|
+
})
|
|
2401
|
+
};
|
|
2402
|
+
};
|
|
2403
|
+
// src/adapters/client/togetherClientAdapter/index.ts
|
|
2404
|
+
var togetherClientAdapter = function(param) {
|
|
2405
|
+
var together = param.together;
|
|
2406
|
+
return {
|
|
2407
|
+
client: together,
|
|
2408
|
+
requestHandlers: {
|
|
2409
|
+
"^/v1/models$": models8({
|
|
2410
|
+
together: together
|
|
2411
|
+
}),
|
|
2412
|
+
"^/(?:v1|/?openai)/chat/completions$": completions6({
|
|
2413
|
+
together: together
|
|
2414
|
+
})
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
};
|
|
2418
|
+
// src/adapters/client/ollamaClientAdapter/models/get.ts
|
|
2419
|
+
var get7 = function(param) {
|
|
2420
|
+
var ollama = param.ollama;
|
|
2421
|
+
return /*#__PURE__*/ function() {
|
|
2422
|
+
var _ref = _async_to_generator(function(_url, _options) {
|
|
2423
|
+
var data, error;
|
|
2424
|
+
return _ts_generator(this, function(_state) {
|
|
2425
|
+
switch(_state.label){
|
|
2426
|
+
case 0:
|
|
2427
|
+
_state.trys.push([
|
|
2428
|
+
0,
|
|
2429
|
+
2,
|
|
2430
|
+
,
|
|
2431
|
+
3
|
|
2432
|
+
]);
|
|
2433
|
+
return [
|
|
2434
|
+
4,
|
|
2435
|
+
ollama.models.list()
|
|
2436
|
+
];
|
|
2437
|
+
case 1:
|
|
2438
|
+
data = _state.sent();
|
|
2439
|
+
return [
|
|
2440
|
+
2,
|
|
2441
|
+
new Response(JSON.stringify(data), {
|
|
2442
|
+
status: 200,
|
|
2443
|
+
headers: {
|
|
2444
|
+
"Content-Type": "application/json"
|
|
2445
|
+
}
|
|
2446
|
+
})
|
|
2447
|
+
];
|
|
2448
|
+
case 2:
|
|
2449
|
+
error = _state.sent();
|
|
2450
|
+
return [
|
|
2451
|
+
2,
|
|
2452
|
+
new Response(JSON.stringify({
|
|
2453
|
+
error: error
|
|
2454
|
+
}), {
|
|
2455
|
+
status: 500,
|
|
2456
|
+
headers: {
|
|
2457
|
+
"Content-Type": "application/json"
|
|
2458
|
+
}
|
|
2459
|
+
})
|
|
2460
|
+
];
|
|
2461
|
+
case 3:
|
|
2462
|
+
return [
|
|
2463
|
+
2
|
|
2464
|
+
];
|
|
2465
|
+
}
|
|
1739
2466
|
});
|
|
1740
2467
|
});
|
|
1741
2468
|
return function(_url, _options) {
|
|
@@ -1743,160 +2470,44 @@ var get5 = function(param) {
|
|
|
1743
2470
|
};
|
|
1744
2471
|
}();
|
|
1745
2472
|
};
|
|
1746
|
-
// src/adapters/client/
|
|
1747
|
-
var
|
|
1748
|
-
var
|
|
2473
|
+
// src/adapters/client/ollamaClientAdapter/models/index.ts
|
|
2474
|
+
var models9 = function(param) {
|
|
2475
|
+
var ollama = param.ollama;
|
|
1749
2476
|
return {
|
|
1750
|
-
get:
|
|
1751
|
-
|
|
2477
|
+
get: get7({
|
|
2478
|
+
ollama: ollama
|
|
1752
2479
|
})
|
|
1753
2480
|
};
|
|
1754
2481
|
};
|
|
1755
|
-
// src/adapters/client/
|
|
1756
|
-
var
|
|
1757
|
-
|
|
1758
|
-
var import_radash2 = require("radash");
|
|
1759
|
-
var nonEmptyMessages = function(param) {
|
|
1760
|
-
var messages3 = param.messages;
|
|
1761
|
-
var result = [];
|
|
1762
|
-
messages3.forEach(function(message) {
|
|
1763
|
-
return result.push(_object_spread_props(_object_spread({}, message), {
|
|
1764
|
-
content: (0, import_radash2.isEmpty)(message.content) ? "-" : message.content
|
|
1765
|
-
}));
|
|
1766
|
-
});
|
|
1767
|
-
return result;
|
|
1768
|
-
};
|
|
1769
|
-
// src/lib/messages/firstUserMessages.ts
|
|
1770
|
-
var firstUserMessages = function(param) {
|
|
1771
|
-
var messages3 = param.messages;
|
|
1772
|
-
var firstMessage = messages3[0];
|
|
1773
|
-
if (!firstMessage) return messages3;
|
|
1774
|
-
if (firstMessage.role !== "user") {
|
|
1775
|
-
return [
|
|
1776
|
-
{
|
|
1777
|
-
role: "user",
|
|
1778
|
-
content: "-"
|
|
1779
|
-
}
|
|
1780
|
-
].concat(_to_consumable_array(messages3));
|
|
1781
|
-
}
|
|
1782
|
-
return messages3;
|
|
1783
|
-
};
|
|
1784
|
-
// src/adapters/client/anthropicClientAdapter/completions/serializeTools.ts
|
|
1785
|
-
var serializeTools = function(param) {
|
|
1786
|
-
var tools = param.tools;
|
|
1787
|
-
return (tools !== null && tools !== void 0 ? tools : []).map(function(tool) {
|
|
1788
|
-
if (tool.type === "function") {
|
|
1789
|
-
var _tool_function_parameters;
|
|
1790
|
-
return {
|
|
1791
|
-
name: tool.function.name,
|
|
1792
|
-
description: tool.function.description,
|
|
1793
|
-
input_schema: (_tool_function_parameters = tool.function.parameters) !== null && _tool_function_parameters !== void 0 ? _tool_function_parameters : {
|
|
1794
|
-
type: "object"
|
|
1795
|
-
}
|
|
1796
|
-
};
|
|
1797
|
-
}
|
|
1798
|
-
return tool;
|
|
1799
|
-
});
|
|
1800
|
-
};
|
|
1801
|
-
// src/adapters/client/anthropicClientAdapter/completions/serializeMessages/serializeMessage.ts
|
|
1802
|
-
var serializeMessage2 = function(param) {
|
|
1803
|
-
var message = param.message;
|
|
1804
|
-
if (message.role === "user") {
|
|
1805
|
-
return {
|
|
1806
|
-
role: "user",
|
|
1807
|
-
content: message.content
|
|
1808
|
-
};
|
|
1809
|
-
} else if (message.role === "assistant") {
|
|
1810
|
-
var _message_tool_calls;
|
|
1811
|
-
return {
|
|
1812
|
-
role: "assistant",
|
|
1813
|
-
content: [
|
|
1814
|
-
{
|
|
1815
|
-
type: "text",
|
|
1816
|
-
text: message.content
|
|
1817
|
-
}
|
|
1818
|
-
].concat(_to_consumable_array(((_message_tool_calls = message.tool_calls) !== null && _message_tool_calls !== void 0 ? _message_tool_calls : []).map(function(toolCall) {
|
|
1819
|
-
return {
|
|
1820
|
-
type: "tool_use",
|
|
1821
|
-
id: toolCall.id,
|
|
1822
|
-
name: toolCall.function.name,
|
|
1823
|
-
input: toolCall.function.arguments ? JSON.parse(toolCall.function.arguments) : {}
|
|
1824
|
-
};
|
|
1825
|
-
})))
|
|
1826
|
-
};
|
|
1827
|
-
} else if (message.role === "tool") {
|
|
1828
|
-
return {
|
|
1829
|
-
role: "user",
|
|
1830
|
-
content: [
|
|
1831
|
-
{
|
|
1832
|
-
type: "tool_result",
|
|
1833
|
-
tool_use_id: message.tool_call_id,
|
|
1834
|
-
content: message.content
|
|
1835
|
-
}
|
|
1836
|
-
]
|
|
1837
|
-
};
|
|
1838
|
-
}
|
|
1839
|
-
};
|
|
1840
|
-
// src/adapters/client/anthropicClientAdapter/completions/serializeMessages/index.ts
|
|
1841
|
-
var serializeMessages = function(param) {
|
|
1842
|
-
var messages3 = param.messages;
|
|
1843
|
-
return messages3.map(function(message) {
|
|
1844
|
-
return serializeMessage2({
|
|
1845
|
-
message: message
|
|
1846
|
-
});
|
|
1847
|
-
});
|
|
1848
|
-
};
|
|
1849
|
-
// src/adapters/client/anthropicClientAdapter/completions/post.ts
|
|
1850
|
-
var post5 = function(param) {
|
|
1851
|
-
var anthropic = param.anthropic;
|
|
2482
|
+
// src/adapters/client/ollamaClientAdapter/completions/post.ts
|
|
2483
|
+
var post7 = function(param) {
|
|
2484
|
+
var ollama = param.ollama;
|
|
1852
2485
|
return /*#__PURE__*/ function() {
|
|
1853
2486
|
var _ref = _async_to_generator(function(_url, options) {
|
|
1854
|
-
var body,
|
|
2487
|
+
var body, response, stream, data, error;
|
|
1855
2488
|
return _ts_generator(this, function(_state) {
|
|
1856
2489
|
switch(_state.label){
|
|
1857
2490
|
case 0:
|
|
1858
2491
|
body = JSON.parse(options.body);
|
|
1859
|
-
messages3 = body.messages;
|
|
1860
|
-
_ref = _sliced_to_array((0, import_radash3.fork)(messages3, function(message) {
|
|
1861
|
-
return message.role === "system";
|
|
1862
|
-
}), 2), systemMessages = _ref[0], otherMessages = _ref[1];
|
|
1863
|
-
system = systemMessages.map(function(message) {
|
|
1864
|
-
return message.content;
|
|
1865
|
-
}).join("\n");
|
|
1866
|
-
chatMessages = nonEmptyMessages({
|
|
1867
|
-
messages: firstUserMessages({
|
|
1868
|
-
messages: alternatingMessages({
|
|
1869
|
-
messages: otherMessages
|
|
1870
|
-
})
|
|
1871
|
-
})
|
|
1872
|
-
});
|
|
1873
|
-
resultOptions = _object_spread_props(_object_spread({}, (0, import_radash3.omit)(body, [
|
|
1874
|
-
"response_format"
|
|
1875
|
-
])), {
|
|
1876
|
-
stream: body.stream ? (0, import_radash3.isEmpty)(body.tools) : false,
|
|
1877
|
-
system: system,
|
|
1878
|
-
messages: serializeMessages({
|
|
1879
|
-
messages: chatMessages
|
|
1880
|
-
}),
|
|
1881
|
-
max_tokens: 4096,
|
|
1882
|
-
tools: serializeTools({
|
|
1883
|
-
tools: body.tools
|
|
1884
|
-
})
|
|
1885
|
-
});
|
|
1886
2492
|
if (!body.stream) return [
|
|
1887
2493
|
3,
|
|
1888
2494
|
2
|
|
1889
2495
|
];
|
|
1890
2496
|
return [
|
|
1891
2497
|
4,
|
|
1892
|
-
|
|
2498
|
+
ollama.chat.completions.create(body)
|
|
1893
2499
|
];
|
|
1894
2500
|
case 1:
|
|
1895
2501
|
response = _state.sent();
|
|
2502
|
+
console.dir({
|
|
2503
|
+
response: response
|
|
2504
|
+
}, {
|
|
2505
|
+
depth: null
|
|
2506
|
+
});
|
|
1896
2507
|
stream = new ReadableStream({
|
|
1897
2508
|
start: function start(controller) {
|
|
1898
2509
|
return _async_to_generator(function() {
|
|
1899
|
-
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk,
|
|
2510
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
|
|
1900
2511
|
return _ts_generator(this, function(_state) {
|
|
1901
2512
|
switch(_state.label){
|
|
1902
2513
|
case 0:
|
|
@@ -1923,73 +2534,7 @@ var post5 = function(param) {
|
|
|
1923
2534
|
];
|
|
1924
2535
|
_value = _step.value;
|
|
1925
2536
|
chunk = _value;
|
|
1926
|
-
|
|
1927
|
-
delta = chunk.delta.type === "input_json_delta" ? {
|
|
1928
|
-
tool_calls: [
|
|
1929
|
-
{
|
|
1930
|
-
index: 0,
|
|
1931
|
-
function: {
|
|
1932
|
-
arguments: chunk.delta.partial_json
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
]
|
|
1936
|
-
} : {
|
|
1937
|
-
content: chunk.delta.text
|
|
1938
|
-
};
|
|
1939
|
-
messageDelta = {
|
|
1940
|
-
id: "chatcmpl-".concat((0, import_radash3.uid)(29)),
|
|
1941
|
-
object: "chat.completion.chunk",
|
|
1942
|
-
choices: [
|
|
1943
|
-
{
|
|
1944
|
-
index: chunk.index,
|
|
1945
|
-
delta: delta
|
|
1946
|
-
}
|
|
1947
|
-
]
|
|
1948
|
-
};
|
|
1949
|
-
controller.enqueue("data: ".concat(JSON.stringify(messageDelta), "\n\n"));
|
|
1950
|
-
} else if (chunk.type === "content_block_start") {
|
|
1951
|
-
delta1 = chunk.content_block.type === "tool_use" ? {
|
|
1952
|
-
content: null,
|
|
1953
|
-
tool_calls: [
|
|
1954
|
-
{
|
|
1955
|
-
index: 0,
|
|
1956
|
-
id: chunk.content_block.id,
|
|
1957
|
-
type: "function",
|
|
1958
|
-
function: {
|
|
1959
|
-
name: chunk.content_block.name,
|
|
1960
|
-
arguments: ""
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
]
|
|
1964
|
-
} : {
|
|
1965
|
-
content: chunk.content_block.text
|
|
1966
|
-
};
|
|
1967
|
-
messageDelta1 = {
|
|
1968
|
-
id: "chatcmpl-".concat((0, import_radash3.uid)(29)),
|
|
1969
|
-
object: "chat.completion.chunk",
|
|
1970
|
-
choices: [
|
|
1971
|
-
{
|
|
1972
|
-
index: chunk.index,
|
|
1973
|
-
delta: delta1
|
|
1974
|
-
}
|
|
1975
|
-
]
|
|
1976
|
-
};
|
|
1977
|
-
controller.enqueue("data: ".concat(JSON.stringify(messageDelta1), "\n\n"));
|
|
1978
|
-
} else if (chunk.type === "message_start") {
|
|
1979
|
-
messageDelta2 = {
|
|
1980
|
-
id: "chatcmpl-".concat((0, import_radash3.uid)(29)),
|
|
1981
|
-
object: "chat.completion.chunk",
|
|
1982
|
-
choices: [
|
|
1983
|
-
{
|
|
1984
|
-
index: 0,
|
|
1985
|
-
delta: {
|
|
1986
|
-
content: ""
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
]
|
|
1990
|
-
};
|
|
1991
|
-
controller.enqueue("data: ".concat(JSON.stringify(messageDelta2), "\n\n"));
|
|
1992
|
-
}
|
|
2537
|
+
controller.enqueue("data: ".concat(JSON.stringify(chunk), "\n\n"));
|
|
1993
2538
|
_state.label = 4;
|
|
1994
2539
|
case 4:
|
|
1995
2540
|
_iteratorAbruptCompletion = false;
|
|
@@ -2071,10 +2616,15 @@ var post5 = function(param) {
|
|
|
2071
2616
|
]);
|
|
2072
2617
|
return [
|
|
2073
2618
|
4,
|
|
2074
|
-
|
|
2619
|
+
ollama.chat.completions.create(body)
|
|
2075
2620
|
];
|
|
2076
2621
|
case 3:
|
|
2077
2622
|
data = _state.sent();
|
|
2623
|
+
console.dir({
|
|
2624
|
+
data: data
|
|
2625
|
+
}, {
|
|
2626
|
+
depth: null
|
|
2627
|
+
});
|
|
2078
2628
|
return [
|
|
2079
2629
|
2,
|
|
2080
2630
|
new Response(JSON.stringify({
|
|
@@ -2111,26 +2661,26 @@ var post5 = function(param) {
|
|
|
2111
2661
|
};
|
|
2112
2662
|
}();
|
|
2113
2663
|
};
|
|
2114
|
-
// src/adapters/client/
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2664
|
+
// src/adapters/client/ollamaClientAdapter/completions/index.ts
|
|
2665
|
+
var completions7 = function(param) {
|
|
2666
|
+
var ollama = param.ollama;
|
|
2117
2667
|
return {
|
|
2118
|
-
post:
|
|
2119
|
-
|
|
2668
|
+
post: post7({
|
|
2669
|
+
ollama: ollama
|
|
2120
2670
|
})
|
|
2121
2671
|
};
|
|
2122
2672
|
};
|
|
2123
|
-
// src/adapters/client/
|
|
2124
|
-
var
|
|
2125
|
-
var
|
|
2673
|
+
// src/adapters/client/ollamaClientAdapter/index.ts
|
|
2674
|
+
var ollamaClientAdapter = function(param) {
|
|
2675
|
+
var ollama = param.ollama;
|
|
2126
2676
|
return {
|
|
2127
|
-
client:
|
|
2677
|
+
client: ollama,
|
|
2128
2678
|
requestHandlers: {
|
|
2129
|
-
"^/v1/models$":
|
|
2130
|
-
|
|
2679
|
+
"^/v1/models$": models9({
|
|
2680
|
+
ollama: ollama
|
|
2131
2681
|
}),
|
|
2132
|
-
"^/v1/chat/completions$":
|
|
2133
|
-
|
|
2682
|
+
"^/(?:v1|/?openai)/chat/completions$": completions7({
|
|
2683
|
+
ollama: ollama
|
|
2134
2684
|
})
|
|
2135
2685
|
}
|
|
2136
2686
|
};
|
|
@@ -2693,7 +3243,7 @@ var serializeThread = function(param) {
|
|
|
2693
3243
|
};
|
|
2694
3244
|
};
|
|
2695
3245
|
// src/adapters/storage/prismaStorageAdapter/threads/post.ts
|
|
2696
|
-
var
|
|
3246
|
+
var post8 = function(param) {
|
|
2697
3247
|
var prisma = param.prisma;
|
|
2698
3248
|
return /*#__PURE__*/ _async_to_generator(function() {
|
|
2699
3249
|
var _len, args, _key, body, messages3, metadata, initialCreatedAt, thread;
|
|
@@ -2763,7 +3313,7 @@ var post6 = function(param) {
|
|
|
2763
3313
|
var threads = function(param) {
|
|
2764
3314
|
var prisma = param.prisma;
|
|
2765
3315
|
return {
|
|
2766
|
-
post:
|
|
3316
|
+
post: post8({
|
|
2767
3317
|
prisma: prisma
|
|
2768
3318
|
})
|
|
2769
3319
|
};
|
|
@@ -2806,7 +3356,7 @@ var messageContentBlocks = function(param) {
|
|
|
2806
3356
|
}
|
|
2807
3357
|
];
|
|
2808
3358
|
};
|
|
2809
|
-
var
|
|
3359
|
+
var post9 = function(param) {
|
|
2810
3360
|
var prisma = param.prisma;
|
|
2811
3361
|
return /*#__PURE__*/ function() {
|
|
2812
3362
|
var _ref = _async_to_generator(function(urlString, options) {
|
|
@@ -2853,7 +3403,7 @@ var post7 = function(param) {
|
|
|
2853
3403
|
};
|
|
2854
3404
|
// src/adapters/storage/prismaStorageAdapter/threads/messages/get.ts
|
|
2855
3405
|
var import_radash7 = require("radash");
|
|
2856
|
-
var
|
|
3406
|
+
var get8 = function(param) {
|
|
2857
3407
|
var prisma = param.prisma;
|
|
2858
3408
|
return /*#__PURE__*/ function() {
|
|
2859
3409
|
var _ref = _async_to_generator(function(urlString) {
|
|
@@ -2919,10 +3469,10 @@ var get6 = function(param) {
|
|
|
2919
3469
|
var messages2 = function(param) {
|
|
2920
3470
|
var prisma = param.prisma;
|
|
2921
3471
|
return {
|
|
2922
|
-
post:
|
|
3472
|
+
post: post9({
|
|
2923
3473
|
prisma: prisma
|
|
2924
3474
|
}),
|
|
2925
|
-
get:
|
|
3475
|
+
get: get8({
|
|
2926
3476
|
prisma: prisma
|
|
2927
3477
|
})
|
|
2928
3478
|
};
|
|
@@ -2967,7 +3517,7 @@ var serializeRun = function(param) {
|
|
|
2967
3517
|
};
|
|
2968
3518
|
};
|
|
2969
3519
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/get.ts
|
|
2970
|
-
var
|
|
3520
|
+
var get9 = function(param) {
|
|
2971
3521
|
var prisma = param.prisma;
|
|
2972
3522
|
return /*#__PURE__*/ function() {
|
|
2973
3523
|
var _ref = _async_to_generator(function(urlString) {
|
|
@@ -3390,7 +3940,7 @@ var getMessages = function(param) {
|
|
|
3390
3940
|
});
|
|
3391
3941
|
};
|
|
3392
3942
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/post.ts
|
|
3393
|
-
var
|
|
3943
|
+
var post10 = function(param) {
|
|
3394
3944
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
3395
3945
|
return /*#__PURE__*/ function() {
|
|
3396
3946
|
var _ref = _async_to_generator(function(urlString, options) {
|
|
@@ -3564,17 +4114,17 @@ var post8 = function(param) {
|
|
|
3564
4114
|
var runs = function(param) {
|
|
3565
4115
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
3566
4116
|
return {
|
|
3567
|
-
get:
|
|
4117
|
+
get: get9({
|
|
3568
4118
|
prisma: prisma
|
|
3569
4119
|
}),
|
|
3570
|
-
post:
|
|
4120
|
+
post: post10({
|
|
3571
4121
|
prisma: prisma,
|
|
3572
4122
|
runAdapter: runAdapter
|
|
3573
4123
|
})
|
|
3574
4124
|
};
|
|
3575
4125
|
};
|
|
3576
4126
|
// src/adapters/storage/prismaStorageAdapter/threads/run/get.ts
|
|
3577
|
-
var
|
|
4127
|
+
var get10 = function(param) {
|
|
3578
4128
|
var prisma = param.prisma;
|
|
3579
4129
|
return /*#__PURE__*/ function() {
|
|
3580
4130
|
var _ref = _async_to_generator(function(urlString) {
|
|
@@ -3619,14 +4169,14 @@ var get8 = function(param) {
|
|
|
3619
4169
|
var run = function(param) {
|
|
3620
4170
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
3621
4171
|
return {
|
|
3622
|
-
get:
|
|
4172
|
+
get: get10({
|
|
3623
4173
|
prisma: prisma
|
|
3624
4174
|
})
|
|
3625
4175
|
};
|
|
3626
4176
|
};
|
|
3627
4177
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/steps/get.ts
|
|
3628
4178
|
var import_radash10 = require("radash");
|
|
3629
|
-
var
|
|
4179
|
+
var get11 = function(param) {
|
|
3630
4180
|
var prisma = param.prisma;
|
|
3631
4181
|
return /*#__PURE__*/ function() {
|
|
3632
4182
|
var _ref = _async_to_generator(function(urlString) {
|
|
@@ -3694,7 +4244,7 @@ var get9 = function(param) {
|
|
|
3694
4244
|
var steps = function(param) {
|
|
3695
4245
|
var prisma = param.prisma;
|
|
3696
4246
|
return {
|
|
3697
|
-
get:
|
|
4247
|
+
get: get11({
|
|
3698
4248
|
prisma: prisma
|
|
3699
4249
|
})
|
|
3700
4250
|
};
|
|
@@ -3868,7 +4418,7 @@ var updateRun = /*#__PURE__*/ function() {
|
|
|
3868
4418
|
};
|
|
3869
4419
|
}();
|
|
3870
4420
|
// src/adapters/storage/prismaStorageAdapter/threads/runs/submitToolOutputs/post/index.ts
|
|
3871
|
-
var
|
|
4421
|
+
var post11 = function(param) {
|
|
3872
4422
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
3873
4423
|
return /*#__PURE__*/ function() {
|
|
3874
4424
|
var _ref = _async_to_generator(function(urlString, options) {
|
|
@@ -4043,7 +4593,7 @@ var post9 = function(param) {
|
|
|
4043
4593
|
var submitToolOutputs = function(param) {
|
|
4044
4594
|
var prisma = param.prisma, runAdapter = param.runAdapter;
|
|
4045
4595
|
return {
|
|
4046
|
-
post:
|
|
4596
|
+
post: post11({
|
|
4047
4597
|
prisma: prisma,
|
|
4048
4598
|
// @ts-ignore-next-line
|
|
4049
4599
|
runAdapter: runAdapter
|
|
@@ -4085,9 +4635,11 @@ var prismaStorageAdapter = function(param) {
|
|
|
4085
4635
|
completionsRunAdapter: completionsRunAdapter,
|
|
4086
4636
|
groqClientAdapter: groqClientAdapter,
|
|
4087
4637
|
mistralClientAdapter: mistralClientAdapter,
|
|
4638
|
+
ollamaClientAdapter: ollamaClientAdapter,
|
|
4088
4639
|
openaiClientAdapter: openaiClientAdapter,
|
|
4089
4640
|
perplexityClientAdapter: perplexityClientAdapter,
|
|
4090
4641
|
prismaStorageAdapter: prismaStorageAdapter,
|
|
4091
|
-
supercompat: supercompat
|
|
4642
|
+
supercompat: supercompat,
|
|
4643
|
+
togetherClientAdapter: togetherClientAdapter
|
|
4092
4644
|
});
|
|
4093
4645
|
//# sourceMappingURL=index.cjs.map
|