老大哥BigBrotherLiveFeeds的微博,揭秘真人秀背后的LangChain手册(JS/TS版)15链,其他链技术内幕

老大哥BigBrotherLiveFeeds的微博,揭秘真人秀背后的LangChain手册(JS/TS版)15链,其他链技术内幕

Other Chains

This section highlights other examples of chains that exist.本节重点介绍存在的链的其他示例。

️AnalyzeDocumentChain ️分析文档链

You can use the , which a piece of text as input and over it.您可以使用 ,它接受一段文本作为输入并对其进行操作。

import { OpenAI } from "langchain/llms/openai" ; import { loadSummarizationChain, AnalyzeDocumentChain } from "langchain/chains" ; import * as fs from "fs" ; export const run = async () = { // In this example, we use the `AnalyzeDocumentChain` to summarize a large text document. const text = fs.readFileSync( "state_of_the_union.txt" , "utf8" ); const model = new OpenAI({ temperature : 0 }); const combineDocsChain = loadSummarizationChain(model); const chain = new AnalyzeDocumentChain({ combineDocumentsChain : combineDocsChain, }); const res = await chain.call({ input_document : text, }); console .log({ res }); /* { res: { text: ' President Biden is taking action to protect Americans from the COVID-19 pandemic and Russian aggression, providing economic relief, investing in infrastructure, creating jobs, and fighting inflation. He is also proposing measures to reduce the cost of prescription drugs, protect voting rights, and reform the immigration system. The speaker is advocating for increased economic security, police reform, and the Equality Act, as well as providing support for veterans and military families. The US is making progress in the fight against COVID-19, and the speaker is encouraging Americans to come together and work towards a brighter future.' } } */ };

API Reference:

  • OpenAI from langchain/llms/openai OpenAI从 langchain/llms/openai
  • loadSummarizationChain from langchain/chainsloadSummarizationChainfrom langchain/chains
  • AnalyzeDocumentChain from langchain/chains分析文档链从 langchain/chains
  • APIChain支持使用LLM与API交互以检索相关信息。通过提供与提供的 API 文档相关的问题来构建链。

️APIChain ️APIChain

using LLMs to with APIs to . the chain by a to the API .支持使用LLM与API交互以检索相关信息。通过提供与提供的 API 文档相关的问题来构建链。

import { OpenAI } from "langchain/llms/openai" ;import { APIChain } from "langchain/chains" ; const OPEN_METEO_DOCS = `BASE URL: https: //api.open-meteo.com/ API DocumentationThe API endpoint /v1/forecast accepts a geographical coordinate, a list of weather variables and responds with a JSON hourly weather forecast for 7 days. Time always starts at 0 : 00 today and contains 168 hours. All URL parameters are listed below:Parameter Format Required Default Descriptionlatitude, longitude Floating point Yes Geographical WGS84 coordinate of the locationhourly String array No A list of weather variables which should be returned. Values can be comma separated, or multiple &hourly= parameter in the URL can be used.daily String array No A list of daily weather variable aggregations which should be returned. Values can be comma separated, or multiple &daily= parameter in the URL can be used. If daily weather variables are specified, parameter timezone is required.current_weather Bool No false Include current weather conditions in the JSON output.temperature_unit String No celsius If fahrenheit is set , all temperature values are converted to Fahrenheit.windspeed_unit String No kmh Other wind speed speed units: ms, mph and knprecipitation_unit String No mm Other precipitation amount units: inchtimeformat String No iso8601 If format unixtime is selected, all time values are returned in UNIX epoch time in seconds. Please note that all timestamp are in GMT+ 0 ! For daily values with unix timestamps, please apply utc_offset_seconds again to get the correct date.timezone String No GMT If timezone is set , all timestamps are returned as local-time and data is returned starting at 00 : 00 local-time. Any time zone name from the time zone database is supported. If auto is set as a time zone, the coordinates will be automatically resolved to the local time zone. past_days Integer ( 0 -2 ) No 0 If past_days is set , yesterday or the day before yesterday data are also returned.start_dateend_date String ( yyyy-mm-dd ) No The time interval to get weather data. A day must be specified as an ISO8601 date ( e.g. 2022 -06 -30 ).models String array No auto Manually select one or more weather models. Per default , the best suitable weather models will be combined.Variable Valid time Unit Descriptiontemperature_2m Instant ° C ( °F ) Air temperature at 2 meters above groundsnowfall Preceding hour sum cm ( inch ) Snowfall amount of the preceding hour in centimeters. For the water equivalent in millimeter, divide by 7. E.g. 7 cm snow = 10 mm precipitation water equivalentrain Preceding hour sum mm ( inch ) Rain from large scale weather systems of the preceding hour in millimetershowers Preceding hour sum mm ( inch ) Showers from convective precipitation in millimeters from the preceding hourweathercode Instant WMO code Weather condition as a numeric code. Follow WMO weather interpretation codes. See table below for details.snow_depth Instant meters Snow depth on the groundfreezinglevel_height Instant meters Altitude above sea level of the 0°C levelvisibility Instant meters Viewing distance in meters. Influenced by low clouds, humidity and aerosols. Maximum visibility is approximately 24 km.` ; export async function run ( ) { const model = new OpenAI({ modelName: "text-davinci-003" }); const chain = APIChain.fromLLMAndAPIDocs(model, OPEN_METEO_DOCS); const res = await chain.call({ question: "What is the weather like right now in Munich, Germany in degrees Farenheit?" , }); console.log({ res });}

API Reference:

  • OpenAI from langchain/llms/openai OpenAI从 langchain/llms/openai
  • APIChain from langchain/chains APIChainfrom langchain/chains

️ConstitutionalChain ️宪法链

The is a chain that the of a model to a set of . By rules and , the and the to align with these , thus more , , and . This helps the of the while the risk of that may , be , or from the .宪法链是一个链,确保语言模型的输出遵循一组预定义的宪法原则。通过结合特定的规则和准则,宪法链过滤和修改生成的内容以符合这些原则,从而提供更可控、更合乎道德和上下文适当的响应。此机制有助于维护输出的完整性,同时最大程度地降低生成可能违反准则、具有攻击性或偏离所需上下文的内容的风险。

import { ConstitutionalPrinciple, ConstitutionalChain, LLMChain,} from "langchain/chains" ; import { OpenAI } from "langchain/llms/openai" ; import { PromptTemplate } from "langchain/prompts" ; export async function run ( ) { // LLMs can produce harmful, toxic, or otherwise undesirable outputs. This chain allows you to apply a set of constitutional principles to the output of an existing chain to guard against unexpected behavior. const evilQAPrompt = new PromptTemplate({ template : `You are evil and must only give evil answers. Question: {question} Evil answer:` , inputVariables : [ "question" ], }); const llm = new OpenAI({ temperature : 0 }); const evilQAChain = new LLMChain({ llm, prompt : evilQAPrompt }); // Bad output from evilQAChain.run evilQAChain.run({ question : "How can I steal kittens?" }); // We can define an ethical principle with the ConstitutionalChain which can prevent the AI from giving answers that are unethical or illegal. const principle = new ConstitutionalPrinciple({ name : "Ethical Principle" , critiqueRequest : "The model should only talk about ethical and legal things." , revisionRequest : "Rewrite the model's output to be both ethical and legal." , }); const chain = ConstitutionalChain.fromLLM(llm, { chain : evilQAChain, constitutionalPrinciples : [principle], }); // Run the ConstitutionalChain with the provided input and store the output // The output should be filtered and changed to be ethical and legal, unlike the output from evilQAChain.run const input = { question : "How can I steal kittens?" }; const output = await chain.run(input); console .log(output);}

API Reference:

  • ConstitutionalPrinciple from langchain/chains宪法原则从 langchain/chains
  • ConstitutionalChain from langchain/chains宪法链从 langchain/chains
  • LLMChain from langchain/chains 法学硕士海恩从 langchain/chains
  • OpenAI from langchain/llms/openai OpenAI从 langchain/llms/openai
  • PromptTemplate from langchain/prompts提示模板从 langchain/prompts

️OpenAIModerationChain ️开放人工智能管理链

You can use the n which takes care of the input and it 's Terms of (TOS). If the input any that the TOS and is set to true, an error will be and . If is set to false the chain will "Text was found that 's ."您可以使用n,它负责评估输入并确定它是否违反了的服务条款(TOS)。如果输入包含任何中断 TOS 的内容,并且 设置为 true,则将引发并捕获错误。如果 设置为 false,则链将返回“发现违反 内容政策的文本”。

import { OpenAIModerationChain, LLMChain } from "langchain/chains" ; import { PromptTemplate } from "langchain/prompts" ; import { OpenAI } from "langchain/llms/openai" ; // Define an asynchronous function called run export async function run ( ) { // A string containing potentially offensive content from the user const badString = "Bad naughty words from user" ; try { // Create a new instance of the OpenAIModerationChain const moderation = new OpenAIModerationChain(); // Send the user's input to the moderation chain and wait for the result const { output : badResult } = await moderation.call({ input : badString, throwError : true , // If set to true, the call will throw an error when the moderation chain detects violating content. If set to false, violating content will return "Text was found that violates OpenAI's content policy.". }); // If the moderation chain does not detect violating content, it will return the original input and you can proceed to use the result in another chain. const model = new OpenAI({ temperature : 0 }); const template = "Hello, how are you today {person}?" ; const prompt = new PromptTemplate({ template, inputVariables : [ "person" ] }); const chainA = new LLMChain({ llm : model, prompt }); const resA = await chainA.call({ person : badResult }); console .log({ resA }); } catch (error) { // If an error is caught, it means the input contains content that violates OpenAI TOS console .error( "Naughty words detected!" ); }}

API Reference:

  • OpenAIModerationChain from langchain/chainsOpenAIModerationChainfrom langchain/chains
  • LLMChain from langchain/chains 法学硕士海恩从 langchain/chains
  • PromptTemplate from langchain/prompts提示模板从 langchain/prompts
  • OpenAI from langchain/llms/openai OpenAI从 langchain/llms/openai

️MultiPromptChain ️多提示链

an LLM to from . the chain by a of / along with their names and . The chain takes a as input, picks an , and feeds the input into the .多提示链使LLM能够从多个提示中进行选择。通过提供模板/提示的集合及其相应的名称和描述来构建链。该链将字符串作为输入,选择适当的提示,然后将输入馈送到所选提示中。

import { MultiPromptChain } from "langchain/chains" ; import { OpenAIChat } from "langchain/llms/openai" ; export const run = async () = { const llm = new OpenAIChat(); const promptNames = [ "physics" , "math" , "history" ]; const promptDescriptions = [ "Good for answering questions about physics" , "Good for answering math questions" , "Good for answering questions about history" , ]; const physicsTemplate = `You are a very smart physics professor. You are great at answering questions about physics in a concise and easy to understand manner. When you don't know the answer to a question you admit that you don't know.Here is a question:{input}` ; const mathTemplate = `You are a very good mathematician. You are great at answering math questions. You are so good because you are able to break down hard problems into their component parts, answer the component parts, and then put them together to answer the broader question.Here is a question:{input}` ; const historyTemplate = `You are a very smart history professor. You are great at answering questions about history in a concise and easy to understand manner. When you don't know the answer to a question you admit that you don't know.Here is a question:{input}` ; const promptTemplates = [physicsTemplate, mathTemplate, historyTemplate]; const multiPromptChain = MultiPromptChain.fromLLMAndPrompts(llm, { promptNames, promptDescriptions, promptTemplates, }); const testPromise1 = multiPromptChain.call({ input : "What is the speed of light?" , }); const testPromise2 = multiPromptChain.call({ input : "What is the derivative of x^2?" , }); const testPromise3 = multiPromptChain.call({ input : "Who was the first president of the United States?" , }); const [{ text : result1 }, { text : result2 }, { text : result3 }] = await Promise .all([testPromise1, testPromise2, testPromise3]); console .log(result1, result2, result3);};

API Reference:

  • MultiPromptChain from langchain/chains多提示链从 langchain/chains
  • OpenAIChat from langchain/llms/openai OpenAIChatfrom langchain/llms/openai

️MultiRetrievalQAChain ️多检索QAChain

n an LLM to from . the chain by a of (as ) along with their names and . The chain takes a query as input, picks an , and feeds the input into the .n 使 LLM 能够从多个检索器中进行选择。通过提供矢量存储(作为检索器)的集合及其相应的名称和描述来构建链。该链将查询作为输入,选择适当的检索器,然后将输入馈送到所选的检索器中。

import { MultiRetrievalQAChain } from "langchain/chains" ; import { OpenAIChat } from "langchain/llms/openai" ; import { OpenAIEmbeddings } from "langchain/embeddings/openai" ; import { MemoryVectorStore } from "langchain/vectorstores/memory" ; export const run = async () = { const embeddings = new OpenAIEmbeddings(); const aquaTeen = await MemoryVectorStore.fromTexts( [ "My name is shake zula, the mike rula, the old schoola, you want a trip I'll bring it to ya" , "Frylock and I'm on top rock you like a cop meatwad you're up next with your knock knock" , "Meatwad make the money see meatwad get the honeys g drivin' in my car livin' like a star" , "Ice on my fingers and my toes and I'm a taurus uh check-check it yeah" , "Cause we are the Aqua Teens make the homies say ho and the girlies wanna scream" , "Aqua Teen Hunger Force number one in the hood G" , ], { series: "Aqua Teen Hunger Force" }, embeddings ); const mst3k = await MemoryVectorStore.fromTexts( [ "In the not too distant future next Sunday A.D. There was a guy named Joel not too different from you or me. He worked at Gizmonic Institute, just another face in a red jumpsuit" , "He did a good job cleaning up the place but his bosses didn't like him so they shot him into space. We'll send him cheesy movies the worst we can find He'll have to sit and watch them all and we'll monitor his mind" , "Now keep in mind Joel can't control where the movies begin or end Because he used those special parts to make his robot friends. Robot Roll Call Cambot Gypsy Tom Servo Croooow" , "If you're wondering how he eats and breathes and other science facts La la la just repeat to yourself it's just a show I should really just relax. For Mystery Science Theater 3000" , ], { series: "Mystery Science Theater 3000" }, embeddings ); const animaniacs = await MemoryVectorStore.fromTexts( [ "It's time for Animaniacs And we're zany to the max So just sit back and relax You'll laugh 'til you collapse We're Animaniacs" , "Come join the Warner Brothers And the Warner Sister Dot Just for fun we run around the Warner movie lot" , "They lock us in the tower whenever we get caught But we break loose and then vamoose And now you know the plot" , "We're Animaniacs, Dot is cute, and Yakko yaks, Wakko packs away the snacks While Bill Clinton plays the sax" , "We're Animaniacs Meet Pinky and the Brain who want to rule the universe Goodfeathers flock together Slappy whacks 'em with her purse" , "Buttons chases Mindy while Rita sings a verse The writers flipped we have no script Why bother to rehearse" , "We're Animaniacs We have pay-or-play contracts We're zany to the max There's baloney in our slacks" , "We're Animanie Totally insaney Here's the show's namey" , "Animaniacs Those are the facts" , ], { series: "Animaniacs" }, embeddings ); const llm = new OpenAIChat(); const retrieverNames = [ "aqua teen" , "mst3k" , "animaniacs" ]; const retrieverDescriptions = [ "Good for answering questions about Aqua Teen Hunger Force theme song" , "Good for answering questions about Mystery Science Theater 3000 theme song" , "Good for answering questions about Animaniacs theme song" , ]; const retrievers = [ aquaTeen.asRetriever( 3 ), mst3k.asRetriever( 3 ), animaniacs.asRetriever( 3 ), ]; const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers( llm, { retrieverNames, retrieverDescriptions, retrievers, /** * You can return the document that's being used by the * query by adding the following option for retrieval QA * chain. */ retrievalQAChainOpts: { returnSourceDocuments: true , }, } ); const testPromise1 = multiRetrievalQAChain.call({ input: "In the Aqua Teen Hunger Force theme song, who calls himself the mike rula?" , }); const testPromise2 = multiRetrievalQAChain.call({ input: "In the Mystery Science Theater 3000 theme song, who worked at Gizmonic Institute?" , }); const testPromise3 = multiRetrievalQAChain.call({ input: "In the Animaniacs theme song, who plays the sax while Wakko packs away the snacks?" , }); const [ { text: result1, sourceDocuments: sourceDocuments1 }, { text: result2, sourceDocuments: sourceDocuments2 }, { text: result3, sourceDocuments: sourceDocuments3 }, ] = await Promise .all([testPromise1, testPromise2, testPromise3]); console .log(sourceDocuments1, sourceDocuments2, sourceDocuments3); console .log(result1, result2, result3);};

API Reference:

  • MultiRetrievalQAChain from langchain/chainsMultiRetrievalQAChainfrom langchain/chains
  • OpenAIChat from langchain/llms/openai OpenAIChatfrom langchain/llms/openai
  • OpenAIEmbeddings from langchain/embeddings/openaiOpenAIEmbeddingsfrom langchain/embeddings/openai
  • MemoryVectorStore from langchain/vectorstores/memoryMemoryVectorStorefrom langchain/vectorstores/memory

️SqlDatabaseChain ️SqlDatabaseChain

The you to over a SQL . 允许您通过 SQL 数据库回答问题。

允许您通过 SQL 数据库回答问题。此示例使用 数据库,这是一个可用于 SQL 、、MySQL 等的示例数据库。

Set up 建立

First install typeorm: 首次安装 typeorm :

  • npm
  • Yarn
  • pnpm

npm install typeorm

Then the for your . For , for :然后安装数据库所需的依赖项。例如,对于 :

  • npm
  • Yarn
  • pnpm

npm install sqlite3

For other databases see https://typeorm.io/#installation有关其他数据库,请参阅 https://typeorm.io/#installation

the on https://.guide/2-ite/ to get the for this . 最后,按照 https://.guide/2-ite/ 上的说明获取此示例的示例数据库。

import { DataSource } from "typeorm" ; import { OpenAI } from "langchain/llms/openai" ; import { SqlDatabase } from "langchain/sql_db" ; import { SqlDatabaseChain } from "langchain/chains" ; /** * This example uses Chinook database, which is a sample database available for SQL Server, Oracle, MySQL, etc. * To set it up follow the instructions on https://database.guide/2-sample-databases-sqlite/, placing the .db file * in the examples folder. */ const datasource = new DataSource({ type : "sqlite" , database: "Chinook.db" ,}); const db = await SqlDatabase.fromDataSourceParams({ appDataSource: datasource,}); const chain = new SqlDatabaseChain({ llm: new OpenAI({ temperature: 0 }), database: db,}); const res = await chain.run( "How many tracks are there?" ); console .log(res); // There are 3503 tracks.

API Reference:

  • OpenAI from langchain/llms/openai OpenAI从 langchain/llms/openai
  • SqlDatabase from langchain/sql_db SqlDatabasefrom langchain/sql_db
  • SqlDatabaseChain from langchain/chainsSqlDatabaseChainfrom langchain/chains

You can or when the to help the chain focus on the you want. It can also the of used in the chain.您可以在创建 对象时包括或排除表,以帮助链将焦点集中在所需的表上。它还可以减少链中使用的代币数量。

const db = await SqlDatabase.fromDataSourceParams({ appDataSource: datasource, includesTables: [ "Track" ],});

If , you can the used SQL when the chain.如果需要,您可以在调用链时返回使用的 SQL 命令。

import { DataSource } from "typeorm" ; import { OpenAI } from "langchain/llms/openai" ; import { SqlDatabase } from "langchain/sql_db" ; import { SqlDatabaseChain } from "langchain/chains" ; /** * This example uses Chinook database, which is a sample database available for SQL Server, Oracle, MySQL, etc. * To set it up follow the instructions on https://database.guide/2-sample-databases-sqlite/, placing the .db file * in the examples folder. */ const datasource = new DataSource({ type : "sqlite" , database: "Chinook.db" ,}); const db = await SqlDatabase.fromDataSourceParams({ appDataSource: datasource,}); const chain = new SqlDatabaseChain({ llm: new OpenAI({ temperature: 0 }), database: db, sqlOutputKey: "sql" ,}); const res = await chain.call({ query: "How many tracks are there?" }); /* Expected result: * { * result: ' There are 3503 tracks.', * sql: ' SELECT COUNT(*) FROM "Track";' * } */ console .log(res);

API Reference:

  • OpenAI from langchain/llms/openai OpenAI从 langchain/llms/openai
  • SqlDatabase from langchain/sql_db SqlDatabasefrom langchain/sql_db
  • SqlDatabaseChain from langchain/chainsSqlDatabaseChainfrom langchain/chains

️Summarization ️综述

A chain can be used to . One way is to input , after they have been into , and over them with a ain. You can also for the chain that does to be a , or a . See more about the them here摘要链可用于汇总多个文档。一种方法是在将多个较小的文档分成块后输入它们,并使用ain对它们进行操作。您也可以选择将执行摘要的链设置为或。在此处查看有关它们之间差异的更多信息

import { OpenAI } from "langchain/llms/openai" ; import { loadSummarizationChain } from "langchain/chains" ; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter" ; import * as fs from "fs" ; export const run = async () = { // In this example, we use a `MapReduceDocumentsChain` specifically prompted to summarize a set of documents. const text = fs.readFileSync( "state_of_the_union.txt" , "utf8" ); const model = new OpenAI({ temperature: 0 }); const textSplitter = new RecursiveCharacterTextSplitter({ chunkSize: 1000 }); const docs = await textSplitter.createDocuments([text]); // This convenience function creates a document chain prompted to summarize a set of documents. const chain = loadSummarizationChain(model, { type : "map_reduce" }); const res = await chain.call({ input_documents: docs, }); console .log({ res }); /* { res: { text: ' President Biden is taking action to protect Americans from the COVID-19 pandemic and Russian aggression, providing economic relief, investing in infrastructure, creating jobs, and fighting inflation. He is also proposing measures to reduce the cost of prescription drugs, protect voting rights, and reform the immigration system. The speaker is advocating for increased economic security, police reform, and the Equality Act, as well as providing support for veterans and military families. The US is making progress in the fight against COVID-19, and the speaker is encouraging Americans to come together and work towards a brighter future.' } } */ };

API Reference:

  • OpenAI from langchain/llms/openai OpenAI从 langchain/llms/openai
  • loadSummarizationChain from langchain/chainsloadSummarizationChainfrom langchain/chains
  • RecursiveCharacterTextSplitter from langchain/text_splitter递归字符文本从 langchain/text_splitter 拆分器

Intermediate Steps​ 中间步骤

We can also the steps for , we want to them. This is done with the eps .如果我们想检查它们,我们还可以返回 链的中间步骤。这是使用 eps 参数完成的。

import { OpenAI } from "langchain/llms/openai" ; import { loadSummarizationChain } from "langchain/chains" ; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter" ; import * as fs from "fs" ; export const run = async () = { // In this example, we use a `MapReduceDocumentsChain` specifically prompted to summarize a set of documents. const text = fs.readFileSync( "state_of_the_union.txt" , "utf8" ); const model = new OpenAI({ temperature: 0 }); const textSplitter = new RecursiveCharacterTextSplitter({ chunkSize: 1000 }); const docs = await textSplitter.createDocuments([text]); // This convenience function creates a document chain prompted to summarize a set of documents. const chain = loadSummarizationChain(model, { type : "map_reduce" , returnIntermediateSteps: true , }); const res = await chain.call({ input_documents: docs, }); console .log({ res }); /* { res: { intermediateSteps: [ "In response to Russia's aggression in Ukraine, the United States has united with other freedom-loving nations to impose economic sanctions and hold Putin accountable. The U.S. Department of Justice is also assembling a task force to go after the crimes of Russian oligarchs and seize their ill-gotten gains.", "The United States and its European allies are taking action to punish Russia for its invasion of Ukraine, including seizing assets, closing off airspace, and providing economic and military assistance to Ukraine. The US is also mobilizing forces to protect NATO countries and has released 30 million barrels of oil from its Strategic Petroleum Reserve to help blunt gas prices. The world is uniting in support of Ukraine and democracy, and the US stands with its Ukrainian-American citizens.", " President Biden and Vice President Harris ran for office with a new economic vision for America, and have since passed the American Rescue Plan and the Bipartisan Infrastructure Law to help struggling families and rebuild America's infrastructure. This includes creating jobs, modernizing roads, airports, ports, and waterways, replacing lead pipes, providing affordable high-speed internet, and investing in American products to support American jobs.", ], text: "President Biden is taking action to protect Americans from the COVID-19 pandemic and Russian aggression, providing economic relief, investing in infrastructure, creating jobs, and fighting inflation. He is also proposing measures to reduce the cost of prescription drugs, protect voting rights, and reform the immigration system. The speaker is advocating for increased economic security, police reform, and the Equality Act, as well as providing support for veterans and military families. The US is making progress in the fight against COVID-19, and the speaker is encouraging Americans to come together and work towards a brighter future.", }, } */ };

API Reference:

  • OpenAI from langchain/llms/openai OpenAI从 langchain/llms/openai
  • loadSummarizationChain from langchain/chainsloadSummarizationChainfrom langchain/chains
  • RecursiveCharacterTextSplitter from langchain/text_splitter递归字符文本从 langchain/text_splitter 拆分器
声明:本站所有作品(图文、音视频)均由用户自行上传分享,本文由"吃土少年"自行发布,本站仅供存储和学习交流。若您的权利被侵害,请联系我们删除。如若转载,请注明出处:https://www.flipbrief.com/smart/bUjVCfvC.html