-
Notifications
You must be signed in to change notification settings - Fork 330
/
config.py
106 lines (97 loc) · 3.43 KB
/
config.py
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from typing_extensions import TypedDict
class GenerationParams(TypedDict):
max_tokens: int
top_k: int
top_p: float
temperature: float
stop_sequences: list[str]
class EmbeddingConfig(TypedDict):
model_id: str
chunk_size: int
chunk_overlap: int
enable_partition_pdf: bool
# Configure generation parameter for Claude chat response.
# Adjust the values according to your application.
# See: https://docs.anthropic.com/claude/reference/complete_post
DEFAULT_GENERATION_CONFIG: GenerationParams = {
"max_tokens": 2000,
"top_k": 250,
"top_p": 0.999,
"temperature": 0.6,
"stop_sequences": ["Human: ", "Assistant: "],
}
# Ref: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-mistral.html#model-parameters-mistral-request-response
DEFAULT_MISTRAL_GENERATION_CONFIG: GenerationParams = {
"max_tokens": 4096,
"top_k": 250,
"top_p": 0.9,
"temperature": 0.5,
"stop_sequences": ["[INST]", "[/INST]"],
}
# Used for price estimation.
# NOTE: The following is based on 2024-03-07
# See: https://aws.amazon.com/bedrock/pricing/
BEDROCK_PRICING = {
"us-east-1": {
"claude-instant-v1": {
"input": 0.00080,
"output": 0.00240,
},
"claude-v2": {
"input": 0.00080,
"output": 0.00240,
},
"claude-v3-haiku": {"input": 0.00025, "output": 0.00125},
"claude-v3.5-haiku": {"input": 0.001, "output": 0.005},
"claude-v3-sonnet": {"input": 0.00300, "output": 0.01500},
"claude-v3.5-sonnet": {"input": 0.00300, "output": 0.01500},
"claude-v3.5-sonnet-v2": {"input": 0.00300, "output": 0.01500},
"mistral-7b-instruct": {"input": 0.00015, "output": 0.0002},
"mixtral-8x7b-instruct": {"input": 0.00045, "output": 0.0007},
"mistral-large": {"input": 0.008, "output": 0.024},
},
"us-west-2": {
"claude-instant-v1": {
"input": 0.00080,
"output": 0.00240,
},
"claude-v2": {
"input": 0.00080,
"output": 0.00240,
},
"claude-v3-sonnet": {"input": 0.00300, "output": 0.01500},
"claude-v3-opus": {"input": 0.01500, "output": 0.07500},
"mistral-7b-instruct": {"input": 0.00015, "output": 0.0002},
"mixtral-8x7b-instruct": {"input": 0.00045, "output": 0.0007},
"mistral-large": {"input": 0.008, "output": 0.024},
},
"ap-northeast-1": {
"claude-instant-v1": {
"input": 0.00080,
"output": 0.00240,
},
"claude-v2": {
"input": 0.00080,
"output": 0.00240,
},
},
"default": {
"claude-instant-v1": {
"input": 0.00080,
"output": 0.00240,
},
"claude-v2": {
"input": 0.00080,
"output": 0.00240,
},
"claude-v3-haiku": {"input": 0.00025, "output": 0.00125},
"claude-v3.5-haiku": {"input": 0.001, "output": 0.005},
"claude-v3-sonnet": {"input": 0.00300, "output": 0.01500},
"claude-v3.5-sonnet": {"input": 0.00300, "output": 0.01500},
"claude-v3.5-sonnet-v2": {"input": 0.00300, "output": 0.01500},
"claude-v3-opus": {"input": 0.01500, "output": 0.07500},
"mistral-7b-instruct": {"input": 0.00015, "output": 0.0002},
"mixtral-8x7b-instruct": {"input": 0.00045, "output": 0.0007},
"mistral-large": {"input": 0.008, "output": 0.024},
},
}