ReqLLM.Examples.Agent (ReqLLM v1.0.0-rc.5)

View Source

A GenServer-based AI agent that uses ReqLLM for streaming text generation with tool calling.

This agent provides a conversation interface with maintained history and supports function calling capabilities with Claude 3.5's streaming format.

Usage

# Start the agent
{:ok, agent} = ReqLLM.Examples.Agent.start_link()

# Send a prompt
ReqLLM.Examples.Agent.prompt(agent, "What's 15 * 7?")

# Agent streams response to stdout and returns final text
#=> {:ok, "15 * 7 = 105"}

Features

  • Streaming text generation with real-time output
  • Tool calling with proper argument parsing from Claude 3.5
  • Conversation history maintenance
  • Two-step completion for tool usage scenarios
  • Calculator and web search tools included

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

prompt(pid, message)

prompt(pid, model, message)

start_link(opts \\ [])