代码拉取完成,页面将自动刷新
from datasets import load_dataset
from langchain.chains import LLMChain
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain import hub
from langchain.retrievers.multi_query import MultiQueryRetriever
from langchain.docstore.document import Document
import os
# os.environ["DASHSCOPE_API_KEY"] = "sk-cc1c8314fdbd43ceaf26ec1824d5dd3b"
# llm = Tongyi()
# data = load_dataset("jamescalam/ai-arxiv-chunked", split="train")
# data = data[:2]
# print(data)
numbers = [[1,2], [3,4], [4,5]]
squared_numbers = map(lambda x: x[0]**2, numbers)
print(list(squared_numbers))
# docs = []
# for row in data:
# doc = Document(
# page_content=row["chunk"],
# metadata={
# "title": row["title"],
# "source": row["source"],
# "id": row["id"],
# "chunk-id": row["chunk-id"],
# "text": row["chunk"]
# }
# )
# docs.append(doc)
# embeddings = JinaEmbeddings(
# jina_api_key="jina_7e2c88997a50417aab497c15a4c6cec7vuBoG_CK-_0gYILG38ZIoJHTL1_q", model_name="jina-embeddings-v2-base-en"
# )
# vectorstore = Chroma.from_documents(docs, embeddings)
# retriever = vectorstore.as_retriever()
# retriever = MultiQueryRetriever.from_llm(
# retriever= retriever, llm=llm
# )
# print(docs)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。