Tuchuanhuhuhu commited on
Commit
d32517d
1 Parent(s): ad48b38

清理llama_index

Browse files
Files changed (3) hide show
  1. config_example.json +2 -1
  2. modules/overwrites.py +0 -10
  3. requirements.txt +1 -0
config_example.json CHANGED
@@ -2,9 +2,10 @@
2
  // 你的OpenAI API Key,一般必填,
3
  // 若缺省填为 "openai_api_key": "" 则必须再在图形界面中填入API Key
4
  "openai_api_key": "",
 
 
5
  "usage_limit": 120, // API Key的当月限额,单位:美元
6
  // 你的xmchat API Key,与OpenAI API Key不同
7
- "xmchat_api_key": "",
8
  "language": "auto",
9
  // 如果使用代理,请取消注释下面的两行,并替换代理URL
10
  // "https_proxy": "http://127.0.0.1:1079",
 
2
  // 你的OpenAI API Key,一般必填,
3
  // 若缺省填为 "openai_api_key": "" 则必须再在图形界面中填入API Key
4
  "openai_api_key": "",
5
+ "google_palm_api_key": "",
6
+ "xmchat_api_key": "",
7
  "usage_limit": 120, // API Key的当月限额,单位:美元
8
  // 你的xmchat API Key,与OpenAI API Key不同
 
9
  "language": "auto",
10
  // 如果使用代理,请取消注释下面的两行,并替换代理URL
11
  // "https_proxy": "http://127.0.0.1:1079",
modules/overwrites.py CHANGED
@@ -1,7 +1,6 @@
1
  from __future__ import annotations
2
  import logging
3
 
4
- from llama_index import Prompt
5
  from typing import List, Tuple
6
  import mdtex2html
7
  from gradio_client import utils as client_utils
@@ -10,15 +9,6 @@ from modules.presets import *
10
  from modules.index_func import *
11
  from modules.config import render_latex
12
 
13
- def compact_text_chunks(self, prompt: Prompt, text_chunks: List[str]) -> List[str]:
14
- logging.debug("Compacting text chunks...🚀🚀🚀")
15
- combined_str = [c.strip() for c in text_chunks if c.strip()]
16
- combined_str = [f"[{index+1}] {c}" for index, c in enumerate(combined_str)]
17
- combined_str = "\n\n".join(combined_str)
18
- # resplit based on self.max_chunk_overlap
19
- text_splitter = self.get_text_splitter_given_prompt(prompt, 1, padding=1)
20
- return text_splitter.split_text(combined_str)
21
-
22
 
23
  def postprocess(
24
  self,
 
1
  from __future__ import annotations
2
  import logging
3
 
 
4
  from typing import List, Tuple
5
  import mdtex2html
6
  from gradio_client import utils as client_utils
 
9
  from modules.index_func import *
10
  from modules.config import render_latex
11
 
 
 
 
 
 
 
 
 
 
12
 
13
  def postprocess(
14
  self,
requirements.txt CHANGED
@@ -21,3 +21,4 @@ faiss-cpu
21
  google-search-results
22
  arxiv
23
  wikipedia
 
 
21
  google-search-results
22
  arxiv
23
  wikipedia
24
+ google.generativeai