Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Let the tool decide if the chain should be called again with the return value #168

@OskarStark

Description

@OskarStark

In my case I craft a dedicated response like:

{
  "foo": "bar",
}

and I don't want to feed it back to the LLM for another roundtrip.

That happens here (in Line 55):

while ($output->response instanceof ToolCallResponse) {
$toolCalls = $output->response->getContent();
$messages[] = Message::ofAssistant(toolCalls: $toolCalls);
foreach ($toolCalls as $toolCall) {
$result = $this->toolBox->execute($toolCall);
$messages[] = Message::ofToolCall($toolCall, $result);
}
$output->response = $this->chain->call($messages, $output->options);

I think we should not make it configurable like "Tool A will always feed back to the API", because it can depend on runtime. Maybe a ToolResponse class as an additional allowed return type?

Dummy-code

new class ToolResponse {
    value: string, float etc.
    callLlm: yes/no
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions