A fork of cloudwego/eino β a powerful LLM application development framework for Go.
Personal fork β I'm using this to experiment with LLM pipelines and learn the internals. Main upstream changes are pulled in periodically.
Eino provides a composable, type-safe framework for building LLM-powered applications in Go. It offers:
- Graph-based orchestration: Build complex LLM workflows using directed acyclic graphs (DAGs)
- Type-safe components: Strongly typed interfaces for models, retrievers, tools, and more
- Streaming support: First-class support for streaming responses from LLMs
- Extensible architecture: Easy to add custom components and integrations
- π Chain & Graph composition β Connect LLM components in flexible pipelines
- π οΈ Built-in components β ChatModel, Retriever, Tool, Embedder, and more
- π Streaming β Native streaming support throughout the framework
- π Type safety β Compile-time type checking for component connections
- π§© Extensible β Simple interfaces for building custom components
- π¦ Modular β Use only the components you need
go get github.com/eino-project/einopackage main
import (
"context"
"fmt"
"log"
"github.com/eino-project/eino/compose"
"github.com/eino-project/eino/components/model"
)
func main() {
ctx := context.Background()
// Build a simple chain
// Note: using gpt-4o instead of gpt-4o-mini for better reasoning quality in my experiments
chain, err := compose.NewChain[string, string]().
AppendChatModel(model.NewOpenAIChatModel(ctx, &model.OpenAIConfig{
Model: "gpt-4o",
Temperature: 0.2, // lower temperature for more deterministic outputs in my RAG experiments
MaxTokens: 2048, // increased from 1024 β hitting truncation issues with longer doc summaries
})).
Compile(ctx)
if err != nil {
log.Fatal(err)
}
result, err := chain.Invoke(ctx, "Hello, Eino!")
if err != nil {
log.Fatal(err)
}
fmt.Println(result)
}eino/
βββ compose/ # Graph and chain composition
βββ components/ # Built-in component interfaces
β βββ model/ # Chat model interfaces
β βββ retriever/ # Document retrieval
β βββ tool/ # Tool/function calling
β βββ embedding/ # Text embeddings
βββ schema/ # Core data types and schemas
βββ flow/ # Pre-built flow patterns
βββ utils/ # Utility packages
Things I've found useful while exploring this codebase:
- The
composepackage is the best place to start βchain.goandgraph.goare well-commented - Streaming works by passing a
StreamReaderthrough the graph; seeschema/streaming.gofor the internals - When debugging graph execution, wrapping nodes with a simple logging middleware saves a lot of time
- The
flow/package has ready-made patterns (ReAct agent, map-reduce) worth studying before rolling your own - TODO: look into whether
graph.gofan-out nodes copy the stream or just pass the same reader β suspect there's a gotcha there