jan
jan copied to clipboard
feat: Threads can override and inherit default params from Assistants, Models, and Engine
Tasks
- [x] Eng Spec @dan-jan
- [ ] Local Models
- [ ] Remote Models (KIV)
- [x] janhq/internal#66
- Functionality
- [x] Each Recommended Model should have default values defined in respective
model.json
- [x] Each Recommended Model should have default values defined in respective
- Documentation
- [ ] Architecture section should contain page on relationship between
Threads
,Assistants
,Models
,Engines
. - [ ] Docs page on Models Extension,
- [ ] Docs page on Inference Extension
- [ ] Docs page on Engine extensions
- [ ] Architecture section should contain page on relationship between
- [ ] API Reference (i.e. Swaggerfile)
- [ ]
model.json
params are well documented in Swaggerfile - [ ]
assistant.json
params are well documented in Swaggerfile - [ ]
engine.json
params are well documented in Swaggerfile
- [ ]
Spec
Overview
- Threads are a core primitive in Jan, and the main means by which a user will interact with AI
- A Thread is defined as an exchange between a User and an Assistant
- A thread uses default params that are specified for that Assistant (and its associated Model(s) and Engine(s))
- A user may choose to override these default params
- Assistant params are inherited from
assistant.json
- Model params are inherited from the
assistant.model
'smodel.json
- Engine params are inherited from
model.engine
'sengine.json
- The Thread UI offers an optional, slide-in "Right Panel" that allows the user to tinker and change params
- Any user-specified, thread-level params are persisted in an associated
thread.json
-
thread.json
is usually empty, as it auto-inherits properties from the associated defaults
- Any user-specified, thread-level params are persisted in an associated
- The Thread UI should prompt the user to "Reload" the model + engine if required
- Model Params and Engine Params will usually require reload
- We should find way to "automatically" reload it, if user sends new message to Assistant
Wireframes
Excalidraw: https://link.excalidraw.com/l/kFY0dI05mm/3WHim5p2OLu
We should ideally capture most if not all of the Model and Inference Engine settings, that Oobabooga, and etc avail.
See LiteLLM's approach to prefix, suffix and roles and prompt templates
https://github.com/abetlen/llama-cpp-python/issues/717#issuecomment-1722093969
One question is also whether there should be a "Hardware Settings", e.g. for Apple Silicon users? Is this also present for other types of Hardware - e.g. Intel, etc.
https://www.reddit.com/r/LocalLLaMA/comments/186phti/m1m2m3_increase_vram_allocation_with_sudo_sysctl/
@dan-jan for current release there will be no different in settings for different hardwares, mostly already automatically handled at build time
important asset reference for prompt template: https://github.com/mounta11n/plusplus-caMalL/blob/4fa32ad0e3b61a6e13cdb6261723b6fd608a0fad/examples/server/public/promptFormats.js#L15
Q:Where are these prompt template coming from? Most of community projects now using TheBloke metadata as referrence, example.
https://huggingface.co/TheBloke/LLaMA2-13B-Psyfighter2-AWQ#prompt-template-alpaca-tiefighter
We will have 2 main modes: LOCAL and REMOTE
LOCAL
REMOTE
Link to excalid draw: https://excalidraw.com/#json=kOBPg9OoLTCLAm3JO7FHn,qV29wMh7fLvGkFXf5HRYNA
Asks:
- Can we the settings properties in swagger/json schema (with validation, etc).
- A list of prompt templates (so users can have a dropdown selector)
schema fields
id:
type:
required: boolean
data_validation: {
min:
max:
}
default:
information: // (i) that tells users what this field actually does
Discussion updates, mostly as a reminder/reference for @imtuyethan
Based on: https://app.excalidraw.com/s/kFY0dI05mm/3WHim5p2OLu
- Assistant Section: Add back the model selector
- Users should be able to choose a model to chat with when using Jan assistant.
- Remember: users can only change models at the beginning of a thread, not after thread has started
- So we need to also show a change-model-disabled-state in designs.
- Remember: the model determines the variables in the next sections:
inference parameters
,model params
engine params
content may change depending on the model chosen.
- Users can change
Assistant Instructions
aka thesystem message
- Users can edit assistant instructions after conversation starts.
- We briefly discussed sending a new “system message updated... etc.” In the MainPanel. Ashley will play around with a potential design for it.
- The
system message
may show up in MainPane differently, not as a regular message sent from the user, but as a little box/styled differently? - Again, this is a nice to have. It's possible we don't show anything related to it in the MainView at all
- We shouldn't auto save when users edit each field. We should make users click a global
save
button, which saves all sections at once.
- Reason: reduce fs writes to
thread.json
- See (4)
- Users must restart model after editting
model_params
orengine_parameters
- If users edit
model_parameters
&engine_parameters
, then they have tosave & restart model
, a two step process. @imtuyethan will play around with how the designs communicate this. - These 2 sections should say “requires model restart” somewhere...
-
Alan is working on parameter fields, like mins/max/etc.
-
Model Parameters
section UI
- “Prompt Template” is a drop down where ppl can choose from different templates
- Example 1: https://huggingface.co/TheBloke/meditron-7B-GPTQ#prompt-template-chatml
- Example 2: https://huggingface.co/TheBloke/SlimOrca-13B-GGUF#prompt-template-ajibawa-assistant
- UI wise, just show the
prompt template
as in a plain text box. Advanced users can directly edit the text. Do not highlight : “{prompt}” “{system_message}”, or do anything fancy like Daniel suggested XD. - Have a reset button so ppl can undo if they mess up. Reset button goes back to assistant.json defaults
-
Actually play around with having a reset button for each sections, at the section level (not global)
-
@Rex make sure every model has a prompt template filled in
-
Alan TODO later: low fidelity mock on how “model.json settings is different than thread.model.json settings”
-
Remote model side panel - we didn't discuss this as much. Punt till later
@imtuyethan
A note on the menu items, I saw that we currently open up model.json
assistant.json
when users click "Reveal in Finder/JSON" in all the sections.
It should be
- Every section: "Reveal in finder/View as JSON": opens `threads.json
- "Change Default*** Model/Assistant Settings": opens Model/Assistant settings page
@imtuyethan , please help to verify this. cc @louis-jan