微信扫码
与创始人交个朋友
我要投稿
文本分割器的基本工作原理:
定制文本分割器的两个主要轴向:
主要参数和功能:
def transformer_doc():# 加载待分割长文本 with open('sys_boss.txt',encoding='UTF-8') as f:state_of_the_union = f.read()text_splitter = RecursiveCharacterTextSplitter(chunk_size = 100,chunk_overlap= 20,length_function = len,add_start_index = True,)docs = text_splitter.create_documents([state_of_the_union])print(docs[0])print(docs[1])metadatas = [{"document": 1}, {"document": 2}]documents = text_splitter.create_documents([state_of_the_union, state_of_the_union], metadatas=metadatas)print(documents[0])
def spit_code():print([e.value for e in Language])html_text = """<!DOCTYPE html><html><head><title>?️? LangChain</title><style>body {font-family: Arial, sans-serif;}h1 {color: darkblue;}</style></head><body><div><h1>?️? LangChain</h1><p>⚡ Building applications with LLMs through composability ⚡</p></div><div>As an open source project in a rapidly developing field, we are extremely open to contributions.</div></body></html>"""html_splitter = RecursiveCharacterTextSplitter.from_language(language=Language.HTML, chunk_size=60, chunk_overlap=0)html_docs = html_splitter.create_documents([html_text])print(html_docs)
53AI,企业落地应用大模型首选服务商
产品:大模型应用平台+智能体定制开发+落地咨询服务
承诺:先做场景POC验证,看到效果再签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2024-11-13
只需8步,手把手教你用LangGraph创建AI智能体
2024-11-13
使用 LangChain 建立一个会话式的 RAG Agent 系统
2024-11-12
一文深度了解Agent智能体以及认知架构
2024-11-12
使用LangChain建立检索增强生成(RAG)系统
2024-11-11
Qwen-Agent 核心点说明
2024-11-11
吴恩达分享五个AI趋势,重点谈了多AI代理的美好前景
2024-11-11
使用 LangChain 构建一个 Agent(智能体/代理)
2024-11-10
使用 LangChain 构建一个有记忆的聊天机器人
2024-08-18
2024-04-08
2024-06-03
2024-04-08
2024-04-17
2024-06-24
2024-04-12
2024-04-10
2024-07-01
2024-04-11
2024-10-30
2024-10-11
2024-08-18
2024-08-16
2024-08-04
2024-07-29
2024-07-28
2024-07-27