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