Skip to content

Commit

Permalink
清理llama_index
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed May 18, 2023
1 parent ad48b38 commit d32517d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
3 changes: 2 additions & 1 deletion config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
// 你的OpenAI API Key,一般必填,
// 若缺省填为 "openai_api_key": "" 则必须再在图形界面中填入API Key
"openai_api_key": "",
"google_palm_api_key": "",
"xmchat_api_key": "",
"usage_limit": 120, // API Key的当月限额,单位:美元
// 你的xmchat API Key,与OpenAI API Key不同
"xmchat_api_key": "",
"language": "auto",
// 如果使用代理,请取消注释下面的两行,并替换代理URL
// "https_proxy": "http://127.0.0.1:1079",
Expand Down
10 changes: 0 additions & 10 deletions modules/overwrites.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations
import logging

from llama_index import Prompt
from typing import List, Tuple
import mdtex2html
from gradio_client import utils as client_utils
Expand All @@ -10,15 +9,6 @@
from modules.index_func import *
from modules.config import render_latex

def compact_text_chunks(self, prompt: Prompt, text_chunks: List[str]) -> List[str]:
logging.debug("Compacting text chunks...🚀🚀🚀")
combined_str = [c.strip() for c in text_chunks if c.strip()]
combined_str = [f"[{index+1}] {c}" for index, c in enumerate(combined_str)]
combined_str = "\n\n".join(combined_str)
# resplit based on self.max_chunk_overlap
text_splitter = self.get_text_splitter_given_prompt(prompt, 1, padding=1)
return text_splitter.split_text(combined_str)


def postprocess(
self,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ faiss-cpu
google-search-results
arxiv
wikipedia
google.generativeai

0 comments on commit d32517d

Please sign in to comment.