From 0ba6487e216861ab444b5693f2313f680dc726a1 Mon Sep 17 00:00:00 2001 From: jpal91 Date: Mon, 2 Oct 2023 13:39:26 -0400 Subject: [PATCH] Added new default to system chat messages --- tests/xontrib_chatgpt/test_chatgpt.py | 1 - xontrib_chatgpt/chatgpt.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/xontrib_chatgpt/test_chatgpt.py b/tests/xontrib_chatgpt/test_chatgpt.py index b6c55ba..ebc26ab 100644 --- a/tests/xontrib_chatgpt/test_chatgpt.py +++ b/tests/xontrib_chatgpt/test_chatgpt.py @@ -87,7 +87,6 @@ def test_alias_creation(xession): def test_defualt_attribs(xession, chat): - assert chat.base == [{"role": "system", "content": "You are a helpful assistant."}] assert chat.messages == [] assert chat._tokens == [] assert chat._max_tokens == 3000 diff --git a/xontrib_chatgpt/chatgpt.py b/xontrib_chatgpt/chatgpt.py index c4b46ea..e6ee23e 100644 --- a/xontrib_chatgpt/chatgpt.py +++ b/xontrib_chatgpt/chatgpt.py @@ -108,7 +108,8 @@ def __init__(self, alias: str = "") -> None: self.alias = alias self.base: list[dict[str, str]] = [ - {"role": "system", "content": "You are a helpful assistant."} + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "system", "content": "If your responses include code, make sure to wrap it in a markdown code block with the appropriate language. \n Example: \n ```python \n print('Hello World!') \n ```"}, ] self.messages: list[dict[str, str]] = [] self._tokens: list = []