2025-05-07 22:56:32 +03:00
2025-05-07 22:56:32 +03:00
2025-05-07 22:56:32 +03:00
2023-07-25 19:52:30 -07:00
2024-09-13 04:39:28 +00:00

⚠️ This is a fork of the original github.com/tmc/langchaingo repository.

🦜🔗 LangChain Go (fork)

go.dev reference scorecard Open in Dev Containers

Building applications with LLMs through composability, with Go!

🚀 Important Announcement 🚀

Starting from release v0.1.13-update.1, this fork is now a full-fledged library that does not require any replace directives in your go.mod file. You can simply add it to your project with:

go get github.com/vxcontrol/langchaingo@latest

Why this fork?

This fork was created to incorporate functionality from open Pull Requests that haven't been merged into the original repository yet. You can view the list of accepted PRs in our v0.1.13-update.0 release and in the main-pull-requests branch.

Additionally, this repository contains custom improvements and enhancements related to langchaingo support, which will be published as releases. The original repository's state can be accessed in the main branch, which will be regularly updated with upstream changes.

This fork is primarily maintained for use in the PentAGI project, an autonomous AI Agents system for performing complex penetration testing tasks.

Branch Structure and Versioning

This repository follows a specific branching strategy to maintain both upstream compatibility and custom enhancements:

Branch Management

  • main: Fully synchronized with upstream (tmc/langchaingo). Never force-pushed.
  • main-pull-requests: Contains merged PRs from upstream that haven't been officially merged. Rebased on main after synchronization (commit hashes will change).
  • main-vxcontrol: Default branch containing all current enhancements. Rebased on main-pull-requests (commit hashes will change).
  • release/v*: Created from main-vxcontrol for each release. These branches are stable and never force-pushed.

Versioning

Release tags follow the format v0.1.13-update.1, where:

  • v0.1.13 corresponds to the latest upstream release version
  • -update.1 indicates our increment number (starting at 1 and incrementing with each new release)

Each new release cumulatively includes all changes from previous releases on top of the current upstream state, ensuring that you always get the complete set of enhancements when using a specific tag.

Dependency Management

Important: When using this fork in your projects, always reference release tags rather than commit hashes. This ensures proper dependency resolution since branches like main-vxcontrol undergo rebasing and their commit hashes change over time.

go get github.com/vxcontrol/langchaingo@v0.1.13-update.1

Branch Visualization

  main              A---B---C---D---E---F   (synced with upstream)
                     \
  main-pull-requests   \---G---H---I        (rebased on main, PRs from upstream)
                          \
  main-vxcontrol           \---J---K---L    (default branch, rebased on main-pull-requests)
                                \
  release/vM.M.P-update.N        M          (tagged stable release)

For Contributors

If you want to contribute to this fork, please create Pull Requests based on the current state of the main-vxcontrol branch. Even though commit hashes in this branch may change due to rebasing, your contributions will be included in the next release when enough changes have accumulated.

When creating a PR, please ensure your changes are well-tested and include appropriate documentation. Once merged, your contributions will be included in the next stable release with fixed commit hashes.

Acknowledgements

Special thanks to Travis Cline (@tmc) and all contributors who have made this project possible.

Original resources

🤔 What is this?

This is the Go language implementation of LangChain.

📖 Documentation

🎉 Examples

See ./examples for example usage.

package main

import (
  "context"
  "fmt"
  "log"

  "github.com/vxcontrol/langchaingo/llms"
  "github.com/vxcontrol/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

Resources

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

Contributors

S
Description
LangChain for Go, the easiest way to write LLM-based programs in Go
Readme MIT 20 MiB
Latest
2026-03-15 11:58:21 -04:00
Languages
Go 99.8%
Makefile 0.2%