Use max_prompt_size, tokenizer from config for chat model context stuffing

This commit is contained in:
Debanjum Singh Solanky
2023-10-15 16:33:26 -07:00
parent 116595b351
commit df1d74a879
5 changed files with 48 additions and 11 deletions

View File

@@ -116,6 +116,8 @@ def converse(
temperature: float = 0.2,
completion_func=None,
conversation_command=ConversationCommand.Default,
max_prompt_size=None,
tokenizer_name=None,
):
"""
Converse with user using OpenAI's ChatGPT
@@ -141,6 +143,8 @@ def converse(
prompts.personality.format(),
conversation_log,
model,
max_prompt_size,
tokenizer_name,
)
truncated_messages = "\n".join({f"{message.content[:40]}..." for message in messages})
logger.debug(f"Conversation Context for GPT: {truncated_messages}")