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

相关内容

热门资讯

三亚凤凰国际机场附近停车场突发... 1月30日中午,网传三亚凤凰国际机场附近一停车场发生大火,不少车辆被烧,并产生大量浓烟,14时许,三...
胖东来好做法,上升为省级标准! 政府工作报告提出,推广胖东来经验,打造一批带动面广、显示度高的消费新场景。这一提法正在通过一系列河南...
BLUEBERRY:四季度黄金... 从需求结构来看,四季度黄金需求再创新高,为全年走势画上了一个具有象征意义的句号。 这一现象表明,在不...
石药集团185亿美元出海背后:... 中国创新药再现百亿美元巨额BD(商务拓展)交易。 1月30日,石药集团(01093.HK)公告称,与...
华熙生物董事长商业版图盘点 近日,华熙集团董事长、华熙生物董事长兼总裁赵燕“让人能够健康,能蹦能跳,能吃能睡的活到超过120岁”...
从资本集聚到IPO爆发!千灯湖... 1月29日,由千灯湖创投特色小镇入驻机构——浙江振石新材料股份有限公司正式在上交所主板挂牌上市。 事...
马斯克被曝推进太空算力 利用太... 快科技1月30日消息,据媒体报道,美国企业家埃隆·马斯克正探索整合旗下核心资产(包括SpaceX、特...
90后戴龙升任总经理,身兼多职... 1月30日早上,新诺威(SZ300765,市值546亿元)迎来新任总经理和新任董事会秘书,二人皆为“...
黄金、白银历史价格和库存数据(... 黄金、白银历史价格和库存数据(2026年更新) 黄金、白银历史价格和库存数据(2026年更新) 黄金...
任和、张仲麟:低空经济要成型,... “低空经济”如火如荼,许多城市都在加速“向天空要增量”:无人机物流、电力巡检、农业植保、应急救援等应...
北交所上市公司*ST云创登龙虎... 每经讯,2026年1月30日,北交所上市公司*ST云创(920305,收盘价:7.1元)登上龙虎榜,...
中国通信服务荣膺「金紫荆奖」「... 1 月 30 日,由香港大公文汇传媒集团联合香港中国企业协会、香港中国金融协会、香港中资证券业协会、...
马斯克被曝筹划推进太空算力 新华社北京1月30日电 据多家媒体29日报道,美国企业家埃隆·马斯克正考虑整合旗下资产,从而推进太空...
中国银河给予银行行业推荐评级:... 每经AI快讯,中国银河1月30日发布研报,给予银行行业推荐评级。 市场风格切换,主动型资金延续欠配状...
国电南瑞:公司持续深耕虚拟电厂... 证券日报网讯 1月29日,国电南瑞在互动平台回答投资者提问时表示,近年来,国家大力推动电力现货市场建...
美元持续下跌 “抛售美国”现象... 美国财政部长斯科特·贝森特对“强势美元政策”的确认未能逆转美元跌势。美元反弹戛然而止,1月29日再度...
暴跌!刚上车就亏没了!黄金还能... “上周才买了黄金,这周直接跳水!” “不是说避险资产吗?怎么跌得比股票还狠?” 国际金价连续下跌...
东海航运保险迎来新任董事长吴冰... 近期,东海航运保险股份有限公司(以下简称“东海航运保险”)发布公告称,董事会选举吴冰灿任第二届董事会...
美元大涨、黄金暴跌!特朗普挑了... 财联社1月30日讯(编辑 潇湘)随着有消息人士透露特朗普政府正准备提名凯文·沃什担任下一任美联储主席...