Skip to content

feat: Add most recent chat history to system prompt - #48

Open
Karrenbelt wants to merge 1 commit into
mainfrom
feat/chat_history
Open

Karrenbelt wants to merge 1 commit into
mainfrom
feat/chat_history

Conversation

@Karrenbelt

Copy link
Copy Markdown
Collaborator

No description provided.

Comment on lines +100 to +112
def get_chat_history(context) -> tuple[str, set[str]]:
"""Get most recent telegram chat history."""
authors = set()
messages = []
for text in reversed(context.asylum_strategy.chat_history):
if bot_match := BOT_PATTERN.search(text):
authors.add(bot_match.group(1))
messages.append(text)
else:
authors.add("Human")
messages.append(f"Human agent says:\n{text}")
agent_conversation = "\n\n".join(f"{i}. {msg}" for i, msg in enumerate(messages))
return agent_conversation, authors

@Karrenbelt Karrenbelt Mar 18, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved this out, as we can use it for both the system prompt (adding most recent telegram history) as well as README.md generation. Tho I have reversed the iteration of the queue, so now most recent is on top instead of bottom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant