langchaingo

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2025 License: MulanPSL-2.0 Imports: 0 Imported by: 0

README

自主实现langchainGo中的RouterChain

langchain

LangChain 是一个用于开发由语言模型驱动的应用程序的框架。我们相信,最强大和不同的应用程序不仅将通过 API 调用语言模型,还将:

  • 数据感知:将语言模型与其他数据源连接在一起。
  • 主动性:允许语言模型与其环境进行交互。 因此,LangChain 框架的设计目标是为了实现这些类型的应用程序。

如上是langchain中文网的介绍

我们可以理解为langchain是一款框架、一种方案,用于解决应用程序与大模型的交互

langchainGo

此项目是基于 https://github.com/tmc/langchainGo 项目的扩展,langchainGo是Go语言版本的langchain,封装了对大模型产品调用的应用方案如:agent、memory、chains等。

通过langchainGo可以使得我们的程序能够与大模型很好的交互并实现某一些特定业务需求,比如让大模型与系统业务接轨,也可实现一个用于编写文章、项目代码的程序。

langchainGo虽然是Go语言版本的langchain,但是在实现上与langchain还是有较多功能不足,其中就有如无RouterChain、Summarybuffer等相关机制,因此在本项目中基于langchainGo完善一些这功能比编写一些其他也具有价值的工具。

如:

  • callback:添加自定义日志监听和token监听
  • outputparser:增加结构化字段解析支持多样化类型的处理
  • toolx/finaloutput:对调用langchain的时候存在异常情况下的兜底解析处理

Documentation

Index

Constants

View Source
const (
	// ChatId
	ChatId = "ChatId"

	Input = "input"

	OutPutKey = "text"

	History = "history"

	InPromptKey  = "in_prompt"
	LLMPromptKey = "prompt_string"
	LLMOutPutKey = "out_string"
)

Variables

This section is empty.

Functions

func ErrReturn added in v1.0.1

func ErrReturn(out map[string]any) map[string]any

func OkReturn added in v1.0.1

func OkReturn(out map[string]any, data any) map[string]any

Types

This section is empty.

Directories

Path Synopsis
llmsx
toolx

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL