Skip to content

Generators Overview

pkgs/genx/generators manages the registration and selection of genx.Generator. The caller uses the pattern to select the Generator, and then executes the generation with the unified ModelContext -> Stream contract, without directly binding the specific model protocol.

Go API References

Structure

ModulesResponsibilities
OpenAI AdapterConvert OpenAI-compatible Chat Completions to GenX message, stream, tool call and usage.
Gemini AdapterConvert Gemini GenerateContent to the same GenX contract.

Core structure and main function

SymbolFunction
MuxStores the route of pattern to Generator and complete the matching.
NewMuxCreate an independent Generator registry.
HandleRegister the Generator with the default registry.
GenerateStreamSelect Generator and return the generated result Stream.
InvokeRequest the model to call the specified FuncTool, and return the usage and parsed call.

Generators only manage generating protocols and routes. Model configuration, credentials, tenants, and product catalog do not belong to this package.