# `LlmComposer.FunctionExecutor`
[🔗](https://github.com/doofinder/llm_composer/blob/master/lib/llm_composer/function_executor.ex#L1)

Provides manual execution of function calls from LLM responses.

This module allows users to explicitly execute individual function calls
returned by the LLM, without automatic execution. It's designed for manual
control over function invocation and result handling.

## Usage

After receiving a response with function calls, use `execute/2` to
manually execute each function call with its arguments parsed and
validated before invocation.

# `execute`

```elixir
@spec execute(LlmComposer.FunctionCall.t(), [LlmComposer.Function.t()]) ::
  {:ok, LlmComposer.FunctionCall.t()} | {:error, term()}
```

Executes a single function call and returns the updated FunctionCall with result.

## Parameters
  - `function_call`: The FunctionCall struct to execute
  - `functions`: List of Function definitions available for execution

## Returns
  - `{:ok, executed_call}`: FunctionCall with result populated
  - `{:error, reason}`: Error tuple if execution fails

## Possible Errors
  - `{:error, :function_not_found}`: Named function not in definitions
  - `{:error, {:invalid_arguments, reason}}`: Failed to parse JSON arguments
  - `{:error, {:execution_failed, reason}}`: Exception during function execution

---

*Consult [api-reference.md](api-reference.md) for complete listing*
