Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with tools #19

Merged
merged 2 commits into from
Sep 9, 2024
Merged

Working with tools #19

merged 2 commits into from
Sep 9, 2024

Conversation

butschster
Copy link
Member

@butschster butschster commented Sep 9, 2024

$agent = new Agent(
    key: self::NAME,
    name: 'Web Scrapping Agent',
    description: 'An agent that scrapes websites to collect URLs and their associated titles.',
    instruction: 'You are a web scraping assistant.',
);
  1. In some cases we need to call specific tool or ask LLM that it must use one of the provided tools, but doesn’t force a particular tool.
use LLM\Agents\Tool\ToolChoice;

$aggregate->addMetadata(
    // Instruct an agent to always return tool calls result
    new SolutionMetadata(
        type: MetadataType::Configuration,
        key: 'tool_choice',
        content: ToolChoice::specific('find_links'),
    ),
);

// or

$aggregate->addMetadata(
    // Instruct an agent to always return tool calls result
    new SolutionMetadata(
        type: MetadataType::Configuration,
        key: 'tool_choice',
        content: ToolChoice::any(),
    ),
);
  1. Adds a new interceptor for tools execution if LLM asks about it.
$aggregate->addMetadata(
    // Instruct an agent to always return tool calls result
    new SolutionMetadata(
        type: MetadataType::Configuration,
        key: 'return_tool_result',
        content: true,
    ),
);

1. In some cases we need to call specific tool or ask LLM that it must use one of the provided tools, but doesn’t force a particular tool.
2. Adds a new interceptor for tools execution if LLM asks about it.
@butschster butschster added the enhancement New feature or request label Sep 9, 2024
@butschster butschster merged commit ddccce5 into master Sep 9, 2024
@butschster butschster deleted the feature/tool-choise branch September 9, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant