langchain 初体验
创始人
2025-05-31 04:05:50
0次

langchain 初体验

最近的AI发展令人又兴奋又焦虑啊啊啊啊啊啊啊啊啊 🎀🎢👓🎒🏈

  • 早上看medium发来的邮件看到这样一篇文章,感觉很有意思

    Create your Document ChatBot with GPT-3 and Langchain

    medium的免费额度比较头疼,可以尝试把文章名字放到Google里面搜一下,然后看别的

  • 在这篇文章了解到了langchain

    • 然后去了它的官方文档,看到它可以比较容易地实现对话历史记忆

      Adding Memory To an LLMChain

    • 还在huggingface上面看到一个有趣的项目

      GPT + WolframAlpha + Whisper

  • 我用下面那个huggingface上面的项目试了试两个例子

    • (3x/sin2x) 在 x趋近于0的时候,极限是多少,用latex格式写出计算过程

      下面这个回答过程很严谨,但是答案错了哈哈哈,是3/2呀

      As xxx approaches 0, the limit of 3xsin⁡2x\frac{3x}{\sin2x}sin2x3x​ is 3. To calculate this, we start by rewriting the expression as 3x2sin⁡xcos⁡x\frac{3x}{2\sin x \cos x}2sinxcosx3x​. Then, as xxx approaches 0, the sine and cosine terms both approach 0, leaving us with 32cos⁡x\frac{3}{2\cos x}2cosx3​. Finally, as xxx approaches 0, the cosine term approaches 1, leaving us with the limit of 3.

    • (3x/e^x) 在 x趋近于0的时候,极限是多少,用latex格式写出计算过程

      As xxx approaches 0, the limit of 3xex\frac{3x}{e^x}ex3x​ is 0. To calculate this, we must first take the limit of the fraction as xxx approaches 0. This can be done by dividing both the numerator and denominator by xxx. As xxx approaches 0, the numerator will approach 0, while the denominator will approach e0e^0e0, which is equal to 1. Therefore, the limit of 3xex\frac{3x}{e^x}ex3x​ as xxx approaches 0 is 0.

      To calculate this limit, we must first consider the fraction 3xex\frac{3x}{e^x}ex3x​. As xxx approaches 0, the numerator will approach 0, while the denominator will approach e0e^0e0, which is equal to 1. By dividing both the numerator and denominator by xxx, we can simplify the fraction to 3ex\frac{3}{e^x}ex3​. As xxx approaches 0, the denominator will approach 1, and the limit of the fraction will be equal to the numerator, which is 3. Therefore, the limit of 3xex\frac{3x}{e^x}ex3x​ as xxx approaches 0 is 0.

  • 之后试着实践下langchain的代码~

  • 此外CSDN 也有两篇介绍

    大语言模型集成工具 LangChain_kebijuelun的博客-CSDN博客

    使用langchain打造自己的大型语言模型(LLMs)_-派神-的博客-CSDN博客


  • what is langchain ? 以下是 phind.com 的回答

    What is langchain

    ANSWER

    LangChain is a tool that provides many modules to build language model applications [0]. It is a library that can be used to create advanced use cases around large language models (LLMs) by chaining together different components [4]. Here are some of the things that LangChain can help with [3]:

    • Prompt management: LangChain provides a set of utilities for managing prompts, which are inputs that are passed to LLMs to generate outputs.
    • Chains: LangChain provides a standard interface for chains, which are sequences of calls to LLMs or other utilities. This allows for more complex applications to be built.
    • Data Augmented Generation: This involves chains that interact with external data sources to fetch data to use in the generation step. Examples of this include summarization of long pieces of text and question/answering over specific data sources.
    • Agents: These are LLMs that make decisions about which actions to take, take that action, observe the output, and then repeat the process until done. LangChain provides a standard interface for agents, a selection of agents to choose from, and examples of end-to-end agents.
    • Memory: LangChain provides a standard interface for memory, which allows for state to be persisted between calls of a chain or agent.
    • Generative models: LangChain provides prompts/chains for assisting in the evaluation of generative models.

    LangChain can be used to build a variety of language model applications. For example, suppose we want to build a service that generates a company name based on what the company makes. Here’s how we can use LangChain to do this [0]:

    • We first import the LLM wrapper and initialize it with any arguments. In this example, we probably want the outputs to be more random, so we initialize it with a high temperature.
    • We then construct a prompt using the PromptTemplate utility. We take only the user input describing what the company does, and then format the prompt with that information.
    • We create an LLMChain which takes user input, formats it with the prompt, and then passes the formatted response to the LLM.

    LangChain also allows for more complex applications to be built. For example, we can use LangChain to build an agent that uses an LLM to determine which actions to take and in what order [0]. Here’s how we can do this:

    • We first load the language model we’re going to use to control the agent and some tools to use.
    • We then initialize an agent with the tools, the language model, and the type of agent we want to use. In this example, we use the zero-shot-react-description agent.
    • We can then test out the agent by running it with some input.

    LangChain also provides a standard interface for memory, which allows for state to be persisted between calls of a chain or agent [3]. For example, we can use the ConversationChain utility to create a chain that has some concept of “memory”. By default, the ConversationChain has a simple type of memory that remembers all previous inputs/outputs and adds them to the context that is passed. We can use this to build a chatbot that remembers previous messages and uses context from that to have a better conversation [0].

相关内容

热门资讯

在大吉订购APP订购交易亏损被...   近期,不少投资者反映在“大吉订购App”上投资白银、铂金等商品遭遇严重亏损。该平台宣称提供现货订...
铂银壹号APP商品订购交易亏损...   许多中小投资者误以为网上的“商品现货订购”是合规合法的理财渠道,殊不知这背后隐藏着巨大的合规风险...
兴鑫淘金APP贵金属订购交易亏...   白银、贵金属或其他商品类投资,除国家批准的正规期货交易场所及持牌期货公司外,市面上大量第三方交易...
铂银掘金APP无资质的违规平台...   铂银掘金等平台的投资者,往往是被“注册送现金”“充值返现券”“首单免亏”等广告话术吸引,进而下载...
八方淘金APP订购交易不合规,...   “八方淘金APP”“铂银掘金APP”“铂银壹号APP”等软件被指以“现货订购”为名,实际采用高杠...
在指尖订购APP订购商品亏损被...   指尖订购APP这类平台,表面是“订购交易”,实则是披着电商外衣的非法期货陷阱。绝大多数投资者被蒙...
在犀贝易购APP做商品订购交易...   市面上打着“现货投资”“贵金属交易”旗号的APP并不少,但真正合规、受监管的平台并不多。犀贝易购...
易达淘金APP虚假商品订购交易...   易达淘金APP存在严重的虚假宣传与违规交易行为。该平台打着“商品订购”的旗号,实则通过不合规的交...
大浪淘金APP白银订购亏损被骗...   大浪淘金APP最隐蔽的套路,在于其完全封闭的内盘交易系统。表面上,它宣称与国际贵金属市场接轨;实...
一品好购APP上订购白银出现亏...   一品好购APP原名“一品订购”,运营方为上海宝智未来信息技术有限公司。近期不少投资者反映在该平台...
九州订购APP贵金属订购投资骗...   九州订购APP正通过抖.音、快手、今日头条等平台大量投放投资广告,用“5元起投”“充值返现”“0...
坚锅淘金APP交易软件并不正规...   当前,市面上大量所谓的“现货商城订购”交易软件,早已偏离了正常的实物商品买卖,演变为高杠杆、高手...
斗金订购APP贵金属期货交易骗...   斗金订购APP的投资者往往被铺天盖地的广告宣传所诱导——注册即送现金、充值返现券等看似诱人的福利...
警惕!云启购APP违规经营,披...   "5元起投、充值返现、稳赚不赔"——这些诱人的广告语背后,可能是一个精心设计的金融陷阱。  近期...
量子淘金APP贵金属投资不合规...   "4元起投""充值返券""月入过万"——这些极具诱惑力的广告语在短视频平台、社交软件上铺天盖地。...
鑫汇智投APP贵金属商品订购骗...   鑫汇智投APP非法期货投资骗局,受害者在投资过程中根本不懂交易,也不去研究和验证这个平台是否正规...
矅光智策APP平台违规经营非法...   矅光智策APP对外宣称是“商城订购”“现货交易”,但查询其经营范围,并未显示具备开展现货期货交易...
黄金珠宝怎么选?内侧刻字都代表... 潮新闻客户端 记者 马焱 通讯员 任倩影 9月8日下午,“云游杭州 乐购金秋”——“浙城·浙放心”活...
原创 冰... 最近全球国债市场正在上演魔幻一幕: 美债、日债、欧债遭遇猛烈抛售,收益率冲到几十年新高,美国财政部都...
日韩股市开盘表现分化 上证报中国证券网讯 9月9日,日韩股市开盘表现分化,韩国综合指数开盘上涨0.26%,报6972.87...