@heripo/document-processor 0.1.31 → 0.1.33

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
@@ -147,6 +147,8 @@ function detectProvider(model) {
147
147
  if (providerId.includes("google")) return "google";
148
148
  if (providerId.includes("anthropic")) return "anthropic";
149
149
  if (providerId.includes("together")) return "togetherai";
150
+ if (providerId.includes("ollama")) return "ollama";
151
+ if (providerId.includes("lmstudio")) return "lmstudio";
150
152
  return "unknown";
151
153
  }
152
154
  var LLMCaller = class {
@@ -234,14 +236,18 @@ var LLMCaller = class {
234
236
  *
235
237
  * Strategy per provider:
236
238
  * - OpenAI / Anthropic / Google Gemini: `Output.object()` with schema retry
237
- * - Together AI / unknown: forced tool call pattern
239
+ * - Together AI / Ollama / unknown: forced tool call pattern
240
+ *
241
+ * Ollama uses tool-call because MLX backends ignore the `format` grammar
242
+ * that `Output.object()` relies on, and gguf's grammar is unstable once
243
+ * thinking is disabled. Applies to both text and vision paths.
238
244
  *
239
245
  * Retries up to MAX_STRUCTURED_OUTPUT_RETRIES times on NoObjectGeneratedError
240
246
  * (schema mismatch), re-throwing the last error if all attempts fail.
241
247
  */
242
248
  static async generateStructuredOutput(model, schema, promptParams) {
243
249
  const providerType = detectProvider(model);
244
- if (providerType === "togetherai" || providerType === "unknown") {
250
+ if (providerType === "togetherai" || providerType === "ollama" || providerType === "unknown") {
245
251
  return this.generateViaToolCall(model, schema, promptParams);
246
252
  }
247
253
  let lastError;