LLMAgent.Plugin (llm_agent v0.2.0)

View Source

Implements the AgentForge.Plugin behavior for LLM integrations.

This module provides a plugin implementation that registers LLM-specific tools and allows LLMAgent to integrate with different LLM providers.

Summary

Functions

Calls an LLM provider with the given parameters.

Initializes the LLMAgent plugin.

Returns metadata about the LLMAgent plugin.

Parses an LLM response into a structured format.

Registers LLM-specific primitives with AgentForge.

Registers LLM-specific tools with AgentForge.

Functions

call_llm(params)

Calls an LLM provider with the given parameters.

Parameters

  • params - A map with parameters:
    • provider - The LLM provider to use (e.g., :openai, a module)
    • messages - The conversation messages
    • tools - Available tools for the LLM
    • options - Provider-specific options

Returns

A map with the LLM response.

init(opts)

Initializes the LLMAgent plugin.

Checks that required dependencies are available for the specified provider.

Parameters

  • opts - Plugin options including provider selection

Returns

:ok if initialization succeeds, {:error, reason} otherwise.

Examples

iex> LLMAgent.Plugin.init(provider: :mock)
:ok

metadata()

Returns metadata about the LLMAgent plugin.

Returns

A map with plugin metadata.

parse_llm_response(params)

Parses an LLM response into a structured format.

Parameters

  • params - A map with parameters:
    • response - The raw LLM response
    • format - The desired output format

Returns

A structured representation of the LLM response.

register_primitives()

Registers LLM-specific primitives with AgentForge.

Returns

:ok if registration succeeds.

register_tools(registry)

Registers LLM-specific tools with AgentForge.

Parameters

  • registry - The AgentForge tool registry

Returns

:ok if registration succeeds.