ai 3.3.2 → 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.js CHANGED
@@ -1422,7 +1422,7 @@ async function generateObject({
1422
1422
  switch (mode) {
1423
1423
  case "json": {
1424
1424
  const validatedPrompt = getValidatedPrompt({
1425
- system: injectJsonSchemaIntoSystem({
1425
+ system: model.supportsStructuredOutputs ? system : injectJsonSchemaIntoSystem({
1426
1426
  system,
1427
1427
  schema: schema.jsonSchema
1428
1428
  }),
@@ -1463,7 +1463,7 @@ async function generateObject({
1463
1463
  tracer,
1464
1464
  fn: async (span2) => {
1465
1465
  const result2 = await model.doGenerate({
1466
- mode: { type: "object-json" },
1466
+ mode: { type: "object-json", schema: schema.jsonSchema },
1467
1467
  ...prepareCallSettings(settings),
1468
1468
  inputFormat,
1469
1469
  prompt: promptMessages,
@@ -1774,7 +1774,7 @@ async function streamObject({
1774
1774
  switch (mode) {
1775
1775
  case "json": {
1776
1776
  const validatedPrompt = getValidatedPrompt({
1777
- system: injectJsonSchemaIntoSystem({
1777
+ system: model.supportsStructuredOutputs ? system : injectJsonSchemaIntoSystem({
1778
1778
  system,
1779
1779
  schema: schema.jsonSchema
1780
1780
  }),
@@ -1782,7 +1782,7 @@ async function streamObject({
1782
1782
  messages
1783
1783
  });
1784
1784
  callOptions = {
1785
- mode: { type: "object-json" },
1785
+ mode: { type: "object-json", schema: schema.jsonSchema },
1786
1786
  ...prepareCallSettings(settings),
1787
1787
  inputFormat: validatedPrompt.type,
1788
1788
  prompt: await convertToLanguageModelPrompt({