- Updated the `github.com/ollama/ollama` dependency from v0.17.5 to v0.18.0 in go.mod files for multiple modules and examples, ensuring compatibility with the latest features and improvements. - Updated go.sum files to reflect the new dependency version, maintaining consistency across the project.
⚠️ This is a fork of the original github.com/tmc/langchaingo repository.
🦜️🔗 LangChain Go (fork)
⚡ 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
replacedirectives 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) using fast-forward merges. - main-pull-requests: Contains useful PRs from upstream that haven't been officially merged. Updated by merging from
mainafter synchronization. - main-vxcontrol: Default branch containing all current enhancements including module name changes and stability improvements. Updated by merging from
main-pull-requests. - release/v*: Created from
main-vxcontrolfor each release. These branches are stable to use in production, all tags are linked to these branches.
Versioning
Release tags follow the format v0.1.13-update.1, where:
v0.1.13corresponds to the latest upstream release version-update.1indicates 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 for stable and predictable dependencies.
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---J (merged from main, PRs from upstream)
\ \
main-vxcontrol K---L---M (default branch, merged from main-pull-requests)
\
release/vM.M.P-update.N N (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. 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.
Acknowledgements
Special thanks to Travis Cline (@tmc) and all contributors who have made this project possible.
Original resources
- Documentation: pkg.go.dev/github.com/tmc/langchaingo
- Discord: Join the official LangChain Go community
🤔 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
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.