@ai-sdk%2Fgoogle@3.0.73.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. diff --git a/dist/index.js b/dist/index.js
  2. index 546bf5509004510b023212d70b4c0875a24eb302..f211dcb23e01a393f7d5c6221bfb0ef52276520a 100644
  3. --- a/dist/index.js
  4. +++ b/dist/index.js
  5. @@ -636,6 +636,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
  6. }
  7. }).filter((part) => part !== void 0)
  8. });
  9. + if (contents[contents.length - 1].parts.length === 0) {
  10. + contents.pop();
  11. + }
  12. break;
  13. }
  14. case "tool": {
  15. diff --git a/dist/index.mjs b/dist/index.mjs
  16. index 5c8c20cbbcd4d398523602dd80ae8c3fa10a84ea..f89dc53b3b9cd83653a66b0900ff0bc34d3d6c9f 100644
  17. --- a/dist/index.mjs
  18. +++ b/dist/index.mjs
  19. @@ -642,6 +642,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
  20. }
  21. }).filter((part) => part !== void 0)
  22. });
  23. + if (contents[contents.length - 1].parts.length === 0) {
  24. + contents.pop();
  25. + }
  26. break;
  27. }
  28. case "tool": {
  29. diff --git a/dist/internal/index.js b/dist/internal/index.js
  30. index 947af6f4282f1bb9b46a76fdf199d7155600b550..22c2faa4122069d868a3232bbb708fdc808bf6e8 100644
  31. --- a/dist/internal/index.js
  32. +++ b/dist/internal/index.js
  33. @@ -419,6 +419,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
  34. }
  35. }).filter((part) => part !== void 0)
  36. });
  37. + if (contents[contents.length - 1].parts.length === 0) {
  38. + contents.pop();
  39. + }
  40. break;
  41. }
  42. case "tool": {
  43. diff --git a/dist/internal/index.mjs b/dist/internal/index.mjs
  44. index 28853288c1ff8f589448e7ddcddfd8ed36c4d995..4ef91ed90008d2cf7a5f24bb1927a9884e352393 100644
  45. --- a/dist/internal/index.mjs
  46. +++ b/dist/internal/index.mjs
  47. @@ -402,6 +402,9 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
  48. }
  49. }).filter((part) => part !== void 0)
  50. });
  51. + if (contents[contents.length - 1].parts.length === 0) {
  52. + contents.pop();
  53. + }
  54. break;
  55. }
  56. case "tool": {
  57. diff --git a/src/convert-to-google-generative-ai-messages.ts b/src/convert-to-google-generative-ai-messages.ts
  58. index 4bf83e3768d4ccc8ff96e7d683abb4ccf60387ea..f257d2af8f178b7ac36771296eaa6c60c92e04ab 100644
  59. --- a/src/convert-to-google-generative-ai-messages.ts
  60. +++ b/src/convert-to-google-generative-ai-messages.ts
  61. @@ -350,3 +350,8 @@ export function convertToGoogleGenerativeAIMessages(
  62. })
  63. .filter(part => part !== undefined),
  64. });
  65. + // Empty text and reasoning parts, including signature-bearing ones, are
  66. + // filtered above. Do not emit a model entry that Gemini rejects.
  67. + if (contents[contents.length - 1].parts.length === 0) {
  68. + contents.pop();
  69. + }