-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathconstants.ts
More file actions
160 lines (148 loc) · 3.53 KB
/
constants.ts
File metadata and controls
160 lines (148 loc) · 3.53 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import type { CustomPrompt } from "./rag-chat";
export const DEFAULT_CHAT_SESSION_ID = "upstash-rag-chat-session";
export const DEFAULT_CHAT_RATELIMIT_SESSION_ID = "upstash-rag-chat-ratelimit-session";
export const RATELIMIT_ERROR_MESSAGE = "ERR:USER_RATELIMITED";
export const DEFAULT_VECTOR_DB_NAME = "upstash-rag-chat-vector";
export const DEFAULT_REDIS_DB_NAME = "upstash-rag-chat-redis";
//Retrieval related default options
export const DEFAULT_SIMILARITY_THRESHOLD = 0.5;
export const DEFAULT_TOP_K = 5;
//History related default options
export const DEFAULT_HISTORY_TTL = 86_400;
export const DEFAULT_HISTORY_LENGTH = 5;
//We need that constant to split creator LLM such as `ChatOpenAI_gpt-3.5-turbo`. Format is `provider_modelName`.
export const MODEL_NAME_WITH_PROVIDER_SPLITTER = "_";
//We need to make sure namespace is not undefined, but "". This will force vector-db to query default namespace.
export const DEFAULT_NAMESPACE = "";
export const DEFAULT_PROMPT: CustomPrompt = ({ context, question, chatHistory }) =>
`You are a friendly AI assistant augmented with an Upstash Vector Store.
To help you answer the questions, a context and/or chat history will be provided.
Answer the question at the end using only the information available in the context or chat history, either one is ok.
-------------
Chat history:
${chatHistory}
-------------
Context:
${context}
-------------
Question: ${question}
Helpful answer:`;
export const DEFAULT_PROMPT_WITHOUT_RAG: CustomPrompt = ({ question, chatHistory }) =>
`You are a friendly AI assistant.
To help you answer the questions, a chat history will be provided.
Answer the question at the end.
-------------
Chat history:
${chatHistory}
-------------
Question: ${question}
Helpful answer:`;
export const OLLAMA_MODELS = [
"llama3.1",
"gemma2",
"mistral-nemo",
"mistral-large",
"qwen2",
"deepseek-coder-v2",
"phi3",
"mistral",
"mixtral",
"codegemma",
"command-r",
"command-r-plus",
"llava",
"llama3",
"gemma",
"qwen",
"llama2",
"codellama",
"dolphin-mixtral",
"nomic-embed-text",
"llama2-uncensored",
"phi",
"deepseek-coder",
"zephyr",
"mxbai-embed-large",
"dolphin-mistral",
"orca-mini",
"dolphin-llama3",
"starcoder2",
"yi",
"mistral-openorca",
"llama2-chinese",
"llava-llama3",
"starcoder",
"vicuna",
"tinyllama",
"codestral",
"wizard-vicuna-uncensored",
"nous-hermes2",
"wizardlm2",
"openchat",
"aya",
"tinydolphin",
"stable-code",
"wizardcoder",
"openhermes",
"all-minilm",
"granite-code",
"codeqwen",
"stablelm2",
"wizard-math",
"neural-chat",
"phind-codellama",
"llama3-gradient",
"dolphincoder",
"nous-hermes",
"sqlcoder",
"xwinlm",
"deepseek-llm",
"yarn-llama2",
"llama3-chatqa",
"starling-lm",
"wizardlm",
"falcon",
"orca2",
"snowflake-arctic-embed",
"solar",
"samantha-mistral",
"moondream",
"stable-beluga",
"dolphin-phi",
"bakllava",
"deepseek-v2",
"wizardlm-uncensored",
"yarn-mistral",
"medllama2",
"llama-pro",
"glm4",
"nous-hermes2-mixtral",
"meditron",
"codegeex4",
"nexusraven",
"llava-phi3",
"codeup",
"everythinglm",
"magicoder",
"stablelm-zephyr",
"codebooga",
"mistrallite",
"wizard-vicuna",
"duckdb-nsql",
"megadolphin",
"falcon2",
"notux",
"goliath",
"open-orca-platypus2",
"notus",
"internlm2",
"llama3-groq-tool-use",
"dbrx",
"alfred",
"mathstral",
"firefunction-v2",
"nuextract",
"bge-m3",
"bge-large",
"paraphrase-multilingual",
] as const;