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

相关内容

热门资讯

海南全岛封关时间定了!啥是封关... 国家发展改革委副主任王昌林7月23日在国新办发布会上表示,关于海南自贸港封关的具体时间,经党中央批准...
华能国际完成发行20亿元科技创... 7月23日早间,华能国际发布公告称,公司已于近日完成2025年面向专业投资者公开发行科技创新可续期公...
AWS的智能体基础设施布局:开... 智能体基础设施正在快速成为人工智能下一次飞跃的支柱——不仅仅是实现智能化,更是协调其安全、高效和大规...
中国移动、中国电信、中国联通,... 莫名其妙订了新业务、套餐资费眼花缭乱、接到境外骚扰电话,这些都是电信用户常见的消费痛点。近日,中国移...
上海黄金回收价高秤准还懂老物件... 上海宝易埠珠宝:黄金回收背后的故事 在上海这个繁华喧嚣的大都市,每一条街道都诉说着独特的故事,每一家...
厉害!浙大95后博导白天搞科研... 白天,他是数字法学界的“破壁者”。傍晚,他是“浙BA”球场上的“破局者”。五冠加身的荣耀,科研攻坚的...
宏润建设:7月22日融资买入1... 证券之星消息,7月22日,宏润建设(002062)融资买入1454.54万元,融资偿还8319.83...
苹果在华销售额二季度同比下滑1... 7月23日消息,据多家媒体报道,根据市场调研机构Counterpoint最新数据,2025年第二季度...
恒生电子:7月22日融券卖出2... 证券之星消息,7月22日,恒生电子(600570)融资买入2.37亿元,融资偿还3.05亿元,融资净...
上交所:苏州创元投资发展(集团... 7月23日,上交所发布关于苏州创元投资发展(集团)有限公司2025年面向专业投资者公开发行科技创新公...
和讯投顾赵冰忆:水电站概念盘活... 7月22日,和讯投顾赵冰忆表示,眼下水电站概念足以盘活市场。一方面,水电站有定远方面的业务支撑;另一...
注册资本150亿元,中国聚变能... 可控核聚变概念图 图片来源:视觉中国 7月22日晚间,中国核电发布消息称,当日由其参股的中国聚变能源...
天力复合:7月22日融资买入1... 证券之星消息,7月22日,天力复合(873576)融资买入145.39万元,融资偿还168.55万元...
“3C”标志非商品 违法制售要... 马云骢 “禁止旅客携带没有3C标识、3C标识不清晰、被召回型号或批次的充电宝乘坐境内航班。”近期,民...
亚通股份被责令改正,时任董事长... 雷达财经 文|冯秀语 编|李亦辉 7月22日,上海亚通股份有限公司(证券简称:亚通股份,证券代码:6...
京东美团杀入了同一片战场 作者 | 周智宇 编辑 | 张晓玲 在具身智能的牌桌上,美团一直是那个下注最凶的玩家。它早已将触角伸...
业务创新 | 商业银行谱写养老... 文/中国建设银行平台运营中心 张丰安 肖璧微 我国人口老龄化问题加剧,养老金融发展面临严峻挑战,20...
多行业“反内卷”,持续推进中! 汽车、光伏、水泥、钢铁,不同行业,同在“反内卷”!从7月1日中央财经委员会第六次会议,到近期国务院常...
运输规模稳步增长!今年上半年我... (央视财经《经济信息联播》)今天(21日),民航局相关负责人在国新办新闻发布会上介绍,“十四五”期间...
对话Outer创始人刘佳科:6... 作者:欧雪 编辑:彭孝秋 Outer又有新动作了,这次是推出第二个大单品。 2018年,Outer第...