@voltagent/core 1.1.32 → 1.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.js CHANGED
@@ -14280,20 +14280,23 @@ function toContextMap(context8) {
14280
14280
  return context8 instanceof Map ? context8 : new Map(Object.entries(context8));
14281
14281
  }
14282
14282
  __name(toContextMap, "toContextMap");
14283
- function stripExcessiveFieldsInUIMessages(uiMessages) {
14284
- function isTextUIPart(p) {
14285
- return typeof p === "object" && p !== null && p.type === "text";
14286
- }
14287
- __name(isTextUIPart, "isTextUIPart");
14288
- return uiMessages.map((msg) => {
14289
- if (!Array.isArray(msg.parts)) return msg;
14290
- const parts = msg.parts?.map(
14291
- (part) => isTextUIPart(part) ? { type: "text", text: part.text } : part
14292
- );
14293
- return { ...msg, parts };
14283
+ var convertToModelMessagesFix = /* @__PURE__ */ __name((uiMessages) => {
14284
+ return renameProviderOptions((0, import_ai4.convertToModelMessages)(uiMessages));
14285
+ }, "convertToModelMessagesFix");
14286
+ function renameProviderOptions(messages) {
14287
+ return messages.map((msg) => {
14288
+ if (!Array.isArray(msg.content)) return msg;
14289
+ const content = msg.content.map((part) => {
14290
+ if (part && typeof part === "object" && "providerOptions" in part) {
14291
+ const { providerOptions, ...rest } = part;
14292
+ return { ...rest, providerMetadata: providerOptions };
14293
+ }
14294
+ return part;
14295
+ });
14296
+ return { ...msg, content };
14294
14297
  });
14295
14298
  }
14296
- __name(stripExcessiveFieldsInUIMessages, "stripExcessiveFieldsInUIMessages");
14299
+ __name(renameProviderOptions, "renameProviderOptions");
14297
14300
  function cloneGenerateTextResultWithContext(result, overrides) {
14298
14301
  const prototype = Object.getPrototypeOf(result);
14299
14302
  const clone = Object.create(prototype);
@@ -15347,7 +15350,7 @@ var Agent = class {
15347
15350
  const buffer = this.getConversationBuffer(oc);
15348
15351
  const uiMessages = await this.prepareMessages(input, oc, options, buffer);
15349
15352
  const hooks = this.getMergedHooks(options);
15350
- let messages = (0, import_ai4.convertToModelMessages)(stripExcessiveFieldsInUIMessages(uiMessages));
15353
+ let messages = convertToModelMessagesFix(uiMessages);
15351
15354
  if (hooks.onPrepareModelMessages) {
15352
15355
  const result = await hooks.onPrepareModelMessages({
15353
15356
  modelMessages: messages,
@@ -15982,7 +15985,7 @@ ${toolkit.instructions}`;
15982
15985
  }
15983
15986
  });
15984
15987
  try {
15985
- const retrieverInput = typeof input === "string" ? input : Array.isArray(input) && input[0]?.content !== void 0 ? input : (0, import_ai4.convertToModelMessages)(stripExcessiveFieldsInUIMessages(input));
15988
+ const retrieverInput = typeof input === "string" ? input : Array.isArray(input) && input[0]?.content !== void 0 ? input : convertToModelMessagesFix(input);
15986
15989
  const retrievedContent = await oc.traceContext.withSpan(retrieverSpan, async () => {
15987
15990
  if (!this.retriever) return null;
15988
15991
  return await this.retriever.retrieve(retrieverInput, {