当前位置: 首页 > news >正文

网站后缀有什么区别硅藻泥网站怎么做

网站后缀有什么区别,硅藻泥网站怎么做,成都 网站建设公司,平面设计网站制作分类目录:《自然语言处理从入门到应用》总目录 Vectorstores是构建索引的最重要组件之一。本文展示了与VectorStores相关的基本功能。在使用VectorStores时,创建要放入其中的向量是一个关键部分,通常通过嵌入来创建。 from langchain.embedd…

分类目录:《自然语言处理从入门到应用》总目录


Vectorstores是构建索引的最重要组件之一。本文展示了与VectorStores相关的基本功能。在使用VectorStores时,创建要放入其中的向量是一个关键部分,通常通过嵌入来创建。

from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Chromawith open('../../state_of_the_union.txt') as f:state_of_the_union = f.read()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
texts = text_splitter.split_text(state_of_the_union)embeddings = OpenAIEmbeddings()
docsearch = Chroma.from_texts(texts, embeddings)query = "What did the president say about Ketanji Brown Jackson"
docs = docsearch.similarity_search(query)

日志输出:

Running Chroma using direct local API. Using DuckDB in-memory for database. Data will be transient.

输入:

print(docs[0].page_content)

输出:

In state after state, new laws have been passed, not only to suppress the vote, but to subvert entire elections. We cannot let this happen. Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.

添加文本

我们可以使用add_texts方法轻松地将文本添加到VectorStore中。它将返回一个文档ID的列表(以防我们需要在下游使用它们)。

docsearch.add_texts(["Ankush went to Princeton"])

输出:

['a05e3d0c-ab40-11ed-a853-e65801318981']

输入:

query = "Where did Ankush go to college?"
docs = docsearch.similarity_search(query)
docs[0]
Document(page_content='Ankush went to Princeton', lookup_str='', metadata={}, lookup_index=0)

从文档初始化

我们还可以直接从文档初始化一个Vectorstore。当我们在文本分割器上使用该方法直接获取文档时,这非常有用(当原始文档具有相关联的元数据时非常方便)。

documents = text_splitter.create_documents([state_of_the_union], metadatas=[{"source": "State of the Union"}])
docsearch = Chroma.from_documents(documents, embeddings)query = "What did the president say about Ketanji Brown Jackson"
docs = docsearch.similarity_search(query)

日志输出:

Running Chroma using direct local API. Using DuckDB in-memory for database. Data will be transient.

输入:

print(docs[0].page_content)

输出:

In state after state, new laws have been passed, not only to suppress the vote, but to subvert entire elections. We cannot let this happen. Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.

参考文献:
[1] LangChain官方网站:https://www.langchain.com/
[2] LangChain 🦜️🔗 中文网,跟着LangChain一起学LLM/GPT开发:https://www.langchain.com.cn/
[3] LangChain中文网 - LangChain 是一个用于开发由语言模型驱动的应用程序的框架:http://www.cnlangchain.com/

http://www.yayakq.cn/news/643334/

相关文章:

  • 怎么在公众号做影视网站住房和城乡建设网站 上海
  • 个人建站流程详解vue前端页面模板
  • 威海建设网站大数据分析培训机构
  • 怎么用html做移动网站app与网站的区别
  • 品牌推广的步骤和技巧寻找网站优化公司
  • 网站建设按什么收费发卡网站源码下载
  • 网站开发运营网页设计图片加载不出来
  • 网站开发技术与应用课程设计自己制作游戏的软件
  • 织梦网站漏洞什么网络营销
  • 西安企业做网站多少钱用什么编程语言做网站好
  • 网站建设公司如何盈利dw网页制作模板素材
  • 学校网站开发与设计福州网站建设名列前茅
  • 东莞seo建站广告费火车头采集wordpress发布时间
  • 海外网站wordpress get_query_var
  • 百度网站排名软件深圳十大教育培训机构排名
  • 做简易网站的APPwordpress 多媒体显示
  • 404 没有找到网站 试试申请收录吧舞蹈网站模板
  • 网站制作验收单电商推广和网络推广的策略
  • 免费域名网站哪个最好大型网站建设开发设计公司
  • 网站备案 域名过期ui作品集 网站怎么做
  • 网站开发的问题深圳宝安区怎么找服务
  • 网站建设方案书怎么写金顶街网站建设
  • 网站被收录后又被提出了做网站要源代码
  • 泰安商城网站开发设计广州软件开发公司排名
  • 用php做的订票网站怎样做网站的源代码
  • 济南做网站公司有哪些网上购物网站建设
  • 在vs2010里怎么做网站网站页面和图片设计
  • 化妆品公司网站模板一级消防工程师考试难度有多大
  • 大型游戏门户网站织梦模板域名更新
  • 双鸭山建设网站自己怎么做个网站