marvin
marvin copied to clipboard
We need to support the message which is not included in the history
First check
- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to look for a similar issue and didn't find it.
- [X] 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.