Mattral commited on
Commit
8def8b6
1 Parent(s): 259c5c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -22,14 +22,16 @@ chunk_size = 2500 # Adjust this size as needed
22
  info_md_chunks = textwrap.wrap(info_md_content, chunk_size)
23
  info2_md_chunks = textwrap.wrap(info2_md_content, chunk_size)
24
 
25
- def get_all_chunks(chunks):
26
- return "\n\n".join(chunks)
27
 
28
- def format_prompt_mixtral(message, history, info_md_chunks, info2_md_chunks):
 
 
 
 
 
29
  prompt = "<s>"
30
- # Sequentially add chunks from both files
31
- all_chunks = get_all_chunks(info_md_chunks + info2_md_chunks)
32
- prompt += f"{all_chunks}\n\n" # Add all chunks at the beginning
33
  prompt += f"{system_prompt_text}\n\n" # Add the system prompt
34
 
35
  if history:
@@ -49,7 +51,7 @@ def chat_inf(prompt, history, seed, temp, tokens, top_p, rep_p):
49
  seed=seed,
50
  )
51
 
52
- formatted_prompt = format_prompt_mixtral(prompt, history, info_md_chunks, info2_md_chunks)
53
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
54
  output = ""
55
  for response in stream:
 
22
  info_md_chunks = textwrap.wrap(info_md_content, chunk_size)
23
  info2_md_chunks = textwrap.wrap(info2_md_content, chunk_size)
24
 
25
+ # Combine both sets of chunks
26
+ all_chunks = info_md_chunks + info2_md_chunks
27
 
28
+ # Initialize history with these chunks
29
+ history = []
30
+ for chunk in all_chunks:
31
+ history.append(("System Information", chunk))
32
+
33
+ def format_prompt_mixtral(message, history):
34
  prompt = "<s>"
 
 
 
35
  prompt += f"{system_prompt_text}\n\n" # Add the system prompt
36
 
37
  if history:
 
51
  seed=seed,
52
  )
53
 
54
+ formatted_prompt = format_prompt_mixtral(prompt, history)
55
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
56
  output = ""
57
  for response in stream: