Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

langchaingo

> AI 编程
Open source

LangChain for Go, the easiest way to write LLM-based programs in Go

9.6K stars0 likes1 views
WebsiteGitHub

About

LangChain for Go, the easiest way to write LLM-based programs in Go

Join our new official Discord community! Connect with other LangChain Go developers, get help and contribute: Join Discord

️ LangChain Go

⚡ Building applications with LLMs through composability, with Go! ⚡

What is this?

This is the Go language implementation of LangChain.

Documentation

  • Documentation Site
  • API Reference

Examples

See ./examples for example usage.

go
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)
}
bash
$ go run .
Socktastic

Resources

Join the Discord server for support and discussions: Join Discord

Here are some links to blog posts and articles on using Langchain Go:

  • Using Gemini models in Go with LangChainGo - Jan 2024
  • Using Ollama with LangChainGo - Nov 2023
  • Creating a simple ChatGPT clone with Go - Aug 2023
  • Creating a ChatGPT Clone that Runs on Your Laptop with Go - Aug 2023

Contributors

There is a momentum for moving the development of langchaingo to a more community effort, if you are interested in being a maintainer or you are a contributor please join our Discord and let us know.

Issues· 419 open

View all issuesOpen on GitHub
  • #1529

    llms/anthropic: GenerateContent never calls HandleLLMGenerateContentEnd on success

    Updated Sep 20, 2026
  • #1507

    googleai: panic on system-only message list in GenerateContent

    Updated Sep 12, 2026
  • #1486

    is this project dead?

    Updated Sep 4, 2026
  • #1514

    llms/ollama: WithThink has no effect — think is serialized inside "options" (API expects top-level) and omitempty drops false

    Updated Jul 26, 2026
  • #1512

    Documentation offline

    Updated Jul 20, 2026
  • #1497

    OpenAI GPT-5.4: Unable to set reasoning effort = none with temperature = 0

    Updated May 22, 2026
  • #987

    Custom multi-input tools

    Updated Apr 16, 2026
  • #1493

    WithStreamingReasoningFunc is untested and not working with Ollama and Claude

    Updated Apr 15, 2026
  • #1490

    Support Gemma 4 tool calling token pairs

    Updated Apr 8, 2026
  • #1456

    Anthropic CacheControl not working properly

    Updated Mar 31, 2026

> Tags

Goaigogolanglangchain

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.