@alpic80/rivet-ai-sdk-provider 2.0.1 → 2.0.3
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.js +25 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1109,7 +1109,7 @@ prepare tools input:${printObject(tools)}`);
|
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
1111
|
// src/version.ts
|
|
1112
|
-
var VERSION = true ? "2.0.
|
|
1112
|
+
var VERSION = true ? "2.0.3" : "0.0.0-test";
|
|
1113
1113
|
|
|
1114
1114
|
// src/post-to-api.ts
|
|
1115
1115
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -1761,7 +1761,7 @@ function createRivetEventSourceResponseHandler(id, model) {
|
|
|
1761
1761
|
}));
|
|
1762
1762
|
}
|
|
1763
1763
|
function mapRivetEventToOpenAIChunk(eventData, id, model) {
|
|
1764
|
-
var _a15, _b, _c, _d, _e, _f, _g;
|
|
1764
|
+
var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
1765
1765
|
const eventType = eventData.type;
|
|
1766
1766
|
switch (eventType) {
|
|
1767
1767
|
case "partialOutput":
|
|
@@ -1782,6 +1782,26 @@ function mapRivetEventToOpenAIChunk(eventData, id, model) {
|
|
|
1782
1782
|
],
|
|
1783
1783
|
usage: void 0
|
|
1784
1784
|
};
|
|
1785
|
+
case "nodeFinish":
|
|
1786
|
+
const rawContent = (_g = (_f = (_c = (_b = eventData.outputs) == null ? void 0 : _b.response) == null ? void 0 : _c.value) != null ? _f : (_e = (_d = eventData.outputs) == null ? void 0 : _d.valueOutput) == null ? void 0 : _e.value) != null ? _g : void 0;
|
|
1787
|
+
const delta = typeof rawContent === "string" ? rawContent : rawContent !== void 0 ? JSON.stringify(rawContent) : void 0;
|
|
1788
|
+
return {
|
|
1789
|
+
id,
|
|
1790
|
+
created: Math.floor(Date.now() / 1e3),
|
|
1791
|
+
model,
|
|
1792
|
+
choices: [
|
|
1793
|
+
{
|
|
1794
|
+
delta: {
|
|
1795
|
+
role: "assistant",
|
|
1796
|
+
content: delta != null ? delta : "",
|
|
1797
|
+
tool_calls: void 0
|
|
1798
|
+
},
|
|
1799
|
+
finish_reason: null,
|
|
1800
|
+
index: 0
|
|
1801
|
+
}
|
|
1802
|
+
],
|
|
1803
|
+
usage: toOpenAIUsage((_k = (_j = (_i = (_h = eventData == null ? void 0 : eventData.output) == null ? void 0 : _h.usages) == null ? void 0 : _i.value) == null ? void 0 : _j[0]) == null ? void 0 : _k.value)
|
|
1804
|
+
};
|
|
1785
1805
|
case "done":
|
|
1786
1806
|
return {
|
|
1787
1807
|
id,
|
|
@@ -1791,16 +1811,17 @@ function mapRivetEventToOpenAIChunk(eventData, id, model) {
|
|
|
1791
1811
|
{
|
|
1792
1812
|
delta: {
|
|
1793
1813
|
role: "assistant",
|
|
1794
|
-
content: (
|
|
1814
|
+
content: (_n = (_m = (_l = eventData.graphOutput) == null ? void 0 : _l.response) == null ? void 0 : _m.value) != null ? _n : "",
|
|
1795
1815
|
tool_calls: void 0
|
|
1796
1816
|
},
|
|
1797
1817
|
finish_reason: "stop",
|
|
1798
1818
|
index: 0
|
|
1799
1819
|
}
|
|
1800
1820
|
],
|
|
1801
|
-
usage: toOpenAIUsage((
|
|
1821
|
+
usage: toOpenAIUsage((_q = (_p = (_o = eventData.graphOutput.usages) == null ? void 0 : _o.value) == null ? void 0 : _p[0]) == null ? void 0 : _q.value)
|
|
1802
1822
|
};
|
|
1803
1823
|
default:
|
|
1824
|
+
console.log(`failling on default for type:${printObject(eventType)}`);
|
|
1804
1825
|
return {
|
|
1805
1826
|
id,
|
|
1806
1827
|
created: Math.floor(Date.now() / 1e3),
|