@anvaka/vue-llm 0.4.0 → 0.4.2

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.
@@ -1,6 +1,6 @@
1
- import { BaseProvider as y } from "./BaseProvider.js";
2
- import { AnthropicProvider as w } from "./AnthropicProvider.js";
3
- const p = [
1
+ import { BaseProvider as b } from "./BaseProvider.js";
2
+ import { AnthropicProvider as v } from "./AnthropicProvider.js";
3
+ const f = [
4
4
  "us.anthropic.claude-opus-4-8",
5
5
  "us.anthropic.claude-opus-4-7",
6
6
  "us.anthropic.claude-sonnet-4-6",
@@ -10,13 +10,13 @@ const p = [
10
10
  "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
11
11
  "us.anthropic.claude-opus-4-1-20250805-v1:0"
12
12
  ];
13
- class A extends w {
13
+ class A extends v {
14
14
  prepareRequest(r, n) {
15
15
  const t = super.prepareRequest(r, n);
16
16
  return delete t.stream, t.anthropic_version = "bedrock-2023-05-31", t;
17
17
  }
18
18
  buildHeaders() {
19
- return y.prototype.buildHeaders.call(this);
19
+ return b.prototype.buildHeaders.call(this);
20
20
  }
21
21
  getAuthHeaderName() {
22
22
  return "Authorization";
@@ -28,68 +28,61 @@ class A extends w {
28
28
  return !!this.config.apiKey;
29
29
  }
30
30
  async makeRequest(r, n, t) {
31
- const e = r.model, d = { ...r };
32
- delete d.model;
33
- const i = `${this.config.baseUrl}/model/${encodeURIComponent(e)}/invoke`, l = n ? { signal: n } : new AbortController();
34
- n || (t = t || this.generateRequestId(), this.activeRequests.set(t, l));
35
- try {
36
- const o = await fetch(i, {
31
+ const e = r.model, c = `${this.config.baseUrl}/model/${encodeURIComponent(e)}/invoke`, u = n ? { signal: n } : new AbortController();
32
+ n || (t = t || this.generateRequestId(), this.activeRequests.set(t, u));
33
+ const d = () => {
34
+ const i = { ...r };
35
+ return delete i.model, fetch(c, {
37
36
  method: "POST",
38
37
  headers: this.buildHeaders(),
39
- body: JSON.stringify(d),
40
- signal: l.signal || n
38
+ body: JSON.stringify(i),
39
+ signal: u.signal || n
41
40
  });
42
- if (!o.ok) {
43
- const h = await o.text();
44
- throw new Error(`Bedrock API Error (${o.status}): ${h}`);
45
- }
46
- return o.json();
41
+ };
42
+ try {
43
+ return (await this._sendWithTemperatureRetry(d, r, "Bedrock API Error")).json();
47
44
  } finally {
48
45
  !n && t && this.activeRequests.delete(t);
49
46
  }
50
47
  }
51
48
  async makeStreamingRequest(r, n) {
52
- const t = r.model, e = { ...r };
53
- delete e.model;
54
- const d = `${this.config.baseUrl}/model/${encodeURIComponent(t)}/invoke-with-response-stream`, i = await fetch(d, {
55
- method: "POST",
56
- headers: this.buildHeaders(),
57
- body: JSON.stringify(e),
58
- signal: n
59
- });
60
- if (!i.ok) {
61
- const c = await i.text();
62
- throw new Error(`Bedrock API Error (${i.status}): ${c}`);
63
- }
64
- const l = i.body.getReader(), o = new v(), h = new TextEncoder(), f = new ReadableStream({
65
- async pull(c) {
49
+ const t = r.model, e = `${this.config.baseUrl}/model/${encodeURIComponent(t)}/invoke-with-response-stream`, c = () => {
50
+ const o = { ...r };
51
+ return delete o.model, fetch(e, {
52
+ method: "POST",
53
+ headers: this.buildHeaders(),
54
+ body: JSON.stringify(o),
55
+ signal: n
56
+ });
57
+ }, d = (await this._sendWithTemperatureRetry(c, r, "Bedrock API Error")).body.getReader(), i = new w(), m = new TextEncoder(), h = new ReadableStream({
58
+ async pull(o) {
66
59
  try {
67
- const { done: a, value: g } = await l.read();
60
+ const { done: a, value: y } = await d.read();
68
61
  if (a) {
69
- c.close();
62
+ o.close();
70
63
  return;
71
64
  }
72
- const m = o.feed(g);
73
- for (const u of m) {
74
- if (u.kind === "error") {
75
- c.error(new Error(u.message));
65
+ const p = i.feed(y);
66
+ for (const l of p) {
67
+ if (l.kind === "error") {
68
+ o.error(new Error(l.message));
76
69
  return;
77
70
  }
78
- c.enqueue(h.encode(`data: ${JSON.stringify(u.payload)}
71
+ o.enqueue(m.encode(`data: ${JSON.stringify(l.payload)}
79
72
  `));
80
73
  }
81
74
  } catch (a) {
82
- c.error(a);
75
+ o.error(a);
83
76
  }
84
77
  },
85
- cancel(c) {
78
+ cancel(o) {
86
79
  try {
87
- l.cancel(c);
80
+ d.cancel(o);
88
81
  } catch {
89
82
  }
90
83
  }
91
84
  });
92
- return new Response(f, { status: 200, headers: { "Content-Type": "text/event-stream" } });
85
+ return new Response(h, { status: 200, headers: { "Content-Type": "text/event-stream" } });
93
86
  }
94
87
  // Live discovery is opt-in via config.liveModelDiscovery. A Bedrock API key
95
88
  // authenticates against the control plane with Bearer auth (no SigV4), and
@@ -102,12 +95,12 @@ class A extends w {
102
95
  // unset and keep the "no surprise network calls" default.
103
96
  async discoverModels(r = 1e4, { force: n = !1 } = {}) {
104
97
  if (!n && !this.config.liveModelDiscovery || !this.getModelsEndpoint())
105
- return p.slice();
98
+ return f.slice();
106
99
  try {
107
100
  const t = await super.discoverModels(r);
108
- return t.length ? t : p.slice();
101
+ return t.length ? t : f.slice();
109
102
  } catch {
110
- return p.slice();
103
+ return f.slice();
111
104
  }
112
105
  }
113
106
  // The control plane lives at the same host with the `-runtime` segment
@@ -125,12 +118,12 @@ class A extends w {
125
118
  // exactly what InvokeModel expects in the URL path.
126
119
  parseModelsResponse(r) {
127
120
  const n = r == null ? void 0 : r.inferenceProfileSummaries;
128
- if (!Array.isArray(n)) return p.slice();
121
+ if (!Array.isArray(n)) return f.slice();
129
122
  const t = n.map((e) => e == null ? void 0 : e.inferenceProfileId).filter((e) => typeof e == "string" && e.includes("anthropic.claude"));
130
- return t.length ? t : p.slice();
123
+ return t.length ? t : f.slice();
131
124
  }
132
125
  }
133
- class v {
126
+ class w {
134
127
  constructor() {
135
128
  this.buf = new Uint8Array(0), this.textDecoder = new TextDecoder();
136
129
  }
@@ -141,30 +134,30 @@ class v {
141
134
  }
142
135
  const n = [];
143
136
  for (; this.buf.length >= 12; ) {
144
- const t = new DataView(this.buf.buffer, this.buf.byteOffset, this.buf.byteLength), e = t.getUint32(0, !1), d = t.getUint32(4, !1);
137
+ const t = new DataView(this.buf.buffer, this.buf.byteOffset, this.buf.byteLength), e = t.getUint32(0, !1), c = t.getUint32(4, !1);
145
138
  if (e < 16 || e > 16 * 1024 * 1024)
146
139
  throw new Error(`Bedrock event stream: invalid frame length ${e}`);
147
140
  if (this.buf.length < e) break;
148
- const i = 12, l = i + d, o = l, h = e - 4, f = k(this.buf.subarray(i, l)), c = this.textDecoder.decode(this.buf.subarray(o, h));
141
+ const u = 12, d = u + c, i = d, m = e - 4, h = k(this.buf.subarray(u, d)), o = this.textDecoder.decode(this.buf.subarray(i, m));
149
142
  this.buf = this.buf.subarray(e);
150
143
  let a;
151
144
  try {
152
- a = JSON.parse(c);
145
+ a = JSON.parse(o);
153
146
  } catch {
154
147
  a = null;
155
148
  }
156
- const g = f[":message-type"], m = f[":exception-type"];
157
- if (g === "exception" || m) {
158
- const u = m || f[":event-type"] || "BedrockStreamException", b = (a == null ? void 0 : a.message) || c || "unknown error";
159
- n.push({ kind: "error", message: `${u}: ${b}` });
149
+ const y = h[":message-type"], p = h[":exception-type"];
150
+ if (y === "exception" || p) {
151
+ const l = p || h[":event-type"] || "BedrockStreamException", g = (a == null ? void 0 : a.message) || o || "unknown error";
152
+ n.push({ kind: "error", message: `${l}: ${g}` });
160
153
  continue;
161
154
  }
162
155
  if (a && typeof a.bytes == "string")
163
156
  try {
164
- const u = x(a.bytes), b = JSON.parse(u);
165
- n.push({ kind: "event", payload: b });
166
- } catch (u) {
167
- n.push({ kind: "error", message: `Bedrock event-stream decode failed: ${u.message}` });
157
+ const l = R(a.bytes), g = JSON.parse(l);
158
+ n.push({ kind: "event", payload: g });
159
+ } catch (l) {
160
+ n.push({ kind: "error", message: `Bedrock event-stream decode failed: ${l.message}` });
168
161
  }
169
162
  }
170
163
  return n;
@@ -174,27 +167,27 @@ function k(s) {
174
167
  const r = {}, n = new DataView(s.buffer, s.byteOffset, s.byteLength), t = new TextDecoder();
175
168
  let e = 0;
176
169
  for (; e < s.length; ) {
170
+ const c = s[e];
171
+ if (e += 1, e + c > s.length) break;
172
+ const u = t.decode(s.subarray(e, e + c));
173
+ if (e += c, e >= s.length) break;
177
174
  const d = s[e];
178
- if (e += 1, e + d > s.length) break;
179
- const i = t.decode(s.subarray(e, e + d));
180
- if (e += d, e >= s.length) break;
181
- const l = s[e];
182
- if (e += 1, l === 7) {
175
+ if (e += 1, d === 7) {
183
176
  if (e + 2 > s.length) break;
184
- const o = n.getUint16(e, !1);
185
- if (e += 2, e + o > s.length) break;
186
- r[i] = t.decode(s.subarray(e, e + o)), e += o;
177
+ const i = n.getUint16(e, !1);
178
+ if (e += 2, e + i > s.length) break;
179
+ r[u] = t.decode(s.subarray(e, e + i)), e += i;
187
180
  } else
188
181
  break;
189
182
  }
190
183
  return r;
191
184
  }
192
- function x(s) {
185
+ function R(s) {
193
186
  const r = atob(s), n = new Uint8Array(r.length);
194
187
  for (let t = 0; t < r.length; t++) n[t] = r.charCodeAt(t);
195
188
  return new TextDecoder().decode(n);
196
189
  }
197
190
  export {
198
- p as BEDROCK_CLAUDE_MODELS,
191
+ f as BEDROCK_CLAUDE_MODELS,
199
192
  A as BedrockProvider
200
193
  };
@@ -1,6 +1,6 @@
1
1
  import { BaseProvider as d } from "./BaseProvider.js";
2
2
  import { convertMessagesToOpenAI as g, normalizeOpenAIUsage as u } from "./OpenAIProvider.js";
3
- class A extends d {
3
+ class y extends d {
4
4
  async detectCapabilities() {
5
5
  this.capabilities.add("tools");
6
6
  }
@@ -8,11 +8,10 @@ class A extends d {
8
8
  const t = {
9
9
  model: e.model || this.config.model || "gpt-3.5-turbo",
10
10
  messages: g(n),
11
- temperature: e.temperature ?? 0.7,
12
11
  max_tokens: e.maxTokens || 1e3,
13
12
  stream: e.stream || !1
14
13
  };
15
- return t.stream && (t.stream_options = { include_usage: !0 }), e.tools && this.capabilities.has("tools") && (t.tools = e.tools, e.tool_choice && (t.tool_choice = e.tool_choice)), t;
14
+ return this.applySamplingParams(t, e), t.stream && (t.stream_options = { include_usage: !0 }), e.tools && this.capabilities.has("tools") && (t.tools = e.tools, e.tool_choice && (t.tool_choice = e.tool_choice)), t;
16
15
  }
17
16
  processResponse(n) {
18
17
  var s, o, i, a;
@@ -90,5 +89,5 @@ function h(r) {
90
89
  }
91
90
  }
92
91
  export {
93
- A as CustomProvider
92
+ y as CustomProvider
94
93
  };
@@ -1,6 +1,6 @@
1
- import { BaseProvider as d } from "./BaseProvider.js";
2
- import { convertMessagesToOpenAI as h } from "./OpenAIProvider.js";
3
- class b extends d {
1
+ import { BaseProvider as h } from "./BaseProvider.js";
2
+ import { convertMessagesToOpenAI as d } from "./OpenAIProvider.js";
3
+ class b extends h {
4
4
  async detectCapabilities() {
5
5
  if (!this.config.model) return;
6
6
  const t = this.config.model.toLowerCase();
@@ -10,11 +10,10 @@ class b extends d {
10
10
  const n = {
11
11
  model: e.model || this.config.model || "deepseek-chat",
12
12
  messages: _(t),
13
- temperature: e.temperature ?? 0.7,
14
13
  max_tokens: e.maxTokens || 1e3,
15
14
  stream: e.stream || !1
16
15
  };
17
- return n.stream && (n.stream_options = { include_usage: !0 }), e.tools && this.capabilities.has("tools") && (n.tools = e.tools, e.tool_choice && (n.tool_choice = e.tool_choice)), e.enableThinking && this.capabilities.has("thinking") && (n.thinking = { type: "enabled" }), n;
16
+ return this.applySamplingParams(n, e), n.stream && (n.stream_options = { include_usage: !0 }), e.tools && this.capabilities.has("tools") && (n.tools = e.tools, e.tool_choice && (n.tool_choice = e.tool_choice)), e.enableThinking && this.capabilities.has("thinking") && (n.thinking = { type: "enabled" }), n;
18
17
  }
19
18
  processResponse(t) {
20
19
  var s, i, a, r;
@@ -103,7 +102,7 @@ function u(o) {
103
102
  return o.prompt_cache_hit_tokens != null && (s.cachedInputTokens = o.prompt_cache_hit_tokens), s;
104
103
  }
105
104
  function _(o) {
106
- return h(o).map((e, n) => {
105
+ return d(o).map((e, n) => {
107
106
  if (e.role !== "assistant") return e;
108
107
  const s = o[n] || {}, i = s.thinking || s.reasoning_content, { thinking: a, reasoning_content: r, ...c } = e;
109
108
  return i && (c.reasoning_content = i), c;
@@ -1,52 +1,51 @@
1
1
  import { BaseProvider as g } from "./BaseProvider.js";
2
- import { convertMessagesToOpenAI as m, normalizeOpenAIUsage as u } from "./OpenAIProvider.js";
2
+ import { convertMessagesToOpenAI as m, normalizeOpenAIUsage as c } from "./OpenAIProvider.js";
3
3
  class y extends g {
4
4
  async detectCapabilities() {
5
5
  if (!this.config.model) return;
6
- const t = this.config.model.toLowerCase();
7
- (t.includes("grok-2") || t.includes("vision")) && this.capabilities.add("vision"), this.capabilities.add("tools");
6
+ const s = this.config.model.toLowerCase();
7
+ (s.includes("grok-2") || s.includes("vision")) && this.capabilities.add("vision"), this.capabilities.add("tools");
8
8
  }
9
- prepareRequest(t, e) {
10
- const s = {
9
+ prepareRequest(s, e) {
10
+ const t = {
11
11
  model: e.model || this.config.model || "grok-beta",
12
- messages: this.processMessages(t, e),
13
- temperature: e.temperature ?? 0.7,
12
+ messages: this.processMessages(s, e),
14
13
  max_tokens: e.maxTokens || 1e3,
15
14
  stream: e.stream || !1
16
15
  };
17
- return s.stream && (s.stream_options = { include_usage: !0 }), e.tools && this.capabilities.has("tools") && (s.tools = e.tools, e.tool_choice && (s.tool_choice = e.tool_choice)), s;
16
+ return this.applySamplingParams(t, e), t.stream && (t.stream_options = { include_usage: !0 }), e.tools && this.capabilities.has("tools") && (t.tools = e.tools, e.tool_choice && (t.tool_choice = e.tool_choice)), t;
18
17
  }
19
- processMessages(t, e) {
20
- const s = m(t);
21
- return e.images && this.capabilities.has("vision") ? this.addImagesToMessages(s, e.images) : s;
18
+ processMessages(s, e) {
19
+ const t = m(s);
20
+ return e.images && this.capabilities.has("vision") ? this.addImagesToMessages(t, e.images) : t;
22
21
  }
23
- addImagesToMessages(t, e) {
24
- const s = t[t.length - 1];
25
- if (s && s.role === "user") {
26
- const n = [{ type: "text", text: s.content }];
27
- e.forEach((r) => n.push({ type: "image_url", image_url: { url: typeof r == "string" ? r : r.url } })), s.content = n;
22
+ addImagesToMessages(s, e) {
23
+ const t = s[s.length - 1];
24
+ if (t && t.role === "user") {
25
+ const r = [{ type: "text", text: t.content }];
26
+ e.forEach((n) => r.push({ type: "image_url", image_url: { url: typeof n == "string" ? n : n.url } })), t.content = r;
28
27
  }
29
- return t;
28
+ return s;
30
29
  }
31
- processResponse(t) {
32
- var n, r, i, o;
33
- const e = (r = (n = t.choices) == null ? void 0 : n[0]) == null ? void 0 : r.message, s = {
30
+ processResponse(s) {
31
+ var r, n, i, o;
32
+ const e = (n = (r = s.choices) == null ? void 0 : r[0]) == null ? void 0 : n.message, t = {
34
33
  content: (e == null ? void 0 : e.content) || "",
35
- usage: u(t.usage),
36
- finishReason: c((o = (i = t.choices) == null ? void 0 : i[0]) == null ? void 0 : o.finish_reason)
34
+ usage: c(s.usage),
35
+ finishReason: u((o = (i = s.choices) == null ? void 0 : i[0]) == null ? void 0 : o.finish_reason)
37
36
  };
38
- return Array.isArray(e == null ? void 0 : e.tool_calls) && (s.toolCalls = e.tool_calls.map((l) => {
37
+ return Array.isArray(e == null ? void 0 : e.tool_calls) && (t.toolCalls = e.tool_calls.map((l) => {
39
38
  var d, f;
40
39
  return {
41
40
  id: l.id,
42
41
  name: (d = l.function) == null ? void 0 : d.name,
43
42
  args: h((f = l.function) == null ? void 0 : f.arguments)
44
43
  };
45
- })), s;
44
+ })), t;
46
45
  }
47
- parseStreamingLine(t) {
48
- if (!t.startsWith("data: ")) return null;
49
- const e = t.slice(6).trim();
46
+ parseStreamingLine(s) {
47
+ if (!s.startsWith("data: ")) return null;
48
+ const e = s.slice(6).trim();
50
49
  if (e === "[DONE]") return { done: !0 };
51
50
  try {
52
51
  return JSON.parse(e);
@@ -54,26 +53,26 @@ class y extends g {
54
53
  return null;
55
54
  }
56
55
  }
57
- extractStreamingContent(t) {
58
- var n, r, i;
59
- if (t.done) return { done: !0 };
60
- const e = (n = t.choices) == null ? void 0 : n[0], s = e == null ? void 0 : e.delta;
61
- if (s && Array.isArray(s.tool_calls) && s.tool_calls.length) {
62
- const o = s.tool_calls[0];
56
+ extractStreamingContent(s) {
57
+ var r, n, i;
58
+ if (s.done) return { done: !0 };
59
+ const e = (r = s.choices) == null ? void 0 : r[0], t = e == null ? void 0 : e.delta;
60
+ if (t && Array.isArray(t.tool_calls) && t.tool_calls.length) {
61
+ const o = t.tool_calls[0];
63
62
  return {
64
- content: s.content || "",
63
+ content: t.content || "",
65
64
  done: !1,
66
- usage: u(t.usage),
67
- finishReason: c(e == null ? void 0 : e.finish_reason),
65
+ usage: c(s.usage),
66
+ finishReason: u(e == null ? void 0 : e.finish_reason),
68
67
  toolCallDelta: {
69
68
  index: o.index ?? 0,
70
69
  id: o.id || void 0,
71
- name: ((r = o.function) == null ? void 0 : r.name) || void 0,
70
+ name: ((n = o.function) == null ? void 0 : n.name) || void 0,
72
71
  argsTextDelta: ((i = o.function) == null ? void 0 : i.arguments) || ""
73
72
  }
74
73
  };
75
74
  }
76
- return { content: (s == null ? void 0 : s.content) || "", done: !1, usage: u(t.usage), finishReason: c(e == null ? void 0 : e.finish_reason) };
75
+ return { content: (t == null ? void 0 : t.content) || "", done: !1, usage: c(s.usage), finishReason: u(e == null ? void 0 : e.finish_reason) };
77
76
  }
78
77
  getApiPath() {
79
78
  return "/v1/chat/completions";
@@ -84,15 +83,15 @@ class y extends g {
84
83
  getModelsEndpoint() {
85
84
  return `${this.config.baseUrl}/v1/models`;
86
85
  }
87
- parseModelsResponse(t) {
88
- var e, s, n;
89
- return ((n = (s = (e = t.data) == null ? void 0 : e.filter((r) => String(r.id).toLowerCase().includes("grok"))) == null ? void 0 : s.map((r) => r.id)) == null ? void 0 : n.sort()) || [];
86
+ parseModelsResponse(s) {
87
+ var e, t, r;
88
+ return ((r = (t = (e = s.data) == null ? void 0 : e.filter((n) => String(n.id).toLowerCase().includes("grok"))) == null ? void 0 : t.map((n) => n.id)) == null ? void 0 : r.sort()) || [];
90
89
  }
91
90
  }
92
- function c(a) {
91
+ function u(a) {
93
92
  if (!a) return null;
94
- const t = String(a).toLowerCase();
95
- return t === "length" || t === "max_tokens" ? "length" : t;
93
+ const s = String(a).toLowerCase();
94
+ return s === "length" || s === "max_tokens" ? "length" : s;
96
95
  }
97
96
  function h(a) {
98
97
  if (!a) return {};
@@ -8,18 +8,17 @@ class A extends m {
8
8
  const t = {
9
9
  model: e.model || this.config.model || "llama2",
10
10
  messages: g(n),
11
- temperature: e.temperature ?? 0.7,
12
11
  max_tokens: e.maxTokens || 1e3,
13
12
  stream: e.stream || !1
14
13
  };
15
- return t.stream && (t.stream_options = { include_usage: !0 }), e.tools && this.capabilities.has("tools") && (t.tools = e.tools, e.tool_choice && (t.tool_choice = e.tool_choice)), t;
14
+ return this.applySamplingParams(t, e), t.stream && (t.stream_options = { include_usage: !0 }), e.tools && this.capabilities.has("tools") && (t.tools = e.tools, e.tool_choice && (t.tool_choice = e.tool_choice)), t;
16
15
  }
17
16
  processResponse(n) {
18
- var r, o, i, a;
19
- const e = (o = (r = n.choices) == null ? void 0 : r[0]) == null ? void 0 : o.message, t = {
17
+ var r, i, o, a;
18
+ const e = (i = (r = n.choices) == null ? void 0 : r[0]) == null ? void 0 : i.message, t = {
20
19
  content: (e == null ? void 0 : e.content) || "",
21
20
  usage: u(n.usage),
22
- finishReason: c((a = (i = n.choices) == null ? void 0 : i[0]) == null ? void 0 : a.finish_reason)
21
+ finishReason: c((a = (o = n.choices) == null ? void 0 : o[0]) == null ? void 0 : a.finish_reason)
23
22
  };
24
23
  return Array.isArray(e == null ? void 0 : e.tool_calls) && (t.toolCalls = e.tool_calls.map((l) => {
25
24
  var d, f;
@@ -41,7 +40,7 @@ class A extends m {
41
40
  }
42
41
  }
43
42
  extractStreamingContent(n) {
44
- var r, o, i;
43
+ var r, i, o;
45
44
  if (n.done) return { done: !0 };
46
45
  const e = (r = n.choices) == null ? void 0 : r[0], t = e == null ? void 0 : e.delta;
47
46
  if (t && Array.isArray(t.tool_calls) && t.tool_calls.length) {
@@ -55,8 +54,8 @@ class A extends m {
55
54
  toolCallDelta: {
56
55
  index: a.index ?? 0,
57
56
  id: a.id || void 0,
58
- name: ((o = a.function) == null ? void 0 : o.name) || void 0,
59
- argsTextDelta: ((i = a.function) == null ? void 0 : i.arguments) || ""
57
+ name: ((i = a.function) == null ? void 0 : i.name) || void 0,
58
+ argsTextDelta: ((o = a.function) == null ? void 0 : o.arguments) || ""
60
59
  }
61
60
  };
62
61
  }