LangEx.LLM.Gemini (LangEx v0.11.3)

Copy Markdown View Source

Google Gemini chat adapter with function calling support.

Supports Gemini models via the /v1beta/models/{model}:generateContent endpoint.

Tool Calling

Pass :tools (list of %LangEx.Tool{}) to enable function calling. The adapter returns {:ok, %Message.AI{tool_calls: [...]}} when the model requests a function call. Use LangEx.Tool.Node to execute them.

LangEx.LLM.Gemini.chat(messages,
  model: "gemini-2.5-flash",
  tools: [%LangEx.Tool{name: "get_weather", ...}]
)

Options

  • :tool_choice — force function calling: :auto (default), :required/ :any (must call some function), or {:tool, name} (must call that one)