@truto/langchain-toolset 0.0.2 → 0.1.0

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,6 @@
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
4
 
5
5
  ## Installation
6
6
 
@@ -34,6 +34,8 @@ TRUTO_API_BASE_URL=your_truto_api_base_url
34
34
 
35
35
  Here's a complete example showing how to use the toolset with Langchain.js, including handling multiple tool executions:
36
36
 
37
+ To create or modify tools, please refer this [Truto guide](https://truto.one/docs/guides/tools/overview).
38
+
37
39
  ```typescript
38
40
  import { ChatOpenAI } from '@langchain/openai';
39
41
  import { HumanMessage, SystemMessage } from '@langchain/core/messages';
@@ -55,6 +57,8 @@ async function main() {
55
57
  baseUrl: process.env.TRUTO_API_BASE_URL,
56
58
  token: process.env.TRUTO_API_TOKEN as string,
57
59
  },
60
+ // Optional: Filter tools by specific methods
61
+ methods: ['list', 'get', 'create', 'update', 'delete', 'read', 'write', 'custom', 'your_custom_method_name']
58
62
  });
59
63
 
60
64
  // Bind tools to the LLM
@@ -107,6 +111,42 @@ This example demonstrates:
107
111
  - How to process tool responses and continue the conversation
108
112
  - How to properly handle the conversation flow until all tool calls are complete
109
113
 
114
+ ## API Reference
115
+
116
+ ### getTools
117
+
118
+ ```typescript
119
+ getTools(
120
+ integratedAccountId: string,
121
+ config: {
122
+ truto: {
123
+ baseUrl?: string;
124
+ token: string;
125
+ };
126
+ methods?: Array<'list' | 'get' | 'create' | 'update' | 'delete' | 'read' | 'write' | 'custom' | string>;
127
+ }
128
+ ): Promise<Record<string, Tool>>
129
+ ```
130
+
131
+ 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.
132
+
133
+ #### Parameters
134
+
135
+ - `integratedAccountId` (string): The ID of the integrated account to get tools for
136
+ - `config` (object): Configuration object
137
+ - `truto` (object): Truto API configuration
138
+ - `baseUrl` (string, optional): Custom base URL for the Truto API
139
+ - `token` (string): Truto API token
140
+ - `methods` (array, optional): Array of method names to filter tools by. Can include:
141
+ - Standard CRUD operations: 'list', 'get', 'create', 'update', 'delete'
142
+ - Permission-based methods: 'read', 'write'
143
+ - Custom methods: 'custom'
144
+ - Specific custom method names (string)
145
+
146
+ #### Returns
147
+
148
+ 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.
149
+
110
150
  ## Running Examples
111
151
 
112
152
  The repository includes example code in the `examples` directory. To run the examples:
@@ -156,5 +196,4 @@ MIT
156
196
 
157
197
  ## Contributing
158
198
 
159
- Contributions are welcome! Please feel free to submit a Pull Request.
160
-
199
+ Contributions are welcome! Please feel free to submit a Pull Request.