-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathconfig.py
More file actions
43 lines (33 loc) · 1.72 KB
/
Copy pathconfig.py
File metadata and controls
43 lines (33 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Server configuration: the OpenAI-facing model names and what they map to."""
import os
# Requests per minute allowed per client IP (override with RATE_LIMIT_PER_MINUTE).
RATE_LIMIT_PER_MINUTE = int(os.getenv("RATE_LIMIT_PER_MINUTE", "30"))
# When the server has no session, should it pop a visible browser window for
# interactive sign-in (the first request then blocks until you finish logging
# in)? On by default for local single-user use. Set to "0"/"false" for headless
# deployments, where it instead returns a 503 telling the caller to run
# `python -m deepseek.auth`.
SERVER_INTERACTIVE_LOGIN = os.getenv("SERVER_INTERACTIVE_LOGIN", "1").lower() not in (
"0", "false", "no", "off",
)
# Public model ids the server advertises (via /v1/models) and accepts, mapped to
# DeepSeek's `model_type` wire value. This is the MODEL axis ONLY — it picks
# which model answers. DeepThink and web Search are orthogonal tools requested
# per call via `tool_names` (see deepseek.client.KNOWN_TOOLS), never encoded in
# the model name.
#
# "vision" is deferred: it only does anything with an image attached, which needs
# ref_file_ids / file-upload plumbing we don't have yet.
MODEL_MAP = {
"deepseek-chat": "default", # Instant — the fast default model
"deepseek-expert": "expert", # Expert — the stronger, slower model
}
DEFAULT_MODEL = "deepseek-chat"
def is_known_model(name: str) -> bool:
"""Whether `name` is a model id we accept (used to 404 unknown models)."""
return name in MODEL_MAP
def resolve_model_type(name: str) -> str:
"""Translate a public model id to DeepSeek's `model_type` wire value.
Caller must check `is_known_model` first; this raises KeyError otherwise.
"""
return MODEL_MAP[name]