LangChain4j operates on two levels of abstraction:
LangChain4j 提供了两种类型API抽象
Low level. At this level, you have the most freedom and access to all the low-level components such as ChatModel, UserMessage, AiMessage, EmbeddingStore, Embedding, etc. These are the "primitives" of your LLM-powered application. You have complete control over how to combine them, but you will need to write more glue code.
低级API:比较偏底层,你拥有最大的自由度,可以访问所有底层组件,如ChatModel、UserMessage、AiMessage、EmbeddingStore、Embedding等。这些组件是你基于大型语言模型(LLM)的应用的“基本构建块”。你可以完全控制如何组合它们,但需要编写更多像胶水一样的粘合代码。
High level. At this level, you interact with LLMs using high-level APIs like AI Services, which hides all the complexity and boilerplate from you. You still have the flexibility to adjust and fine-tune the behavior, but it is done in a declarative manner.
高级API:在这一层面,你通过使用像AI Services 这样的高级应用程序编程接口(API)与大型语言模型(LLM)进行交互,这些API会为你隐藏所有复杂性和模板内容。
你仍然可以灵活地调整和微调行为,但这是以声明性的方式完成的。