Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷‍♂️ Conversations: Re-organize conversation code [Part 1] #336

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

alchaplinsky
Copy link
Contributor

Motivation

There's a bunch of conversation-related classes (eg. AIMessage, HumanMessage, ConversationMemory, etc.) that got added to Langchain root namespace. We should scope everything under Langchain::Conversation namespace. And also simplify class naming.

I personally don't think AIMessage and HumanMessage are good names. What if it is a conversation between LLMs? Than HumanMessage doesn't really make sense. It is better to stick to Prompt/Response pattern in naming different message classes even though under the hood Prompt will be sending {role: 'user'} to the API (that is an internal implementation so that's fine).

Changes

  • Move conversation-related classes to lib/langchaing/conversation directory
  • Rename class names:
    • ConversationMemory => Conversation::Memory
    • Message => Conversation::Message
    • HumanMessage => Conversation::Prompt
    • AIMessage => Conversation::Response
    • SystemMessage => Conversation::Context

- Rename HumanMessage, AIMessage and SystemMessage to Prompt, Response, Context
- Reorganize conversation classes: put everything conversatoin related directory
@alchaplinsky alchaplinsky marked this pull request as ready for review October 3, 2023 17:25
@alchaplinsky alchaplinsky self-assigned this Oct 3, 2023
@andreibondarev andreibondarev merged commit 546e016 into main Oct 3, 2023
7 checks passed
@andreibondarev andreibondarev deleted the conversations-1 branch October 3, 2023 18:16
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.

None yet

2 participants