senlinyy commited on
Commit
0f02f2c
·
1 Parent(s): 40a1863

feat: change model to deepseek

Browse files
Files changed (4) hide show
  1. .env.example +1 -1
  2. README.md +2 -2
  3. backend/config.py +3 -2
  4. backend/main.py +6 -1
.env.example CHANGED
@@ -13,7 +13,7 @@ APP_PASSWORD=change-me
13
  # Default admin passcode is "password"; override this for real deployments.
14
  # ADMIN_PASSCODE=change-me
15
 
16
- LLM_MODEL=Qwen/Qwen2.5-7B-Instruct
17
  EMBED_MODEL=BAAI/bge-small-en-v1.5
18
 
19
  # Leave reasoning hidden in the student UI. Set true only when debugging models
 
13
  # Default admin passcode is "password"; override this for real deployments.
14
  # ADMIN_PASSCODE=change-me
15
 
16
+ LLM_MODEL=deepseek-ai/DeepSeek-V4-Flash
17
  EMBED_MODEL=BAAI/bge-small-en-v1.5
18
 
19
  # Leave reasoning hidden in the student UI. Set true only when debugging models
README.md CHANGED
@@ -18,7 +18,7 @@ pinned: false
18
  - `APP_USERNAME` — defaults to `student`.
19
  - `DATASET_ID` — defaults to `<SPACE_ID>-corpus` on Spaces and is created automatically when needed.
20
  - `ADMIN_PASSCODE` — defaults to `password`; set this for real deployments.
21
- - *(optional)* `LLM_MODEL` — defaults to `Qwen/Qwen2.5-7B-Instruct`.
22
  - *(optional)* `EMBED_MODEL` — defaults to `BAAI/bge-small-en-v1.5`.
23
  4. Restart the Space. Open `/admin`, sign in with the passcode, and upload rubric files (`.pdf`, `.docx`, `.txt`, `.md`).
24
  5. Share the root URL with students. They can paste or upload tutor feedback and upload coursework locally for the chat session.
@@ -92,4 +92,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
92
 
93
  If you use or adapt this tool in your work, please cite:
94
 
95
- Abbas, N. (under review). Investigating Student Perceptions of an AI-Powered Chatbot to Support Feedback Interpretation and Uptake in Higher Education. Manuscript submitted to Assessment and Evaluation in Higher Education.
 
18
  - `APP_USERNAME` — defaults to `student`.
19
  - `DATASET_ID` — defaults to `<SPACE_ID>-corpus` on Spaces and is created automatically when needed.
20
  - `ADMIN_PASSCODE` — defaults to `password`; set this for real deployments.
21
+ - *(optional)* `LLM_MODEL` — defaults to `deepseek-ai/DeepSeek-V4-Flash`; change this Space variable to switch models without a code push.
22
  - *(optional)* `EMBED_MODEL` — defaults to `BAAI/bge-small-en-v1.5`.
23
  4. Restart the Space. Open `/admin`, sign in with the passcode, and upload rubric files (`.pdf`, `.docx`, `.txt`, `.md`).
24
  5. Share the root URL with students. They can paste or upload tutor feedback and upload coursework locally for the chat session.
 
92
 
93
  If you use or adapt this tool in your work, please cite:
94
 
95
+ Abbas, N. (under review). Investigating Student Perceptions of an AI-Powered Chatbot to Support Feedback Interpretation and Uptake in Higher Education. Manuscript submitted to Assessment and Evaluation in Higher Education.
backend/config.py CHANGED
@@ -30,8 +30,10 @@ HF_TOKEN = os.environ.get("HF_TOKEN")
30
  DATASET_ID = os.environ.get("DATASET_ID") or _default_dataset_id()
31
  ADMIN_PASSCODE = os.environ.get("ADMIN_PASSCODE", "password")
32
 
33
- LLM_MODEL = os.environ.get("LLM_MODEL", "Qwen/Qwen2.5-7B-Instruct")
 
34
  LLM_MODEL_LOWER = LLM_MODEL.lower()
 
35
  EMBED_MODEL = os.environ.get("EMBED_MODEL", "BAAI/bge-small-en-v1.5")
36
  LLM_EXTRA_BODY_JSON = os.environ.get("LLM_EXTRA_BODY_JSON", "").strip()
37
  LLM_FINAL_ANSWER_EXTRA_BODY_JSON = os.environ.get(
@@ -55,4 +57,3 @@ BACKEND_INTERNAL_URL = os.environ.get("BACKEND_INTERNAL_URL", f"http://127.0.0.1
55
  TMP_UPLOAD_DIR = Path(os.environ.get("TMP_UPLOAD_DIR", str(REPO_ROOT / ".tmp_uploads")))
56
  LANCEDB_DIR = Path(os.environ.get("LANCEDB_PATH", str(REPO_ROOT / ".lancedb")))
57
  LANCEDB_PATH = str(LANCEDB_DIR)
58
-
 
30
  DATASET_ID = os.environ.get("DATASET_ID") or _default_dataset_id()
31
  ADMIN_PASSCODE = os.environ.get("ADMIN_PASSCODE", "password")
32
 
33
+ DEFAULT_LLM_MODEL = "deepseek-ai/DeepSeek-V4-Flash"
34
+ LLM_MODEL = os.environ.get("LLM_MODEL", DEFAULT_LLM_MODEL).strip() or DEFAULT_LLM_MODEL
35
  LLM_MODEL_LOWER = LLM_MODEL.lower()
36
+ LLM_PROVIDER = os.environ.get("LLM_PROVIDER", "").strip() or None
37
  EMBED_MODEL = os.environ.get("EMBED_MODEL", "BAAI/bge-small-en-v1.5")
38
  LLM_EXTRA_BODY_JSON = os.environ.get("LLM_EXTRA_BODY_JSON", "").strip()
39
  LLM_FINAL_ANSWER_EXTRA_BODY_JSON = os.environ.get(
 
57
  TMP_UPLOAD_DIR = Path(os.environ.get("TMP_UPLOAD_DIR", str(REPO_ROOT / ".tmp_uploads")))
58
  LANCEDB_DIR = Path(os.environ.get("LANCEDB_PATH", str(REPO_ROOT / ".lancedb")))
59
  LANCEDB_PATH = str(LANCEDB_DIR)
 
backend/main.py CHANGED
@@ -45,6 +45,7 @@ TMP_UPLOAD_DIR = config.TMP_UPLOAD_DIR
45
  LANCEDB_DIR = config.LANCEDB_DIR
46
  LLM_MODEL = config.LLM_MODEL
47
  LLM_MODEL_LOWER = config.LLM_MODEL_LOWER
 
48
  EMBED_MODEL = config.EMBED_MODEL
49
  HF_TOKEN = config.HF_TOKEN
50
  LLM_EXTRA_BODY_JSON = config.LLM_EXTRA_BODY_JSON
@@ -193,7 +194,10 @@ async def lifespan(app: FastAPI): # noqa: ARG001
193
  logger.exception("Vector cache restore failed: %s", exc)
194
 
195
  rag = RagEngine()
196
- llm_client = AsyncInferenceClient(model=LLM_MODEL, token=HF_TOKEN)
 
 
 
197
 
198
  personas_store.load()
199
 
@@ -238,6 +242,7 @@ async def health() -> dict:
238
  return {
239
  "ok": True,
240
  "model": LLM_MODEL,
 
241
  "embed_model": EMBED_MODEL,
242
  "dataset_id": config.DATASET_ID,
243
  "admin_passcode_defaulted": config.ADMIN_PASSCODE == "password" and "ADMIN_PASSCODE" not in os.environ,
 
45
  LANCEDB_DIR = config.LANCEDB_DIR
46
  LLM_MODEL = config.LLM_MODEL
47
  LLM_MODEL_LOWER = config.LLM_MODEL_LOWER
48
+ LLM_PROVIDER = config.LLM_PROVIDER
49
  EMBED_MODEL = config.EMBED_MODEL
50
  HF_TOKEN = config.HF_TOKEN
51
  LLM_EXTRA_BODY_JSON = config.LLM_EXTRA_BODY_JSON
 
194
  logger.exception("Vector cache restore failed: %s", exc)
195
 
196
  rag = RagEngine()
197
+ llm_client_kwargs: dict[str, Any] = {"model": LLM_MODEL, "token": HF_TOKEN}
198
+ if LLM_PROVIDER:
199
+ llm_client_kwargs["provider"] = LLM_PROVIDER
200
+ llm_client = AsyncInferenceClient(**llm_client_kwargs)
201
 
202
  personas_store.load()
203
 
 
242
  return {
243
  "ok": True,
244
  "model": LLM_MODEL,
245
+ "provider": LLM_PROVIDER or "auto",
246
  "embed_model": EMBED_MODEL,
247
  "dataset_id": config.DATASET_ID,
248
  "admin_passcode_defaulted": config.ADMIN_PASSCODE == "password" and "ADMIN_PASSCODE" not in os.environ,