Context
We have two types of context:
Plain View: This is unencrypted and uncompressed.
Compressed View: Used to save memory, especially useful for large chat histories or when storing multiple chat histories.
Plain View
from zerogpt import Client
history = [{
'role': 'system',
'content': 'You are a psychologist with 20 years of experience.'
},
{
'role': 'assistant',
'content': 'Hello! How can I assist you today?'
},
{
'role': 'user',
'content': 'Hello'
}]
client = Client()
print(client.send_message(history))
Compressed View
from zerogpt import Client
from zerogpt.utils.prompt import Dummy
history = [{
'role': 'system',
'content': 'You are a psychologist with 20 years of experience.'
},
{
'role': 'assistant',
'content': 'Hello! How can I assist you today?'
},
{
'role': 'user',
'content': 'Hello'
}]
client = Client()
dummy = Dummy(log=True)
dummy.create(messages=history)
print(client.send_message(dummy))
You can also save and load compressed history.
dummy = Dummy(log=True)
dummy.create(messages=history)
dummy.save()
dummy.load()
Last updated
Was this helpful?