1 2 3 4 5 ··· 494 下一页
摘要: 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 阅读(30) 评论(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 阅读(68) 评论(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 阅读(55) 评论(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 阅读(168) 评论(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 阅读(166) 评论(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 阅读(165) 评论(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 阅读(163) 评论(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 阅读(175) 评论(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 阅读(725) 评论(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 阅读(720) 评论(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 阅读(440) 评论(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 阅读(363) 评论(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 阅读(589) 评论(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 阅读(437) 评论(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 阅读(252) 评论(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 阅读(342) 评论(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 阅读(349) 评论(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 阅读(389) 评论(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 阅读(390) 评论(0) 推荐(0)
摘要: invoke/stream() 方法,方法签名如下: invoke/stream( input: Input, options?: RunnableConfig ): AsyncGenerator<StreamEvent<Output>> 1. 输入参数 (input) 类型:Input 与 inv 阅读全文
posted @ 2025-11-26 22:54 Zhentiw 阅读(12) 评论(0) 推荐(0)
摘要: 什么是回退机制? 可以理解为一种“保险机制”,就像: A 计划不行 → 执行 B 计划 A 服务器挂了 → 走 B 节点 A 模型限流 → 让本地模型顶上 主模型出错时,自动调用备用模型继续执行,用户无感知,体验不中断 如何实现回退 早期的时候,LangChain.js 没有提供相应的 API,所以 阅读全文
posted @ 2025-11-25 14:43 Zhentiw 阅读(5) 评论(0) 推荐(0)
摘要: LangChain Hub LangChain Hub 是一个托管 Prompt 与 Chain 配置的集中仓库(可以理解成 Hugging Face Hub 的“提示词版”)。 它允许开发者: 上传 / 分享 自己的 prompt、chain 配置; 下游用户可以直接通过一个 key (autho 阅读全文
posted @ 2025-11-22 16:50 Zhentiw 阅读(27) 评论(0) 推荐(0)
摘要: 什么是 Agent 基础篇Agent概念 不是指的 AI 智能体,而是指代理服务器。 代理服务器充当用户和模型交流的中间人。 Agent: 狭义:代理服务器 广义:AI智能体(AI Agent) 什么是AI Agent AI Agent,中文称之为“AI智能体”,本质上是能自主感知环境,进行规划与决 阅读全文
posted @ 2025-11-19 15:08 Zhentiw 阅读(15) 评论(0) 推荐(0)
摘要: 在实际开发中,经常还有如下的需求: 禁止模型调用某个工具 强制调用某个工具 注册多个函数工具 禁止模型调用工具 默认情况下,模型会自行决定是否使用 tool。但有时你希望它只能用自己的知识回答,怎么办? 你可以通过 tool_choice: "none" 禁用工具调用。 const result = 阅读全文
posted @ 2025-11-18 01:09 Zhentiw 阅读(21) 评论(0) 推荐(0)
摘要: 作者:谢杰 原子化文件写入,是属于 原子化操作 的一种。那么问题来了,什么又是原子化操作呢? 原子化操作:英语 Atomic,指的是操作要么全部发生,要么完全不发生,对读者而言,中间状态是不可见的。 原子写入(Atomic Write) 可以保证文件不存在中间半写入状态,与之相对应的是 撕裂写(To 阅读全文
posted @ 2025-11-17 15:18 Zhentiw 阅读(17) 评论(0) 推荐(0)
摘要: 目前我们所使用的 Memory,大多只存在于内存中,一旦进程关闭、用户刷新页面,所有历史对话都会丢失。实际项目中,我们常常希望: 让用户“第二次回来”还能接着上次对话继续聊 将多轮聊天记录保存在本地或数据库中,用于分析、审计、训练、回溯 这时候,我们就需要将 Memory 做持久化操作,从而实现“记 阅读全文
posted @ 2025-11-16 23:07 Zhentiw 阅读(35) 评论(0) 推荐(0)
摘要: 上一节我们体验了“手动维护聊天记录”,每次都要: 把用户发言添加到 history 把模型输出添加到 history 每轮都手动调用 getMessages() 构造上下文 await history.addMessage(new HumanMessage(input)); await histor 阅读全文
posted @ 2025-11-14 14:57 Zhentiw 阅读(9) 评论(0) 推荐(0)
摘要: 大模型本身是无状态的,每次调用都只看当前输入。如果要在多轮对话中维持上下文,就需要 Memory 模块来存储和管理对话历史。 LangChain.js 针对 Memory 提供了多个工具类,先来学习最常用的 ChatMessageHistory 快速上手案例: import { ChatMessag 阅读全文
posted @ 2025-11-14 14:55 Zhentiw 阅读(7) 评论(0) 推荐(0)
摘要: RAG 标准流程: 索引:外挂知识库 检索 生成 Advanced RAG 针对上述 3 个阶段做了优化。例如检索阶段,新增了 检索前处理 以及 检索后处理。 检索前处理: 查询转换 查询扩充 ...... 查询扩充(Query Expansion) 在不改变用户意图的前提下,添加相关词语或同义表达 阅读全文
posted @ 2025-11-09 20:03 Zhentiw 阅读(24) 评论(0) 推荐(0)
1 2 3 4 5 ··· 494 下一页