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

Handling of messages #29

Open
jtpio opened this issue Jan 24, 2025 · 4 comments
Open

Handling of messages #29

jtpio opened this issue Jan 24, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@jtpio
Copy link
Member

jtpio commented Jan 24, 2025

Problem

Currently it looks like some providers recreate a list of messages for each completion request, for example:

const messages = [
new SystemMessage(
'You are a code-completion AI completing the following code from a Jupyter Notebook cell.'
),
new AIMessage(trimmedPrompt)
];

Should be persisted per provider instead?

Proposed Solution

Should this list of messages be shared across providers? Or should it be reset when a user switches to another provider?

Maybe a reset would be fine to keep things tidy. Also users probably wouldn't change providers often in practice?

Additional context

This would also be relevant to other providers like #27.

@jtpio jtpio added the enhancement New feature or request label Jan 24, 2025
@brichet
Copy link
Collaborator

brichet commented Jan 24, 2025

The providers could also be improved by adding some context, like the existing code (in the cell, in the Notebook...).
But it would increase (a lot) the size of the completion requests.

@jtpio
Copy link
Member Author

jtpio commented Jan 24, 2025

But it would increase (a lot) the size of the completion requests.

Indeed. Maybe that's something langchain can make easier to work with (would need to double check).

@jtpio
Copy link
Member Author

jtpio commented Jan 24, 2025

Also, it looks like the current use of AIMessage could be replaced by HumanMessage (https://js.langchain.com/docs/concepts/messages/#humanmessage) since the related message is coming from a user?

@brichet
Copy link
Collaborator

brichet commented Jan 27, 2025

Yes, the idea was to let the AI complete the sentence as if it had started it (I may have read that hack somewhere but can't find it again).

Indeed, with more context in an initial SystemMessage (like what is started here), we could switch to a HumanMessage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants