vern-llm 2.1.0 → 2.1.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/README.md CHANGED
@@ -36,10 +36,10 @@ pnpm add vern-llm
36
36
  ```ts
37
37
  import Anthropic from '@anthropic-ai/sdk';
38
38
  import OpenAI from 'openai';
39
- import { fromAnthropic, VernLLM } from 'vern-llm';
39
+ import { fromAnthropic, fromOpenAI, VernLLM } from 'vern-llm';
40
40
 
41
41
  const llm = new VernLLM({
42
- client: new OpenAI({ apiKey: process.env.OPENAI_API_KEY }),
42
+ client: fromOpenAI(new OpenAI({ apiKey: process.env.OPENAI_API_KEY })),
43
43
  model: 'gpt-4o',
44
44
  maxRetries: 3,
45
45
  timeoutMs: 10_000,
package/dist/index.cjs CHANGED
@@ -3571,6 +3571,20 @@ function fromOpenAICompatible(client, options = {}) {
3571
3571
  }
3572
3572
  } } };
3573
3573
  }
3574
+ /**
3575
+ * Named alias for the OpenAI SDK itself. A raw `new OpenAI(...)` instance
3576
+ * structurally matches most of `LLMClient`, but newer `openai` SDK major
3577
+ * versions have widened `ChatCompletionContentPart` (e.g. adding a `file`
3578
+ * variant) in ways that no longer structurally satisfy VernLLM's
3579
+ * provider-agnostic `ContentBlock[]` on `userContent`, so passing the SDK
3580
+ * instance directly can fail to typecheck depending on the installed
3581
+ * `openai` version. Wrapping with `fromOpenAI()` (a plain alias of
3582
+ * `fromOpenAICompatible()`) sidesteps that by translating through
3583
+ * `unknown` at the boundary, and also picks up multimodal image
3584
+ * translation and `createStream` wiring that a raw client doesn't have.
3585
+ * See Migration Notes for details.
3586
+ */
3587
+ const fromOpenAI = fromOpenAICompatible;
3574
3588
  /** Groqs SDK matches the OpenAI wire format */
3575
3589
  const fromGroq = fromOpenAICompatible;
3576
3590
  /**
@@ -3711,6 +3725,7 @@ exports.fromNebius = fromNebius
3711
3725
  exports.fromNovita = fromNovita
3712
3726
  exports.fromNvidiaNIM = fromNvidiaNIM
3713
3727
  exports.fromOllama = fromOllama
3728
+ exports.fromOpenAI = fromOpenAI
3714
3729
  exports.fromOpenAICompatible = fromOpenAICompatible
3715
3730
  exports.fromOpenRouter = fromOpenRouter
3716
3731
  exports.fromParasail = fromParasail