Behavior and facade for Language Model integrations.
GEPA optimizers talk to LLMs through this normalized facade rather than provider-specific code. The facade accepts plain text prompts and OpenAI-compatible chat/multimodal message lists; adapters can decide how much of that surface they support.
Summary
Functions
Builds a local CLI/agent client backed by Agent Session Manager.
Convenience function to call complete/3 on any LLM implementation.
Completes a prompt and returns a structured map.
Returns the default LLM provider based on application configuration.
Builds a normalized GEPA LLM client.
Builds a hosted-provider client backed by ReqLLM.
Streams a prompt when the selected normalized client supports streaming.
Wrap a one- or two-arity callable in a cost/token tracking LLM.
Types
Callbacks
@callback complete(llm :: t(), prompt :: prompt(), opts :: completion_opts()) :: {:ok, String.t()} | {:error, term()}
@callback complete_structured(llm :: t(), prompt :: prompt(), opts :: completion_opts()) :: structured_result()
Functions
@spec agent( atom(), keyword() ) :: GEPA.LLM.Client.t()
Builds a local CLI/agent client backed by Agent Session Manager.
@spec complete(t(), prompt(), completion_opts()) :: {:ok, String.t()} | {:error, term()}
Convenience function to call complete/3 on any LLM implementation.
@spec complete_structured(t(), prompt(), completion_opts()) :: structured_result()
Completes a prompt and returns a structured map.
@spec default() :: t()
Returns the default LLM provider based on application configuration.
@spec new( :req_llm | :agent_session_manager | :asm, keyword() ) :: GEPA.LLM.Client.t()
Builds a normalized GEPA LLM client.
@spec req_llm( atom(), keyword() ) :: GEPA.LLM.Client.t()
Builds a hosted-provider client backed by ReqLLM.
@spec stream(t(), prompt(), completion_opts()) :: {:ok, Enumerable.t()} | {:error, term()}
Streams a prompt when the selected normalized client supports streaming.
@spec track(function() | t()) :: GEPA.LLM.Tracking.t() | t()
Wrap a one- or two-arity callable in a cost/token tracking LLM.