ai 3.3.1 → 3.3.3

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.mjs CHANGED
@@ -1331,7 +1331,7 @@ async function generateObject({
1331
1331
  switch (mode) {
1332
1332
  case "json": {
1333
1333
  const validatedPrompt = getValidatedPrompt({
1334
- system: injectJsonSchemaIntoSystem({
1334
+ system: model.supportsStructuredOutputs ? system : injectJsonSchemaIntoSystem({
1335
1335
  system,
1336
1336
  schema: schema.jsonSchema
1337
1337
  }),
@@ -1372,7 +1372,7 @@ async function generateObject({
1372
1372
  tracer,
1373
1373
  fn: async (span2) => {
1374
1374
  const result2 = await model.doGenerate({
1375
- mode: { type: "object-json" },
1375
+ mode: { type: "object-json", schema: schema.jsonSchema },
1376
1376
  ...prepareCallSettings(settings),
1377
1377
  inputFormat,
1378
1378
  prompt: promptMessages,
@@ -1686,7 +1686,7 @@ async function streamObject({
1686
1686
  switch (mode) {
1687
1687
  case "json": {
1688
1688
  const validatedPrompt = getValidatedPrompt({
1689
- system: injectJsonSchemaIntoSystem({
1689
+ system: model.supportsStructuredOutputs ? system : injectJsonSchemaIntoSystem({
1690
1690
  system,
1691
1691
  schema: schema.jsonSchema
1692
1692
  }),
@@ -1694,7 +1694,7 @@ async function streamObject({
1694
1694
  messages
1695
1695
  });
1696
1696
  callOptions = {
1697
- mode: { type: "object-json" },
1697
+ mode: { type: "object-json", schema: schema.jsonSchema },
1698
1698
  ...prepareCallSettings(settings),
1699
1699
  inputFormat: validatedPrompt.type,
1700
1700
  prompt: await convertToLanguageModelPrompt({