@theokit/sdk 4.7.0 → 4.7.1

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 CHANGED
@@ -12077,12 +12077,9 @@ function buildAssistantTurn(text, toolCalls) {
12077
12077
  function buildUserContent(text, images) {
12078
12078
  const content = [{ type: "text", text }];
12079
12079
  for (const img of images ?? []) {
12080
- if ("data" in img) {
12081
- content.push({
12082
- type: "image",
12083
- source: { type: "base64", media_type: img.mimeType, data: img.data }
12084
- });
12085
- }
12080
+ content.push(
12081
+ "data" in img ? { type: "image", source: { type: "base64", media_type: img.mimeType, data: img.data } } : { type: "image", source: { type: "url", url: img.url } }
12082
+ );
12086
12083
  }
12087
12084
  return content;
12088
12085
  }
@@ -14755,6 +14752,9 @@ function readOpenAiContent(body) {
14755
14752
  return void 0;
14756
14753
  }
14757
14754
 
14755
+ // src/internal/llm/ollama-native.ts
14756
+ init_errors();
14757
+
14758
14758
  // src/internal/error-mappers/ollama.ts
14759
14759
  init_errors();
14760
14760
  function mapOllamaTransportError(args) {
@@ -15022,6 +15022,12 @@ function toOllamaMessages(message) {
15022
15022
  return [{ role: "system", content: joinTextParts(message) }];
15023
15023
  }
15024
15024
  if (message.role === "user") {
15025
+ if (message.content.some((p) => p.type === "image")) {
15026
+ throw new exports.ConfigurationError(
15027
+ "image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
15028
+ { code: "ollama_image_unsupported" }
15029
+ );
15030
+ }
15025
15031
  const out = [];
15026
15032
  for (const part of message.content) {
15027
15033
  if (part.type === "tool_result") {
@@ -15513,15 +15519,15 @@ function userOrToolMessages(message) {
15513
15519
  }
15514
15520
  }
15515
15521
  const userText = joinTextParts2(message);
15516
- const imageParts = message.content.filter((p) => p.type === "image");
15522
+ const imageParts = message.content.filter(
15523
+ (p) => p.type === "image"
15524
+ );
15517
15525
  if (imageParts.length > 0) {
15518
15526
  const content = [];
15519
15527
  if (userText.length > 0) content.push({ type: "text", text: userText });
15520
15528
  for (const img of imageParts) {
15521
- content.push({
15522
- type: "image_url",
15523
- image_url: { url: `data:${img.source.media_type};base64,${img.source.data}` }
15524
- });
15529
+ const url = img.source.type === "base64" ? `data:${img.source.media_type};base64,${img.source.data}` : img.source.url;
15530
+ content.push({ type: "image_url", image_url: { url } });
15525
15531
  }
15526
15532
  out.push({ role: "user", content });
15527
15533
  } else if (userText.length > 0) {