-
Notifications
You must be signed in to change notification settings - Fork 44
Allow in-place Chat history editing #86
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
Comments
I was going to mark this as "Good first issue", since the TypeScript SDK offers a starting point for the Python SDK API design, but there are some open design questions that need to be answered before it would really qualify for that marker. There's no specific ETA on resolving those questions (folks that genuinely need this capability aren't blocked by the absence of a supported API, they just need to tinker with the |
The problem with modifying ._messages is that you need to know how the object is structured internally, and there's no guarantee the implementation will remain constant. If you want to allow _messages to be modified, at the very least the internal structure would have to be well-documented in the API / tutorial. |
@NullMagic2 what about creating a an empty Chat object, iterating over the old one and appending / modifying as needed? |
For my own solution, I'm creating my own chat object and then converting to the proper format using Chat.from_history() but that's much slower and less than ideal when compared to simple in-place editing. The reason I do that as opposed to just editing ._messages is because Chat.from_history() is a public documented API, and if I have my own structure, at least I know it'll behave a particular way. |
lmstudio-js
supports in-place Chat history editing via:MaybeMutable
base class).replaceText()
method on saved messages (there are also.appendFile()
andappendText()
methods on messages).replaceSystemPrompt()
method to remove all previously added system prompt messages and insert the given prompt at the start of the chat history.filterInPlace()
method to process all currently saved messages with the given filtering callback.pop()
methodThe Python SDK should offer similar capabilities (although the exact spelling may differ).
The text was updated successfully, but these errors were encountered: