Skip to content

Commit 58da3b1

Browse files
authored
docs(toolbox-core): Add guide on how to use with various orchestration frameworks (#46)
* docs(toolbox-core): Add guide on how to use with various orchestration frameworks * resolve comments * resolve comments
1 parent 90c61a7 commit 58da3b1

File tree

1 file changed

+97
-1
lines changed

1 file changed

+97
-1
lines changed

packages/toolbox-core/README.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ custom logic) managed by the Toolbox into your workflows, especially those
1414
involving Large Language Models (LLMs).
1515

1616
<!-- TOC ignore:true -->
17-
<!-- TOC -->
1817
- [Supported Environments](#supported-environments)
1918
- [Installation](#installation)
2019
- [Quickstart](#quickstart)
@@ -43,6 +42,7 @@ involving Large Language Models (LLMs).
4342
- [Option A: Binding Parameters to a Loaded Tool](#option-a-binding-parameters-to-a-loaded-tool)
4443
- [Option B: Binding Parameters While Loading Tools](#option-b-binding-parameters-while-loading-tools)
4544
- [Binding Dynamic Values](#binding-dynamic-values)
45+
- [Using with Orchestration Frameworks](#using-with-orchestration-frameworks)
4646
- [Contributing](#contributing)
4747
- [License](#license)
4848
- [Support](#support)
@@ -447,6 +447,102 @@ const dynamicBoundTool = tool.bindParam("param", getDynamicValue)
447447
> [!IMPORTANT]
448448
> You don't need to modify tool configurations to bind parameter values.
449449
450+
# Using with Orchestration Frameworks
451+
452+
<details open>
453+
454+
<summary>Langchain</summary>
455+
456+
[LangchainJS](https://js.langchain.com/docs/introduction/)
457+
458+
```javascript
459+
import {ToolboxClient} from "@toolbox/core"
460+
import { tool } from "@langchain/core/tools";
461+
462+
let client = ToolboxClient(URL)
463+
multiplyTool = await client.loadTool("multiply")
464+
465+
const multiplyNumbers = tool(multiplyTool, {
466+
name: multiplyTool.getName(),
467+
description: multiplyTool.getDescription(),
468+
schema: multiplyTool.getParams()
469+
});
470+
471+
await multiplyNumbers.invoke({ a: 2, b: 3 });
472+
```
473+
474+
The `multiplyNumbers` tool is compatible with [Langchain/Langraph
475+
agents](http://js.langchain.com/docs/concepts/agents/)
476+
such as [React
477+
Agents](https://langchain-ai.github.io/langgraphjs/reference/functions/langgraph_prebuilt.createReactAgent.html).
478+
479+
</details>
480+
481+
<details>
482+
483+
<summary>LlamaIndex</summary>
484+
485+
[LlamaindexTS](https://ts.llamaindex.ai/)
486+
487+
```javascript
488+
import {ToolboxClient} from "@toolbox/core"
489+
import { tool } from "llamaindex";
490+
491+
let client = ToolboxClient(URL)
492+
multiplyTool = await client.loadTool("multiply")
493+
494+
const multiplyNumbers = tool({
495+
name: multiplyTool.getName(),
496+
description: multiplyTool.getDescription(),
497+
parameters: multiplyTool.getParams(),
498+
execute: mutliplyTool
499+
});
500+
501+
await multiplyNumbers.call({ a: 2, b: 3 });
502+
```
503+
504+
The `multiplyNumbers` tool is compatible with LlamaIndex
505+
[agents](https://ts.llamaindex.ai/docs/llamaindex/migration/deprecated/agent)
506+
and [agent
507+
workflows](https://ts.llamaindex.ai/docs/llamaindex/modules/agents/agent_workflow).
508+
509+
</details>
510+
511+
<details>
512+
513+
<summary>Genkit</summary>
514+
515+
[GenkitJS](https://genkit.dev/docs/get-started/#_top)
516+
```javascript
517+
import {ToolboxClient} from "@toolbox/core"
518+
import { genkit, z } from 'genkit';
519+
import { googleAI } from '@genkit-ai/googleai';
520+
521+
522+
let client = ToolboxClient(URL)
523+
multiplyTool = await client.loadTool("multiply")
524+
525+
const ai = genkit({
526+
plugins: [googleAI()],
527+
model: googleAI.model('gemini-1.5-pro'),
528+
});
529+
530+
const multiplyNumbers = ai.defineTool({
531+
name: multiplyTool.getName(),
532+
description: multiplyTool.getDescription(),
533+
inputSchema: multiplyTool.getParams(),
534+
},
535+
multiplyTool,
536+
);
537+
538+
await ai.generate({
539+
prompt: 'Can you multiply 5 and 7?',
540+
tools: [multiplyNumbers],
541+
});
542+
```
543+
544+
</details>
545+
450546
# Contributing
451547
452548
Contributions are welcome! Please refer to the [DEVELOPER.md](./DEVELOPER.md)

0 commit comments

Comments
 (0)