摘要: Creational patterns provide object creation mechanisms that increase flexibility and reuse of existing code. Factory method: Provides an interface for 阅读全文
posted @ 2024-01-23 15:11 Zhentiw 阅读(46) 评论(0) 推荐(0)
摘要: Just for fun... Given a number (always positive) as a type. Your type should return the number decreased by one. For example: type Zero = MinusOne<1> 阅读全文
posted @ 2022-10-07 22:57 Zhentiw 阅读(77) 评论(0) 推荐(0)
摘要: Blog: https://www.geeksforgeeks.org/es6-trampoline-function/ Stackoverflow problem for recursion: const sumBelow = (number, sum = 0) => ( number 0 ? s 阅读全文
posted @ 2022-08-18 14:32 Zhentiw 阅读(71) 评论(0) 推荐(0)
摘要: Serverless framework with AWS Link to each sections Table of Content: Part 0: Serverless Project structure Part 1: DynamoDB & ApiGateway Part 2: Event 阅读全文
posted @ 2021-05-17 15:15 Zhentiw 阅读(171) 评论(0) 推荐(0)
摘要: Storage Services: S3 Glacier CloudFront Elastic Block Store (EBS) Storage Gateway Snow family Database Overview Block storage: Used on local networks 阅读全文
posted @ 2021-03-15 03:06 Zhentiw 阅读(179) 评论(0) 推荐(0)
摘要: S3 Features Prefiees and delimiters For example: the file name in S3 can be: `marking/plans/kpi_2021_1.pdf`. The point is make it looks like a folder 阅读全文
posted @ 2021-03-12 17:34 Zhentiw 阅读(170) 评论(0) 推荐(0)
摘要: In our previous code, we have seen this partten for operators: // #region operators const concat = curry((broadcaster, listener) => { let string = ''; 阅读全文
posted @ 2020-10-25 21:54 Zhentiw 阅读(168) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2020-05-07 18:22 Zhentiw 阅读(0) 评论(0) 推荐(0)
摘要: Generators can yield promises which can work with the "for await of" loop syntax. This lesson shows how all the pieces fit together and explains why t 阅读全文
posted @ 2020-03-22 02:59 Zhentiw 阅读(177) 评论(0) 推荐(0)
摘要: In this post, we are going to see how to use Ramda Lens. For example, we have data: R.lens: R.lens takes a getter and a setter: R.lensProp: There is a 阅读全文
posted @ 2019-02-24 20:12 Zhentiw 阅读(731) 评论(0) 推荐(0)
摘要: Just like the State ADT an Array is also an Applicative Functor. That means we can do the same tricks with liftA2 with Array that we have been doing w 阅读全文
posted @ 2019-01-16 16:30 Zhentiw 阅读(725) 评论(0) 推荐(0)
摘要: Use custom Cypress command for reusable assertions We’re duplicating quite a few commands between the registration and login of our user for assertion 阅读全文
posted @ 2018-12-06 21:13 Zhentiw 阅读(444) 评论(0) 推荐(0)
摘要: Use Cypress to test user registration Let’s write a test to fill out our registration form. Because we’ll be running this against a live backend, we n 阅读全文
posted @ 2018-12-05 15:54 Zhentiw 阅读(366) 评论(0) 推荐(0)
摘要: Despite the fact that Cypress is an application that runs natively on your machine, you can install it and add it as a dependency just like all other 阅读全文
posted @ 2018-12-05 02:38 Zhentiw 阅读(590) 评论(0) 推荐(0)
摘要: Ensure Functions are Called Correctly with JavaScript Mocks Often when writing JavaScript tests and mocking dependencies, you’ll want to verify that t 阅读全文
posted @ 2018-11-06 04:25 Zhentiw 阅读(440) 评论(0) 推荐(0)
摘要: 1. Color Picker (Chrome) You might know how to use color picker in Chrome, recently there is a feature inside color picker which is "Contrast Ratio", 阅读全文
posted @ 2018-07-15 18:41 Zhentiw 阅读(257) 评论(0) 推荐(0)
摘要: We'll examine how to unnest function calls, capture assignment, and create a linear data flow with a type we call Box. This is our introduction to wor 阅读全文
posted @ 2016-12-11 21:47 Zhentiw 阅读(347) 评论(0) 推荐(0)
摘要: Well, this stuff will be a little bit strange if you deal with it first time. Container Object: Just a wrapper / contianer for values No Method No Nou 阅读全文
posted @ 2016-09-06 04:23 Zhentiw 阅读(352) 评论(0) 推荐(0)
摘要: First, what is 'High Order function', basic just a function, inside the function return another fuction. For example: Decorators is a subset of high o 阅读全文
posted @ 2016-06-14 03:10 Zhentiw 阅读(392) 评论(0) 推荐(0)
摘要: Somehow it looks like reflect in Java. For example: We define an mothod on the Object, it called defineMethod(). It accepts two arguements, one is met 阅读全文
posted @ 2016-05-02 03:06 Zhentiw 阅读(393) 评论(0) 推荐(0)
摘要: 外界获取中断的值 用户编辑图状态 工具内的中断 验证用户输入 外界获取中断的值 result.__interrupt__ 就是中断时,langgraph 暴露给外界的数据。外界(UI / CLI / 后端系统)就是靠它拿到 interrupt 里传出的内容的。 interrupt({ // 配置要传 阅读全文
posted @ 2026-03-19 14:26 Zhentiw 阅读(4) 评论(0) 推荐(0)
摘要: 基本介绍 一句话定义:静态断点,是在编译图时就确定好的中断点,用于保证某个节点在执行前或执行后一定会暂停。 静态断点的两种形式 LangGraph 提供了两种静态断点配置方式: interrupt_before:在指定节点 开始执行之前 暂停。 interruptBefore: ["node_nam 阅读全文
posted @ 2026-03-17 14:18 Zhentiw 阅读(5) 评论(0) 推荐(0)
摘要: 基本介绍 langgraph中的中断分为两种: 静态断点 动态中断 1. 静态断点 在编译图时配置。适用于“在某个节点执行前或后必须暂停”的场景。 interrupt_before=["node_name"]: 在指定节点开始执行前暂停。 interrupt_after=["node_name"]: 阅读全文
posted @ 2026-03-16 14:42 Zhentiw 阅读(5) 评论(0) 推荐(0)
摘要: 中断指的就是允许图在执行的过程中暂停,等待外部输入。这种机制提供了一种“人类参与”的交互模式,某些场景下某些决策非常重要,需要人类来做出最终抉择,这个时候就可以使用中断。 场景案例 下面我们先来看一下,如果不使用中断,是否能够实现下面的场景: 需求:让大模型帮我们书写邮件,人类给出反馈 approv 阅读全文
posted @ 2026-03-13 14:14 Zhentiw 阅读(2) 评论(0) 推荐(0)
摘要: 前面我们已经知道:长期记忆的核心作用,是存储用户的长期信息,例如用户画像、偏好、背景事实等。 但如果长期记忆只支持“精确匹配”,那它的价值其实是有限的。 真正让长期记忆“变聪明”的能力,那就是语义搜索。 为什么长期记忆一定要配合语义搜索? 用户之前说过:我很喜欢吃披萨 那么当他之后说:我有点饿了 A 阅读全文
posted @ 2026-03-12 14:34 Zhentiw 阅读(6) 评论(0) 推荐(0)
摘要: 长期记忆是需要长久保持的,长期记忆通常用于存储: 用户画像 偏好 历史习惯 长期事实(不会频繁变) 例如: 用户是前端工程师 用户更喜欢中文回答 用户不需要基础解释 用户常问某一类问题 凡是“不应该被时间旅行影响的事实”,就应该放进长期记忆,而非短期记忆。下面是短期记忆和长期记忆两者之间的对比: 维 阅读全文
posted @ 2026-03-12 14:17 Zhentiw 阅读(6) 评论(0) 推荐(0)
摘要: 随着对话会随着轮数不断增长。 这时候,一个非常现实的问题就会出现:对话越聊越长,最终可能会超出大模型的上下文窗口限制。 这并不是 langgraph 独有的问题,而是所有基于大模型的长对话系统都会遇到的限制。 为了解决这个问题,通常有几种常见的处理思路。 裁剪消息 永久删除消息 总结消息 自定义策略 阅读全文
posted @ 2026-03-11 14:24 Zhentiw 阅读(9) 评论(0) 推荐(0)
摘要: 在入门和演示阶段,我们使用的是: new MemorySaver() 它足够简单,也非常适合理解机制。但一旦进入真实工程环境,就会立刻遇到一个问题:内存是靠不住的。 服务重启,短期记忆就没了 多实例部署,内存无法共享 无法支持稳定的时间旅行和恢复 这也是为什么官方在生产环境示例中,直接给出了 Pos 阅读全文
posted @ 2026-03-10 14:24 Zhentiw 阅读(11) 评论(0) 推荐(0)
摘要: 这节课我们来介绍一下记忆。在 langgraph 中,记忆分为两种: 短期记忆:Short-term Memory 长期记忆:Long-term Memory 基本概念 所谓短期记忆,指的就是在某一个 thread 内持续演化的 State。只要 State 在同一个 thread_id 下被反复传 阅读全文
posted @ 2026-03-08 15:01 Zhentiw 阅读(4) 评论(0) 推荐(0)
摘要: 所谓时间旅行(时间回溯),指的就是可以从先前的检查点恢复执行。 这个特性核心就是利用 checkpoint 来实现的。 如下图所示: 假设我们执行一张图,要经历 A -> B -> C -> D -> E 在执行 C 节点的时候,状态还可以有 C' 的可能性,但是又不想从头开始执行整张图,因为 A 阅读全文
posted @ 2026-03-06 14:53 Zhentiw 阅读(5) 评论(0) 推荐(0)