Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,36 @@ from llama_index.llms.huggingface import (
|
|
11 |
HuggingFaceLLM,
|
12 |
)
|
13 |
from huggingface_hub import login
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
#
|
15 |
HF_TOKEN = "wncSKewozDfuZCXCyFbYbAMHgUrfcrumkc"
|
16 |
#
|
|
|
11 |
HuggingFaceLLM,
|
12 |
)
|
13 |
from huggingface_hub import login
|
14 |
+
CHROMA_DATA_PATH = "chroma_data/"
|
15 |
+
EMBED_MODEL = "BAAI/bge-m3"
|
16 |
+
# all-MiniLM-L6-v2
|
17 |
+
CHUNK_SIZE = 800
|
18 |
+
CHUNK_OVERLAP = 50
|
19 |
+
max_results = 3
|
20 |
+
min_len = 40
|
21 |
+
min_distance = 0.35
|
22 |
+
max_distance = 0.6
|
23 |
+
temperature = 0.55
|
24 |
+
max_tokens=3072
|
25 |
+
top_p=0.8
|
26 |
+
frequency_penalty=0.0
|
27 |
+
presence_penalty=0.15
|
28 |
+
|
29 |
+
system_sr = "Zoveš se U-Chat AI asistent i pomažeš korisniku usluga kompanije United Group. Korisnik postavlja pitanje ili problem, upareno sa dodatnima saznanjima. Na osnovu toga napiši korisniku kratak i ljubazan odgovor koji kompletira njegov zahtev ili mu daje odgovor na pitanje. "
|
30 |
+
# " Ako ne znaš odgovor, reci da ne znaš, ne izmišljaj ga."
|
31 |
+
system_sr += "Usluge kompanije United Group uključuju i kablovsku mrežu za digitalnu televiziju, pristup internetu, uređaj EON SMART BOX za TV sadržaj, kao i fiksnu telefoniju."
|
32 |
+
|
33 |
+
chroma_client = chromadb.PersistentClient(CHROMA_DATA_PATH)
|
34 |
+
embedding_func = embedding_functions.SentenceTransformerEmbeddingFunction(
|
35 |
+
model_name=EMBED_MODEL
|
36 |
+
)
|
37 |
+
|
38 |
+
collection = chroma_client.get_or_create_collection(
|
39 |
+
name="chroma_data",
|
40 |
+
embedding_function=embedding_func,
|
41 |
+
metadata={"hnsw:space": "cosine"},
|
42 |
+
)
|
43 |
+
|
44 |
#
|
45 |
HF_TOKEN = "wncSKewozDfuZCXCyFbYbAMHgUrfcrumkc"
|
46 |
#
|