Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,8 @@ callback_manager = CallbackManager()
|
|
9 |
|
10 |
api_base_url = "https://internlm-chat.intern-ai.org.cn/puyu/api/v1/"
|
11 |
model = "internlm2.5-latest"
|
12 |
-
api_key =
|
|
|
13 |
|
14 |
# api_base_url = "https://api.siliconflow.cn/v1"
|
15 |
# model = "internlm/internlm2_5-7b-chat"
|
@@ -26,14 +27,14 @@ st.title("llama_index_demo")
|
|
26 |
@st.cache_resource
|
27 |
def init_models():
|
28 |
embed_model = HuggingFaceEmbedding(
|
29 |
-
model_name="
|
30 |
)
|
31 |
Settings.embed_model = embed_model
|
32 |
|
33 |
#用初始化llm
|
34 |
Settings.llm = llm
|
35 |
|
36 |
-
documents = SimpleDirectoryReader("
|
37 |
index = VectorStoreIndex.from_documents(documents)
|
38 |
query_engine = index.as_query_engine()
|
39 |
|
|
|
9 |
|
10 |
api_base_url = "https://internlm-chat.intern-ai.org.cn/puyu/api/v1/"
|
11 |
model = "internlm2.5-latest"
|
12 |
+
api_key =os.getenv("api_key")
|
13 |
+
|
14 |
|
15 |
# api_base_url = "https://api.siliconflow.cn/v1"
|
16 |
# model = "internlm/internlm2_5-7b-chat"
|
|
|
27 |
@st.cache_resource
|
28 |
def init_models():
|
29 |
embed_model = HuggingFaceEmbedding(
|
30 |
+
model_name="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"
|
31 |
)
|
32 |
Settings.embed_model = embed_model
|
33 |
|
34 |
#用初始化llm
|
35 |
Settings.llm = llm
|
36 |
|
37 |
+
documents = SimpleDirectoryReader("./data").load_data()
|
38 |
index = VectorStoreIndex.from_documents(documents)
|
39 |
query_engine = index.as_query_engine()
|
40 |
|