v1.8
Browse filesUpdate Context Window Logic
- modules/pmbl.py +3 -3
modules/pmbl.py
CHANGED
@@ -122,10 +122,10 @@ class PMBL:
|
|
122 |
self.save_chat_history(prompt, response_text)
|
123 |
|
124 |
def calculate_context(self, system_prompt, formatted_history):
|
125 |
-
system_prompt_tokens = len(system_prompt) //
|
126 |
-
history_tokens = len(formatted_history) //
|
127 |
max_response_tokens = 1500
|
128 |
-
context_ceiling =
|
129 |
|
130 |
available_tokens = context_ceiling - system_prompt_tokens - max_response_tokens
|
131 |
if history_tokens <= available_tokens:
|
|
|
122 |
self.save_chat_history(prompt, response_text)
|
123 |
|
124 |
def calculate_context(self, system_prompt, formatted_history):
|
125 |
+
system_prompt_tokens = len(system_prompt) // 4
|
126 |
+
history_tokens = len(formatted_history) // 4
|
127 |
max_response_tokens = 1500
|
128 |
+
context_ceiling = 32690
|
129 |
|
130 |
available_tokens = context_ceiling - system_prompt_tokens - max_response_tokens
|
131 |
if history_tokens <= available_tokens:
|