ToolRegistry

org.llm4s.toolapi.ToolRegistry
See theToolRegistry companion object
class ToolRegistry(initialTools: Seq[ToolFunction[_, _]])

Registry for tool functions with execution capabilities.

Supports both synchronous and asynchronous tool execution:

  • execute() - Synchronous, blocking execution (original API)
  • executeAsync() - Asynchronous, non-blocking execution
  • executeAll() - Batch execution with configurable strategy

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Concrete methods

def addToAzureOptions(chatOptions: ChatCompletionsOptions): ChatCompletionsOptions

Adds the tools from this registry to an Azure OpenAI ChatCompletionsOptions

Adds the tools from this registry to an Azure OpenAI ChatCompletionsOptions

Value parameters

chatOptions

The chat options to add the tools to

Attributes

Returns

The updated chat options

def execute(request: ToolCallRequest): Either[ToolCallError, Value]
def executeAll(requests: Seq[ToolCallRequest], strategy: ToolExecutionStrategy)(implicit ec: ExecutionContext): Future[Seq[Either[ToolCallError, Value]]]

Execute multiple tool calls with a configurable strategy.

Execute multiple tool calls with a configurable strategy.

Value parameters

ec

ExecutionContext for async execution

requests

The tool call requests to execute

strategy

Execution strategy (Sequential, Parallel, or ParallelWithLimit)

Attributes

Returns

Future containing results in the same order as requests

def executeAsync(request: ToolCallRequest)(implicit ec: ExecutionContext): Future[Either[ToolCallError, Value]]

Execute a tool call asynchronously.

Execute a tool call asynchronously.

Wraps synchronous execution in a Future for non-blocking operation.

Value parameters

ec

ExecutionContext for async execution

request

The tool call request

Attributes

Returns

Future containing the result

def getOpenAITools(strict: Boolean): Arr
def getTool(name: String): Option[ToolFunction[_, _]]
def getToolDefinitions(provider: String): Value
def tools: Seq[ToolFunction[_, _]]