tmc/langchaingo

GitHub: tmc/langchaingo

这是 LangChain 框架的 Go 语言实现,旨在帮助开发者使用 Go 语言轻松构建基于大语言模型的应用程序。

Stars: 9053 | Forks: 1080

# 🦜️🔗 LangChain Go [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/tmc/langchaingo) [![scorecard](https://goreportcard.com/badge/github.com/tmc/langchaingo)](https://goreportcard.com/report/github.com/tmc/langchaingo) [![](https://dcbadge.vercel.app/api/server/t9UbBQs2rG?compact=true&style=flat)](https://discord.gg/t9UbBQs2rG) [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/tmc/langchaingo) [](https://codespaces.new/tmc/langchaingo) ⚡ 使用 Go 通过组合方式构建 LLM 应用! ⚡ ## 🤔 这是什么? 这是 [LangChain](https://github.com/langchain-ai/langchain) 的 Go 语言实现。 ## 📖 文档 - [文档站点](https://tmc.github.io/langchaingo/docs/) - [API 参考](https://pkg.go.dev/github.com/tmc/langchaingo) ## 🎉 示例 请参阅 [./examples](./examples) 以查看使用示例。 ``` package main import ( "context" "fmt" "log" "github.com/tmc/langchaingo/llms" "github.com/tmc/langchaingo/llms/openai" ) func main() { ctx := context.Background() llm, err := openai.New() if err != nil { log.Fatal(err) } prompt := "What would be a good company name for a company that makes colorful socks?" completion, err := llms.GenerateFromSinglePrompt(ctx, llm, prompt) if err != nil { log.Fatal(err) } fmt.Println(completion) } ``` ``` $ go run . Socktastic ``` # 资源 加入 Discord 服务器以获取支持和讨论:[加入 Discord](https://discord.gg/8bHGKzHBkM) 以下是一些关于使用 Langchain Go 的博客文章和文章链接: - [Using Gemini models in Go with LangChainGo](https://eli.thegreenplace.net/2024/using-gemini-models-in-go-with-langchaingo/) - 2024年1月 - [Using Ollama with LangChainGo](https://eli.thegreenplace.net/2023/using-ollama-with-langchaingo/) - 2023年11月 - [Creating a simple ChatGPT clone with Go](https://sausheong.com/creating-a-simple-chatgpt-clone-with-go-c40b4bec9267?sk=53a2bcf4ce3b0cfae1a4c26897c0deb0) - 2023年8月 - [Creating a ChatGPT Clone that Runs on Your Laptop with Go](https://sausheong.com/creating-a-chatgpt-clone-that-runs-on-your-laptop-with-go-bf9d41f1cf88?sk=05dc67b60fdac6effb1aca84dd2d654e) - 2023年8月 # 贡献者 我们正推动将 langchaingo 的开发转变为更多社区参与的努力,如果您有兴趣成为维护者或者您是贡献者,请加入我们的 [Discord](https://discord.gg/8bHGKzHBkM) 并告诉我们。
标签:AI应用, AI开发, AI风险缓解, C2, Dev Containers, DLL 劫持, DNS解析, EVTX分析, Gemini, GitHub Codespaces, Golang, Go语言, LangChain, LLM, NLP, OpenAI, Petitpotam, Prompt, Unmanaged PE, 人工智能, 代码示例, 内存规避, 大语言模型, 安全编程, 开发框架, 开源项目, 提示词工程, 数据分析, 日志审计, 生成式AI, 用户模式Hook绕过, 程序破解, 策略决策点, 索引, 轻量级