# -*-coding:utf-8 -*- from langchain.vectorstores import FAISS from langchain.embeddings import HuggingFaceEmbeddings, CohereEmbeddings from key import CoherenceKey ## MPNET model = HuggingFaceEmbeddings() db = FAISS.load_local('./output/半导体', model) docs = db.similarity_search('东吴证券观点') print(docs[0].page_content) docs = db.similarity_search('德邦证券') print(docs[0].page_content) ## Coherence model = CohereEmbeddings(cohere_api_key=CoherenceKey) db = FAISS.load_local('./output/半导体', model) docs = db.similarity_search('半导体指数行情') print(docs[0].page_content) docs = db.similarity_search('关于行业光刻胶相关新闻') print(docs[0].page_content) docs = db.similarity_search('2023年GDP增速预测') print(docs[0].page_content)