[feature] chat history summarization and command result display
Become a 10x Instagrammer and Escape Brainrot with Instagram CLI
Brought to you by:
jetc
Originally created by: endernoke
:summarize (:s): Get message summary with local LLM:help, :summarize will be displayed and wait for key press before being dismissed. This is to prevent the issue of not having enough time to read long informational results before they time out (usually after a few seconds).
Originally posted by: HaysonC
Thanks for the PR! This looks like a great addition. I have a few questions to help me understand it better:
Also, this seems like a great candidate for a plugin architecture rather than a core component, which is semi-related to my issue [#114]. What are your thoughts on that?
Related
Tickets:
#114Originally posted by: endernoke
Yes exactly this would be a perfect example of a plugin. I suppose since it's a stand-alone feature we can refactor when the plugin architecture is implemented. Right now we're trying to get some AI features shipped mainly for next round of marketing/promotion lol.
Users would need to download and set up their own local LLM for inference e.g. via
ollama serve, then provide their inference endpoint to the InstagramCLI configuration. I've added docs for setting this up to README.Currently available endpoints are:
llm.endpoint: openai-compatible inference endpointllm.model: optional model used for summarizationllm.api_key: optional api key for remote inference (might be desirable to switch to an environment variable for this config instead)I forgot to add system prompt to the configs lol, will do it later.
Currently the chat completions API is used i.e.
.../v1/chat/completions. You can find the implementation ininstagram/chat_ui/utils/chat_commands.py. I'd greatly appreciate insights into this since I'm not very familiar with local inferencing 😄Originally posted by: supreme-gg-gg
Regarding images it is very feasible because we can just fetch the images like we do with the download command and convert to base64, then put them in the right ChatML format and send to the model in the exact same way (or might need to use the OpenAI type instead?):
I'm not entirely sure as to how much more compute would be required for using vision though.
We also would need to update config where the user needs to specify if their model supports vision, and add a flag in the
:summarizecommand like--visionto indicate if we should include images.however, this is not urgent at all we can let it rot 😄
Originally posted by: supreme-gg-gg
I realised the inline config is never implemented and added that, so users can configure stuff like llm endpoints without having to exit the chat interface with
:config llm.endpoint=somethingOriginally posted by: supreme-gg-gg
Also added a support for streaming (
llm.streaming) by allowing commands to return eitherstr | Generator, helpful if some model takes very long to generator and especially in the future if we want more complex AI workflow, would be great if @endernoke you can review everything and mergeOriginally posted by: endernoke
Not sure too lol haven't tried vision in local inferencing
Yea I guess we're entitled to borrowing some technical debt credits for now 😂 I think to support chat command flags we also need to revamp the existing command registry a bit.
Originally posted by: endernoke
All changes lgtm 😄
Ticket changed by: endernoke