1 Star 0 Fork 0

贺辉0912/bigmodel

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
RunnableLambda2 copy.py 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
andy.he 提交于 2024-03-01 11:04 . 1
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/he-hui-0912/bigmodel.git
git@gitee.com:he-hui-0912/bigmodel.git
he-hui-0912
bigmodel
bigmodel
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385