Skip to content

We need to support the message which is not included in the history #647

@weburnit

Description

@weburnit

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to look for a similar issue and didn't find it.
  • I searched the Marvin documentation for this feature.

Describe the current behavior

While working with a long chain of AIApplication, the history of achain cause context overflow

    async def achain(self, **kwargs: Any) -> Conversation[T]:
        """
        Create a new Conversation object asynchronously.
        """
        with self as conversation:
            await conversation.asend(**kwargs)
            while conversation.last_turn.has_function_call():
                message = conversation.last_turn.call_function()
                await conversation.asend(
                    message if isinstance(message, list) else [message],
                )

            return conversation

Describe the proposed behavior

Ideally, we need to support the Turn class to exclude some messages in self.history to avoid context overflow.
in some cases, the last message inside While-loop doesn't need asend() to be called

Example Use

async def crawl_website(url) -> Message:
   return Message(disable_history=True, content=website_content)

Additional context

By having that, I think we can save the cost while working with large AiApplication.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions