-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcustom_models.py
More file actions
82 lines (68 loc) · 1.93 KB
/
Copy pathcustom_models.py
File metadata and controls
82 lines (68 loc) · 1.93 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""Custom model presets for Z.AI API with different parameters."""
CREATIVE_WRITER = {
"model": "glm-4.5v",
"temperature": 1.2,
"top_p": 0.9,
"max_tokens": 4000,
"description": "Creative writing with high randomness"
}
CODE_ASSISTANT = {
"model": "0727-360B-API",
"temperature": 0.2,
"top_p": 0.7,
"max_tokens": 8000,
"description": "Precise code generation and debugging"
}
BALANCED_CHAT = {
"model": "glm-4.5v",
"temperature": 0.7,
"top_p": 0.8,
"max_tokens": 2000,
"description": "Balanced conversational responses"
}
RESEARCH_ASSISTANT = {
"model": "0727-360B-API",
"temperature": 0.4,
"top_p": 0.85,
"max_tokens": 6000,
"description": "Thorough research and analysis"
}
BRAINSTORMER = {
"model": "glm-4.5v",
"temperature": 1.5,
"top_p": 0.95,
"max_tokens": 3000,
"description": "Creative brainstorming and ideation"
}
CONSERVATIVE = {
"model": "0727-360B-API",
"temperature": 0.1,
"top_p": 0.5,
"max_tokens": 1500,
"description": "Conservative, factual responses"
}
CUSTOM_PRESETS = {
"creative": CREATIVE_WRITER,
"code": CODE_ASSISTANT,
"balanced": BALANCED_CHAT,
"research": RESEARCH_ASSISTANT,
"brainstorm": BRAINSTORMER,
"conservative": CONSERVATIVE
}
def get_preset(name: str) -> dict:
"""
Get a custom preset by name.
Args:
name (str): The name of the preset to retrieve.
Returns:
dict: The preset dictionary corresponding to the given name.
If the name is not found, returns the BALANCED_CHAT preset.
"""
return CUSTOM_PRESETS.get(name.lower(), BALANCED_CHAT)
def list_presets() -> list:
"""
List all available preset names.
Returns:
list: A list of all available preset names as strings.
"""
return list(CUSTOM_PRESETS.keys())