Skip to content

rev044/eino

 
 

Repository files navigation

Eino

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.

Overview

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

Features

  • πŸ”— 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

Installation

go get github.com/eino-project/eino

Quick Start

package 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)
}

Documentation

Project Structure

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

Personal Notes

Things I've found useful while exploring this codebase:

  • The compose package is the best place to start β€” chain.go and graph.go are well-commented
  • Streaming works by passing a StreamReader through the graph; see schema/streaming.go for 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.go fan-out nodes copy the stream or just pass the same reader β€” suspect there's a gotcha there

About

The ultimate LLM/AI application development framework in Go.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 99.6%
  • Shell 0.4%