You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I load a chat history generated in LM Studio? I see a JSON file at C:\Users\USER\.cache\lm-studio\conversations, but when I tried loading it with applyPromptTemplate I get an error
import fs from "fs";
import path from "path";
import { LMStudioClient } from "@lmstudio/sdk";
const lmstudio = new LMStudioClient();
async function main() {
const model = await lmstudio.llm.load("hermes-3-llama-3.2-3b");
const history = JSON.parse(
fs.readFileSync(path.join(__dirname, "chat_history.json"), "utf-8")
);
model.applyPromptTemplate(history); // history: Invalid input
// Create a text completion prediction
const prediction = model.complete("The meaning of life is");
// Stream the response
for await (const { content } of prediction) {
process.stdout.write(content);
}
}
main();
The text was updated successfully, but these errors were encountered:
Hi. Currently, you will need to read and convert conversation to ChatHistory so it can be fed to the model. We will look into allowing exporting conversations very soon.
Hi. Currently, you will need to read and convert conversation to ChatHistory so it can be fed to the model. We will look into allowing exporting conversations very soon.
I thought I was dumb and somehow missed it in the docs 😅
Are there any examples how to convert conversations?
Sorry, not at the moment. Conversations json files are considered internal data structures to LM Studio and we do not recommend build with them since we might change their structures. However, we will definitely add the feature to export conversations in a format that can be consumed by/continued from by an LLM.
How can I load a chat history generated in LM Studio? I see a JSON file at
C:\Users\USER\.cache\lm-studio\conversations
, but when I tried loading it withapplyPromptTemplate
I get an errorThe text was updated successfully, but these errors were encountered: