Algorithmic Vision | Learning | Coding

LangChain Agent: Tutorial And Idea Behinds It

LangChain Agent简介 Agent的核心理念:“use a language model to choose a sequence of actions to take”。在Chain类的概念中,一系列的action是提前预设好且按照固定顺序执行的,而对于agent来讲,它的后端有一个LLM来根据用户的输入做推理,因此会“选择”action进行执行,并且自行决定执行的顺序。 Agent流程 Chain流程 Agent必要的组件 Prompt LLM Tool Parser 当前LangChain文档中主流的Agent的构建逻辑基本遵循着以下的流程 初始化prompt, llm, tools, parser 将tools b... Read more

iOS Development 05: Generic

Don’t Care Type 泛型代码让你能根据自定义的需求,编写出适用于任意类型的、灵活可复用的函数及类型。 Basic Grammar Generic Function The generic version of the function uses a placeholder type name (called T, in this case) instead of an actual type name (such as Int, String, or Double). T can be any name. The actual type to use in place of T is determined at each time the generic func... Read more

iOS Development 04: MVVM Design Pattern

MVVM设计模式 Model-View-ViewModel is a design paradigm. It must be adhered to for SwiftUI to work. Model UI Independent Data + Logic View The reflection of the Model Stateless Declared(只有“var body”决定了view是如何绘制的) Reactive (Always reacting efficiently to the change on the model) Automatically observes publications from ViewMod... Read more

iOS Development 03: Protocol

协议[Protocols] 总结来看,协议为Swift提供了一种方便,灵活的对类型进行抽象描述的方式。 A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements. Any type that satisfies the re... Read more

iOS Development 02: Function, Struct & Class

函数[Function] func functionName(arg1: Type1) -> Type2 { ... ... } 闭包[Closure] 跟随闭包[Trailing Closure] If you need to pass a closure expression to a function as the function’s final argument and the closure expression is long, it can be useful to write it as a trailing closure instead. You write a trailing closure after the function... Read more