Spaces:
Paused
Paused
Download src/lib/utils/rag/index.ts from coteerratu/open-webui: direct link, hf CLI and curl.
- Browser
- Download file 828 Bytes
-
https://huggingface.co/spaces/coteerratu/open-webui/resolve/main/src/lib/utils/rag/index.ts
- Command line
-
hf download hf://spaces/coteerratu/open-webui/src/lib/utils/rag/index.ts
-
curl -L -o index.ts https://huggingface.co/spaces/coteerratu/open-webui/resolve/main/src/lib/utils/rag/index.ts
828 Bytes
| import { getRAGTemplate } from '$lib/apis/retrieval'; | |
| export const RAGTemplate = async (token: string, context: string, query: string) => { | |
| let template = await getRAGTemplate(token).catch(() => { | |
| return `Use the following context as your learned knowledge, inside <context></context> XML tags. | |
| <context> | |
| [context] | |
| </context> | |
| When answer to user: | |
| - If you don't know, just say that you don't know. | |
| - If you don't know when you are not sure, ask for clarification. | |
| Avoid mentioning that you obtained the information from the context. | |
| And answer according to the language of the user's question. | |
| Given the context information, answer the query. | |
| Query: [query]`; | |
| }); | |
| template = template.replace(/\[context\]/g, context); | |
| template = template.replace(/\[query\]/g, query); | |
| return template; | |
| }; | |