Spaces:
Sleeping
Sleeping
Samarth991
commited on
Commit
•
688f875
1
Parent(s):
31f4dd5
adding chatbot
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def get_openai_chat_model(API_key):
|
|
26 |
llm = OpenAI()
|
27 |
return llm
|
28 |
|
29 |
-
def process_documents(documents,data_chunk=
|
30 |
text_splitter = CharacterTextSplitter(chunk_size=data_chunk, chunk_overlap=chunk_overlap,separator='\n')
|
31 |
texts = text_splitter.split_documents(documents)
|
32 |
return texts
|
@@ -34,7 +34,7 @@ def process_documents(documents,data_chunk=2000,chunk_overlap=50):
|
|
34 |
def get_hugging_face_model(model_id,API_key,temperature=0.1):
|
35 |
chat_llm = HuggingFaceHub(huggingfacehub_api_token=API_key,
|
36 |
repo_id=model_id,
|
37 |
-
model_kwargs={"temperature": temperature, "max_new_tokens":
|
38 |
return chat_llm
|
39 |
|
40 |
def chat_application(llm_service,key):
|
|
|
26 |
llm = OpenAI()
|
27 |
return llm
|
28 |
|
29 |
+
def process_documents(documents,data_chunk=1500,chunk_overlap=100):
|
30 |
text_splitter = CharacterTextSplitter(chunk_size=data_chunk, chunk_overlap=chunk_overlap,separator='\n')
|
31 |
texts = text_splitter.split_documents(documents)
|
32 |
return texts
|
|
|
34 |
def get_hugging_face_model(model_id,API_key,temperature=0.1):
|
35 |
chat_llm = HuggingFaceHub(huggingfacehub_api_token=API_key,
|
36 |
repo_id=model_id,
|
37 |
+
model_kwargs={"temperature": temperature, "max_new_tokens": 4096})
|
38 |
return chat_llm
|
39 |
|
40 |
def chat_application(llm_service,key):
|