Skip to content

Conversation History

Conversation History

The get_conversation() function allows you to retrieve the conversation history for a specific conversation in Blipper. This function takes the conversation ID as a parameter and returns the conversation history, including messages exchanged between the user and the agent.

1
2
3
4
5
from blipper import Blipper

blip_obj = Blipper(blipper_api_key="lqqRYOOnSerIOP973hjskR", model="galileo", verbose=False)

messages: list = blip_obj.get_conversation(conversation_id="my_conversation_id")

Note

If you obtain an empty list, it means that no messages have been added to the conversation yet. You can learn how to add messages in the next section. Please see the Add message to a conversation section.

The messages variable will contain a list where each item represents a message exchanged between the user and the agent. Each message object contains the following attributes:

  • role: Specifies the role of the sender (e.g., "user" or "agent").
  • content: Contains the content of the message exchanged.
[
    {"role": "user", "content": "I'd like to order a pizza."},
    {"role": "agent", "content": "Sure! What toppings would you like on your pizza?"},
    {"role": "user", "content": "I'd like pepperoni and mushrooms, please."},
    {"role": "agent", "content": "Great choice! Your order has been placed."},
]