{
 "schema_version": 1,
 "generated": "2026-10-26",
 "id": "goccy-go-llama--serve-many-conversations-from-one-model",
 "repo": "goccy/go-llama",
 "repo_url": "https://github.com/goccy/go-llama",
 "repo_slug": "goccy-go-llama",
 "title": "Run separate chat sessions on one loaded model",
 "page_title": "How to run separate chat sessions on one loaded model with Go Llama",
 "summary": "Load a model once and give each conversation its own context and KV cache.",
 "who": "A developer serving several users or chat sessions from one machine who wants to avoid loading the weights repeatedly.",
 "problem": "Loading a separate model per user would multiply memory use and startup time.",
 "outcome": "One shared model serves independent conversations, each with its own context.",
 "steps": [
  "Call llama.New and LoadModel once at startup and keep the model open.",
  "Call model.NewContext with llama.ContextParams once for each conversation.",
  "Call ctx.Generate for each user's prompt against that user's own context.",
  "Call ctx.Close and model.Close when a session ends or the service shuts down."
 ],
 "agent_prompt": "In the Go service at <project-path>, load <model-file>.gguf once with goccy/go-llama and create one context per session ID. Expected output: two sessions returning responses that each reflect only their own prompt history. Verify that closing one context does not affect generation in the other.",
 "agents": [
  "any"
 ],
 "difficulty": "Advanced",
 "time": "2 hours",
 "basis": "readme",
 "caveat": "The README says contexts keep their own KV cache but does not document a built-in session manager, so you must track which context belongs to which user yourself.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "go",
 "requirements": [
  "A Go toolchain installed on your machine",
  "A GGUF model file, such as model.gguf",
  "Enough memory for the model weights and KV cache, since the README notes wasm32 caps linear memory at 4 GiB"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.8,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/goccy-go-llama/serve-many-conversations-from-one-model/",
 "md": "https://dedupedai.com/use-cases/goccy-go-llama/serve-many-conversations-from-one-model/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/goccy-go-llama--serve-many-conversations-from-one-model.json",
 "api_version": "v1"
}
