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

Commit 66a0eb3

Browse files
committed
feat: extend tool configuration for chain in chain, overwrite and thrid party
1 parent 53fdc4e commit 66a0eb3

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,23 @@ llm_chain:
5151
include_tools: true # Include tool definitions at the end of the system prompt
5252
tools:
5353
- 'PhpLlm\LlmChain\Chain\ToolBox\Tool\SimilaritySearch'
54+
- service: 'App\Chain\Tool\CompanyName'
55+
name: 'company_name'
56+
description: 'Provides the name of your company'
57+
method: '__invoke'
58+
- 'llm_chain.chain.research'
5459
research:
5560
platform: 'llm_chain.platform.anthropic'
5661
model:
5762
name: 'Claude'
5863
tools: # If undefined, all tools are injected into the chain, use "tools: false" to disable tools.
5964
- 'PhpLlm\LlmChain\Chain\ToolBox\Tool\Wikipedia'
65+
- 'App\Chain\Tool\CompanyName'
6066
fault_tolerant_toolbox: false # Disables fault tolerant toolbox, default is true
67+
as_tool:
68+
name: 'wikipedia_research'
69+
description: 'Answers questions based on a research in Wikipedia'
70+
input: 'Question to be researched'
6171
store:
6272
# also azure_search, mongodb and pinecone are supported as store type
6373
chroma_db:
@@ -71,6 +81,11 @@ llm_chain:
7181
model:
7282
name: 'Embeddings'
7383
version: 'text-embedding-ada-002'
84+
tools:
85+
- service: 'App\Chain\Tool\CompanyName'
86+
name: 'company_name'
87+
description: 'Provides the name of your company'
88+
method: '__invoke'
7489
```
7590
7691
## Usage

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"require": {
1717
"php": ">=8.2",
18-
"php-llm/llm-chain": "^0.18",
18+
"php-llm/llm-chain": "dev-feat-multiple-metadata-factories",
1919
"symfony/config": "^6.4 || ^7.0",
2020
"symfony/dependency-injection": "^6.4 || ^7.0",
2121
"symfony/framework-bundle": "^6.4 || ^7.0",

tests/Profiler/TraceableToolBoxTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class TraceableToolBoxTest extends TestCase
2020
#[Test]
2121
public function getMap(): void
2222
{
23-
$metadata = new Metadata('Foo\Bar', 'bar', 'description', '__invoke', null);
23+
$metadata = new Metadata('bar', 'description', '__invoke', null);
2424
$toolBox = $this->createToolBox(['tool' => $metadata]);
2525
$traceableToolBox = new TraceableToolBox($toolBox);
2626

@@ -32,7 +32,7 @@ public function getMap(): void
3232
#[Test]
3333
public function execute(): void
3434
{
35-
$metadata = new Metadata('Foo\Bar', 'bar', 'description', '__invoke', null);
35+
$metadata = new Metadata('bar', 'description', '__invoke', null);
3636
$toolBox = $this->createToolBox(['tool' => $metadata]);
3737
$traceableToolBox = new TraceableToolBox($toolBox);
3838
$toolCall = new ToolCall('foo', '__invoke');

0 commit comments

Comments
 (0)