@truto/langchain-toolset 0.0.2 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Truto's SuperAI Toolset for Langchain.js
2
2
 
3
- A powerful toolset for integrating Truto's Proxy APIs with Langchain.js applications. This package provides all the Proxy APIs configured to be used as a tool on Truto as tools to Langchain.
3
+ A powerful toolset for integrating Truto's Proxy APIs with Langchain.js applications. This package provides all the Proxy APIs configured to be used as a tool on Truto as tools to Langchain. Read more about configuring tools on Truto [here](https://truto.one/docs/guides/tools/overview).
4
+
5
+ ![tool_calling](https://github.com/user-attachments/assets/929974df-20b3-4fbc-917c-cf7c0254fc49)
6
+
4
7
 
5
8
  ## Installation
6
9
 
@@ -34,6 +37,8 @@ TRUTO_API_BASE_URL=your_truto_api_base_url
34
37
 
35
38
  Here's a complete example showing how to use the toolset with Langchain.js, including handling multiple tool executions:
36
39
 
40
+ To create or modify tools, please refer this [Truto guide](https://truto.one/docs/guides/tools/overview).
41
+
37
42
  ```typescript
38
43
  import { ChatOpenAI } from '@langchain/openai';
39
44
  import { HumanMessage, SystemMessage } from '@langchain/core/messages';
@@ -55,6 +60,8 @@ async function main() {
55
60
  baseUrl: process.env.TRUTO_API_BASE_URL,
56
61
  token: process.env.TRUTO_API_TOKEN as string,
57
62
  },
63
+ // Optional: Filter tools by specific methods
64
+ methods: ['list', 'get', 'create', 'update', 'delete', 'read', 'write', 'custom', 'your_custom_method_name']
58
65
  });
59
66
 
60
67
  // Bind tools to the LLM
@@ -107,6 +114,42 @@ This example demonstrates:
107
114
  - How to process tool responses and continue the conversation
108
115
  - How to properly handle the conversation flow until all tool calls are complete
109
116
 
117
+ ## API Reference
118
+
119
+ ### getTools
120
+
121
+ ```typescript
122
+ getTools(
123
+ integratedAccountId: string,
124
+ config: {
125
+ truto: {
126
+ baseUrl?: string;
127
+ token: string;
128
+ };
129
+ methods?: Array<'list' | 'get' | 'create' | 'update' | 'delete' | 'read' | 'write' | 'custom' | string>;
130
+ }
131
+ ): Promise<Record<string, Tool>>
132
+ ```
133
+
134
+ Returns a promise that resolves to an object containing all available tools for the specified integrated account. Each tool is a Langchain.js Tool instance that can be used with Langchain.js supported LLMs.
135
+
136
+ #### Parameters
137
+
138
+ - `integratedAccountId` (string): The ID of the integrated account to get tools for
139
+ - `config` (object): Configuration object
140
+ - `truto` (object): Truto API configuration
141
+ - `baseUrl` (string, optional): Custom base URL for the Truto API
142
+ - `token` (string): Truto API token
143
+ - `methods` (array, optional): Array of method names to filter tools by. Can include:
144
+ - Standard CRUD operations: 'list', 'get', 'create', 'update', 'delete'
145
+ - Permission-based methods: 'read', 'write'
146
+ - Custom methods: 'custom'
147
+ - Specific custom method names (string)
148
+
149
+ #### Returns
150
+
151
+ A promise that resolves to a Record<string, Tool> where each key is the tool name and the value is a Langchain.js Tool instance.
152
+
110
153
  ## Running Examples
111
154
 
112
155
  The repository includes example code in the `examples` directory. To run the examples:
@@ -157,4 +200,3 @@ MIT
157
200
  ## Contributing
158
201
 
159
202
  Contributions are welcome! Please feel free to submit a Pull Request.
160
-