Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
add tool cals model
Browse files- .env.local.template +54 -2
- Dockerfile +2 -0
.env.local.template
CHANGED
@@ -19,8 +19,28 @@ OPENID_SCOPES="openid profile" # Add "email" for some providers like Google that
|
|
19 |
OPENID_PROVIDER_URL=https://huggingface.co # for Google, use https://accounts.google.com
|
20 |
|
21 |
PUBLIC_APP_DESCRIPTION="This is a prompt system compliance test of the latest 7b model in development at BSC, code name Salamandra. No personal information is saved."
|
22 |
-
COMMUNITY_TOOLS=
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
# 'name', 'userMessageToken', 'assistantMessageToken' are required
|
25 |
MODELS=`[
|
26 |
{
|
@@ -55,6 +75,38 @@ MODELS=`[
|
|
55 |
"extraBody":{
|
56 |
"presence_penalty":-0.9
|
57 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
]`
|
60 |
#Repetition penality = presence_penalty + 2
|
|
|
19 |
OPENID_PROVIDER_URL=https://huggingface.co # for Google, use https://accounts.google.com
|
20 |
|
21 |
PUBLIC_APP_DESCRIPTION="This is a prompt system compliance test of the latest 7b model in development at BSC, code name Salamandra. No personal information is saved."
|
22 |
+
COMMUNITY_TOOLS=true
|
23 |
+
ENABLE_ASSISTANTS=true
|
24 |
+
TOOLS=`[
|
25 |
+
{
|
26 |
+
"name": "getContext",
|
27 |
+
"description": "Return relevant documents from the Entitat Autònoma del Diari Oficial i de Publicacions (EADOP).",
|
28 |
+
"color": "red",
|
29 |
+
"icon": "chat",
|
30 |
+
"baseUrl": "BSC-LT/VECTOR_STORE_EADOP",
|
31 |
+
"endpoint": "/get-eadop-rag",
|
32 |
+
"outputComponent": "textbox",
|
33 |
+
"displayName":"RAG EADOP",
|
34 |
+
"outputComponentIdx": 0,
|
35 |
+
"inputs":[
|
36 |
+
{"name":"prompt", "paramType":"required", "type":"str"},
|
37 |
+
{ name: 'num_chunks', paramType: 'fixed', value: '2', type: 'float' }
|
38 |
+
],
|
39 |
+
"_id": "5f2c1b9d8a9a4d3b6a7f9e2c",
|
40 |
+
"showOutput": true
|
41 |
+
}
|
42 |
+
]`
|
43 |
+
|
44 |
# 'name', 'userMessageToken', 'assistantMessageToken' are required
|
45 |
MODELS=`[
|
46 |
{
|
|
|
75 |
"extraBody":{
|
76 |
"presence_penalty":-0.9
|
77 |
}
|
78 |
+
},
|
79 |
+
{
|
80 |
+
"name": "BSC-LT/salamandra-7b-instruct_tools",
|
81 |
+
"promptExamples": [
|
82 |
+
{
|
83 |
+
"title": "How does an airplane produce lift?",
|
84 |
+
"prompt": "How does an airplane produce lift in order to fly?"
|
85 |
+
}, {
|
86 |
+
"title": "¿Qué és un meme?",
|
87 |
+
"prompt": "¿Qué és un meme y qué historia hay detrás del nombre?"
|
88 |
+
}, {
|
89 |
+
"title": "Resumeix una notícia",
|
90 |
+
"prompt": "Resumeix aquesta notícia en menys de 20 paraules: 'Tropes de l’exèrcit d’Israel han començat aquesta matinada la invasió del Líban, en una maniobra anticipada pels atacs de les darreres hores, tant a la capital, Beirut, com a la zona sud del país. Les tropes han començat a travessar la frontera internacional a les dues de la matinada, hora libanesa. Segons l’exèrcit israelià és una 'operació limitada' que pretén eliminar l’Hesbol·là, molt actiu en aquesta zona. Ara com ara, l’exèrcit libanès ha optat per recloure les tropes dins les casernes, a fi d’evitar un conflicte directe entre tots dos exèrcits. El Llevant podria entrar en una guerra regional de conseqüències impossibles de preveure. L’exèrcit israelià ha confirmat que les operacions havien estat aprovades pel gabinet de guerra, que ahir es va reunir fins tard. En un comunicat oficial ha avisat que l’artilleria i l’aviació es mantindrien actives en suport de les tropes que ja han travessat la frontera.' "
|
91 |
+
}
|
92 |
+
],
|
93 |
+
"tools": true,
|
94 |
+
"endpoints": [
|
95 |
+
{
|
96 |
+
"type": "openai",
|
97 |
+
"baseURL": "${BASEURL_SALAMANDRA_TOOLS}/v1",
|
98 |
+
"apiKey": "${HF_TOKEN}"
|
99 |
+
}
|
100 |
+
],
|
101 |
+
"parameters": {
|
102 |
+
"temperature": 0.4,
|
103 |
+
"repetition_penalty": 2,
|
104 |
+
"max_new_tokens": 1000,
|
105 |
+
"stop":["<|im_end|>"]
|
106 |
+
},
|
107 |
+
"extraBody":{
|
108 |
+
"presence_penalty":-0.9
|
109 |
+
}
|
110 |
}
|
111 |
]`
|
112 |
#Repetition penality = presence_penalty + 2
|
Dockerfile
CHANGED
@@ -30,6 +30,7 @@ ADD defaults /defaults
|
|
30 |
RUN chmod -R 777 /defaults
|
31 |
RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
32 |
--mount=type=secret,id=BASEURL,mode=0444 \
|
|
|
33 |
--mount=type=secret,id=HF_TOKEN,mode=0444 \
|
34 |
export MODEL_NAME="${MODEL_NAME:=$(cat /defaults/MODEL_NAME)}" \
|
35 |
&& export MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:=$(cat /defaults/MODEL_PROMPT_TEMPLATE)}" \
|
@@ -37,6 +38,7 @@ RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
|
37 |
&& export APP_NAME="${APP_NAME:=$(cat /defaults/APP_NAME)}" \
|
38 |
&& export MONGODB_URL=$(cat /run/secrets/MONGODB_URL | grep '^') \
|
39 |
&& export BASEURL=$(cat /run/secrets/BASEURL | grep '^') \
|
|
|
40 |
&& export HF_TOKEN=$(cat /run/secrets/HF_TOKEN | grep '^') \
|
41 |
&& envsubst < ".env.local.template" > ".env.local" \
|
42 |
&& rm .env.local.template
|
|
|
30 |
RUN chmod -R 777 /defaults
|
31 |
RUN --mount=type=secret,id=MONGODB_URL,mode=0444 \
|
32 |
--mount=type=secret,id=BASEURL,mode=0444 \
|
33 |
+
--mount=type=secret,id=BASEURL_SALAMANDRA_TOOLS,mode=0444 \
|
34 |
--mount=type=secret,id=HF_TOKEN,mode=0444 \
|
35 |
export MODEL_NAME="${MODEL_NAME:=$(cat /defaults/MODEL_NAME)}" \
|
36 |
&& export MODEL_PROMPT_TEMPLATE="${MODEL_PROMPT_TEMPLATE:=$(cat /defaults/MODEL_PROMPT_TEMPLATE)}" \
|
|
|
38 |
&& export APP_NAME="${APP_NAME:=$(cat /defaults/APP_NAME)}" \
|
39 |
&& export MONGODB_URL=$(cat /run/secrets/MONGODB_URL | grep '^') \
|
40 |
&& export BASEURL=$(cat /run/secrets/BASEURL | grep '^') \
|
41 |
+
&& export BASEURL_SALAMANDRA_TOOLS=$(cat /run/secrets/BASEURL_SALAMANDRA_TOOLS | grep '^') \
|
42 |
&& export HF_TOKEN=$(cat /run/secrets/HF_TOKEN | grep '^') \
|
43 |
&& envsubst < ".env.local.template" > ".env.local" \
|
44 |
&& rm .env.local.template
|