Part 17 of the GoWind series — back to the framework internals. Post 3 showed how to write your own plugin; this one tours the AI plugins that ship with go-wind-plugins, because "add an LLM to my backend" has become as ordinary as "add a cache" — and deserves the same treatment: a config block, a client, no ceremony.

Three integrations ship out of the box, and they represent three different levels of abstraction:

Plugin Import path Underlying framework
OpenAI plugins/ai/openai sashabaranov/go-openai
LangChainGo plugins/ai/langchaingo tmc/langchaingo
Eino plugins/ai/eino cloudwego/eino

All three follow the same rule: each sub-module defines its own config and client and returns the native types of its SDK — no lowest-common-denominator interface in between. More on why that matters at the end.

Path 1: OpenAI plugin — when you just want chat completion

client, _ := openai.NewClient(&openai.Config{ Type: openai.ModelTypeCloud, // or ModelTypeLocal (e.g. Ollama) ModelName: "gpt-4", TimeoutSeconds: 30, Cloud: &openai.CloudConfig{ ApiKey: "sk-xxx", BaseUrl: "https://api.openai.com/v1", }, }) 

Chat completion is the textbook call, and streaming is first-class — the shape every SSE frontend expects:

stream, _ := client.CreateChatCompletionStream(ctx, req) defer stream.Close() for { chunk, err := stream.Recv() if err != nil { break } fmt.Print(chunk.Choices[0].Delta.Content) } 

Configured from YAML like everything else in the framework:

ai: openai: api_key: ${OPENAI_API_KEY} model: gpt-4 base_url: "https://api.openai.com/v1" timeout: 30s max_retries: 3 

Path 2: LangChainGo — chains, agents, memory

When the task is orchestration rather than a single call, the LangChainGo plugin hands you the llms.Model plus helpers for Chain / Agent / Memory / Embedding / VectorStore:

llm, err := langchaingo.NewModel(&langchaingo.Config{ Type: langchaingo.ModelTypeCloud, ModelName: "gpt-4o", Cloud: &langchaingo.CloudConfig{ApiKey: "sk-xxx", BaseUrl: "https://api.openai.com/v1"}, // Local: &langchaingo.LocalConfig{ ... }, // Ollama & friends }) // Chain orchestration chain := langchaingo.NewLLMChain(llm, prompt) result, _ := chains.Call(ctx, chain, map[string]any{"text": "..."}) // Agent agent := langchaingo.NewOneShotAgent(llm, agentTools) executor := langchaingo.NewExecutor(agent) 

Options pass through to the underlying SDK (WithOpenaiOptions / WithOllamaOptions / WithHTTPClient), so you never lose the knobs.

Path 3: Eino — graphs and tool nodes

CloudWeGo's Eino brings graph-shaped orchestration (Chain / Graph / Workflow) with explicit tool nodes:

chatModel, _ := eino.NewChatModel(ctx, &eino.Config{ModelName: "gpt-4o"}, eino.WithConfigModifier(func(cfg *einoOpenai.ChatModelConfig) { cfg.Temperature = &temp // native config: adjust freely })) chain := eino.NewChain[Input, Output]() graph := eino.NewGraph[Input, Output]() toolNode, _ := eino.NewToolNode(ctx, &compose.ToolsNodeConfig{}) 

This is the path the family's product features use when AI needs branching workflows with tool calls — the Agent canvases in Admin and CMS are built on this layer.

Cloud vs. local is one config field

Every plugin supports ModelTypeCloud and ModelTypeLocal — the local path points at Ollama or any compatible endpoint. Same code, different deployment:

ai: langchaingo: type: local # local | cloud  model: llama3 local: base_url: "http://localhost:11434" 

Routing without a leaky abstraction

Here's the design decision worth stealing. The plugin layer deliberately has no shared Client interface, because the three SDKs' types are mutually incompatible — a lowest-common-denominator wrapper would strangle each SDK's strengths. Instead, route behind a minimal interface on the business side, where you know what you actually need:

type ChatClient interface { Chat(ctx context.Context, prompt string) (string, error) } type ModelRouter struct { cloud ChatClient // langchaingo / openai local ChatClient // Ollama via ModelTypeLocal } func (r *ModelRouter) Chat(ctx context.Context, prompt string) (string, error) { if isSensitive(prompt) { return r.local.Chat(ctx, prompt) // sensitive data never leaves the box } return r.cloud.Chat(ctx, prompt) } 

Sensitive prompts to the local model, everything else to the cloud — one interface method, defined by the business, not by the plugin author guessing your needs.

Where to look

If you're wiring an LLM into a Go service this week, tell us which of the three paths you picked and why — the split between them is the most-commented-on design point in the framework right now.

Next in the series: a self-hosted foreign-trade suite in Go — inquiry to payment, PI/CI documents, and Alibaba.com sync.