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].

相关内容

热门资讯

走进小城看消费丨江西资溪:低碳...   夏日时节下午4点,江西省抚州市资溪县大觉山景区漂流终点依然热闹。来自南昌的游客余鑫漂流结束后没有...
【中原晨会0625】市场分析专... 来源:市场资讯 (来源:中原证券研究所) 本期重点研报目录 【中原策略】市场分析:电子半导体领涨 ...
南向资金连买4日!低费率+可月... 6月25日早盘,港股红利资产震荡整理。截至11时14分,港股红利低波ETF招商(520550)下跌0...
618成交破百万!紫荆花用一套... 一年一度的618年中大促,是消费市场的晴雨表,也是品牌间最激烈的角力场。当各大品牌在直播间里铆足了劲...
原创 黄... 2026年6月25日的国际金价已经从前期的5500美元高点跌到4200美元下方,累计跌幅超过22%,...
英伟达CEO:Vera Rub... 截至9:38,中证半导体材料设备主题指数(931743)涨2.36%创新高;权重股中,中微公司涨3....
再被催债16亿!“钢铁大王”戴... 澎湃新闻记者 贺梨萍 因“铁本事件”入狱五年的戴国芳重返钢铁行业,但他并没有完成从阶下囚再到“钢铁大...
周三原油价格下跌 随着美国和伊朗在和平谈判中取得进展,越来越多的油轮公开穿越霍尔木兹海峡,原油在战时的价格上涨已经蒸发...
这种蛋白是大脑衰老的开关 这种蛋白是大脑衰老的开关 清晨,假设一位五十岁左右的王女士发现自己常常把手机放在熟悉的抽屉里又找不到...
信通院牵头算力Token出海生... 盘面上,截至11:04,中证科创创业50指数(931643)涨1.68%,创历史新高;权重股中,芯原...
海外 774 亿营收背后:日本... 文 | 游戏价值论 6月23日,彭博社报道了腾讯正在围绕出售多家日本游戏工作室少数股权开展谈判,包...
餐饮“抢人”大战:把店开到公交... 作者 |餐饮老板内参 内参君 医院、公交站、演唱会…餐饮品牌,正在无孔不入 在北京儿童医院,肯德基...
快讯 | 外资扫货!陈翊庭:港... 港交所行政总裁陈翊庭在接受《中国证券报》专访时指出,国际资本对中国资产的看法已彻底扭转,布局中国市场...
2777.77元!A股“股王”... 25日早盘,昨天创下历史新高的A股“股王”联讯仪器,今天上午继续走强,盘中股价再度刷新历史新高。 截...
原创 今... 欧洲自己的媒体直接下结论,欧盟衰退躲不掉,内部分裂拦不住,现在就连欧洲顶尖工业巨头,都偷偷在用中国的...
黄仁勋股东大会放言:本轮AI基... 在当地时间6月24日的英伟达(NVDA.O)2026年度股东大会上,股东批准了该公司全部10名董事会...
国际油价大跌 新华社消息, 纽约原油期货主力合约价格24日盘中跌破每桶70美元,为伊朗战事爆发以来首次。 市场分析...
马云带队插秧,什么信号? 一场别开生面的“务农”,让外界看到了一个不一样的阿里巴巴。 近日,阿里巴巴合伙人、高德董事长刘振飞在...
全球最大产能,最高丰度达99.... 本文转自【科技日报】; 6月23日,高丰度硼-10同位素技术暨产业化成果发布会在山东省东营市举办,全...
黄金大跳水!金饰克价年内暴跌近... 25日,现货黄金盘中震荡,截至发稿,报3985.070美元/盎司,跌0.17%。 当地时间24日,...