@alpic80/rivet-ai-sdk-provider 2.0.2 → 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 +9 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -6
- 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, _h;
|
|
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":
|
|
@@ -1783,6 +1783,8 @@ function mapRivetEventToOpenAIChunk(eventData, id, model) {
|
|
|
1783
1783
|
usage: void 0
|
|
1784
1784
|
};
|
|
1785
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;
|
|
1786
1788
|
return {
|
|
1787
1789
|
id,
|
|
1788
1790
|
created: Math.floor(Date.now() / 1e3),
|
|
@@ -1791,14 +1793,14 @@ function mapRivetEventToOpenAIChunk(eventData, id, model) {
|
|
|
1791
1793
|
{
|
|
1792
1794
|
delta: {
|
|
1793
1795
|
role: "assistant",
|
|
1794
|
-
content:
|
|
1796
|
+
content: delta != null ? delta : "",
|
|
1795
1797
|
tool_calls: void 0
|
|
1796
1798
|
},
|
|
1797
1799
|
finish_reason: null,
|
|
1798
1800
|
index: 0
|
|
1799
1801
|
}
|
|
1800
1802
|
],
|
|
1801
|
-
usage: void 0
|
|
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)
|
|
1802
1804
|
};
|
|
1803
1805
|
case "done":
|
|
1804
1806
|
return {
|
|
@@ -1809,16 +1811,17 @@ function mapRivetEventToOpenAIChunk(eventData, id, model) {
|
|
|
1809
1811
|
{
|
|
1810
1812
|
delta: {
|
|
1811
1813
|
role: "assistant",
|
|
1812
|
-
content: (
|
|
1814
|
+
content: (_n = (_m = (_l = eventData.graphOutput) == null ? void 0 : _l.response) == null ? void 0 : _m.value) != null ? _n : "",
|
|
1813
1815
|
tool_calls: void 0
|
|
1814
1816
|
},
|
|
1815
1817
|
finish_reason: "stop",
|
|
1816
1818
|
index: 0
|
|
1817
1819
|
}
|
|
1818
1820
|
],
|
|
1819
|
-
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)
|
|
1820
1822
|
};
|
|
1821
1823
|
default:
|
|
1824
|
+
console.log(`failling on default for type:${printObject(eventType)}`);
|
|
1822
1825
|
return {
|
|
1823
1826
|
id,
|
|
1824
1827
|
created: Math.floor(Date.now() / 1e3),
|