@truto/langchain-toolset 0.1.0 → 0.1.2
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 +4 -1
- package/dist/main.cjs +50 -42
- package/dist/main.cjs.map +1 -1
- package/dist/module.js +50 -42
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
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
|
+

|
|
6
|
+
|
|
7
|
+
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
7
10
|
```bash
|
|
@@ -196,4 +199,4 @@ MIT
|
|
|
196
199
|
|
|
197
200
|
## Contributing
|
|
198
201
|
|
|
199
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
202
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
package/dist/main.cjs
CHANGED
|
@@ -2024,51 +2024,59 @@ async function $4de6ba44f0531b39$export$ffc9f93b394316dd(integratedAccountId, co
|
|
|
2024
2024
|
baseUrl: config.truto.baseUrl,
|
|
2025
2025
|
token: config.truto.token
|
|
2026
2026
|
});
|
|
2027
|
-
const availableTools = await trutoApi.integratedAccount.tools(integratedAccountId, config?.methods);
|
|
2027
|
+
const availableTools = await trutoApi.integratedAccount.tools(integratedAccountId, config?.methods, config?.tags);
|
|
2028
2028
|
(0, $c6f51911d1519af6$export$2e2bcd8739ae039)(availableTools, (availableTool)=>{
|
|
2029
2029
|
const toolName = availableTool.name;
|
|
2030
2030
|
tools[toolName] = (0, $krXZW$langchaincoretools.tool)(async (config)=>{
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2031
|
+
try {
|
|
2032
|
+
const resourceName = availableTool.resource;
|
|
2033
|
+
const methodToCall = availableTool.method;
|
|
2034
|
+
const query = $4de6ba44f0531b39$export$34efffa2116fc158(config, availableTool.query_schema) || {};
|
|
2035
|
+
const body = $4de6ba44f0531b39$export$34efffa2116fc158(config, availableTool.body_schema) || {};
|
|
2036
|
+
switch(methodToCall){
|
|
2037
|
+
case "list":
|
|
2038
|
+
return JSON.stringify(await trutoApi.proxyApi.list({
|
|
2039
|
+
integrated_account_id: integratedAccountId,
|
|
2040
|
+
resource: resourceName,
|
|
2041
|
+
...query
|
|
2042
|
+
}).next(), null, 2);
|
|
2043
|
+
case "get":
|
|
2044
|
+
return JSON.stringify(await trutoApi.proxyApi.get(config?.id, {
|
|
2045
|
+
integrated_account_id: integratedAccountId,
|
|
2046
|
+
resource: resourceName,
|
|
2047
|
+
...query
|
|
2048
|
+
}), null, 2);
|
|
2049
|
+
case "create":
|
|
2050
|
+
return JSON.stringify(await trutoApi.proxyApi.create(body, {
|
|
2051
|
+
integrated_account_id: integratedAccountId,
|
|
2052
|
+
resource: resourceName,
|
|
2053
|
+
...query
|
|
2054
|
+
}), null, 2);
|
|
2055
|
+
case "update":
|
|
2056
|
+
return JSON.stringify(await trutoApi.proxyApi.update(config?.id, body, {
|
|
2057
|
+
integrated_account_id: integratedAccountId,
|
|
2058
|
+
resource: resourceName,
|
|
2059
|
+
...query
|
|
2060
|
+
}), null, 2);
|
|
2061
|
+
case "delete":
|
|
2062
|
+
return JSON.stringify(await trutoApi.proxyApi.delete(config?.id, {
|
|
2063
|
+
integrated_account_id: integratedAccountId,
|
|
2064
|
+
resource: resourceName,
|
|
2065
|
+
...query
|
|
2066
|
+
}), null, 2);
|
|
2067
|
+
default:
|
|
2068
|
+
return JSON.stringify(await trutoApi.proxyApi.customMethod(methodToCall, body, {
|
|
2069
|
+
integrated_account_id: integratedAccountId,
|
|
2070
|
+
resource: resourceName,
|
|
2071
|
+
...query
|
|
2072
|
+
}), null, 2);
|
|
2073
|
+
}
|
|
2074
|
+
} catch (error) {
|
|
2075
|
+
return JSON.stringify({
|
|
2076
|
+
error: true,
|
|
2077
|
+
message: error instanceof Error ? error.message : "Unknown error occurred",
|
|
2078
|
+
details: error instanceof Error ? error.stack : String(error)
|
|
2079
|
+
}, null, 2);
|
|
2072
2080
|
}
|
|
2073
2081
|
}, {
|
|
2074
2082
|
name: toolName,
|