Skip to content

Chat history in notebook magics for Chat model providers #392

Open
@3coins

Description

@3coins

Problem

The current magics implementation is using an artificial list of chat message history to keep track of exchanges between 2 or more cells when openai-chat model is used. Although, this might have the appearance of working as expected for OpenAI, this is not translatable and scalable to other chat model providers, for example ChatAnthropic.

Solution

Create a conversation chain and memory to generate messages for providers that support BaseChatModel. Using the memory class in an LLM chain automatically keeps track of message history and avoid manual tracking of exchanges. This also helps in future proofing the magics implementation for new chat providers that will be introduced in future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs reported by userspriority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions