carlyemail-toolkit 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/langchain.js ADDED
@@ -0,0 +1,30 @@
1
+ // CarlyEmail tools for LangChain.
2
+ //
3
+ // import { CarlyEmailToolkit } from "carlyemail-toolkit/langchain";
4
+ // const agent = createAgent({ model, tools: new CarlyEmailToolkit().getTools() });
5
+ //
6
+ // A failed call throws; `createAgent`'s tool node turns that into an error
7
+ // ToolMessage the model can read and act on.
8
+
9
+ import { tool } from "@langchain/core/tools";
10
+
11
+ import { ListToolkit, errorMessage } from "./core.js";
12
+
13
+ export class CarlyEmailToolkit extends ListToolkit {
14
+ buildTool(definition) {
15
+ return tool(
16
+ async (args) => {
17
+ try {
18
+ return JSON.stringify(await definition.func(this.client, args ?? {}));
19
+ } catch (error) {
20
+ throw new Error(errorMessage(error), { cause: error });
21
+ }
22
+ },
23
+ {
24
+ name: definition.name,
25
+ description: definition.description,
26
+ schema: definition.inputSchema,
27
+ },
28
+ );
29
+ }
30
+ }
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "carlyemail-toolkit",
3
+ "version": "0.1.0",
4
+ "description": "CarlyEmail's email tools for the Vercel AI SDK, LangChain, and any other agent framework.",
5
+ "keywords": [
6
+ "carlyemail",
7
+ "email",
8
+ "agent",
9
+ "ai",
10
+ "toolkit",
11
+ "tools",
12
+ "vercel",
13
+ "ai-sdk",
14
+ "langchain"
15
+ ],
16
+ "homepage": "https://docs.carlyemail.com/integrations/toolkit",
17
+ "bugs": "https://docs.carlyemail.com/support",
18
+ "license": "MIT",
19
+ "author": "SWH Labs LLC",
20
+ "type": "module",
21
+ "types": "./index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./index.d.ts",
25
+ "default": "./index.js"
26
+ },
27
+ "./ai-sdk": {
28
+ "types": "./ai-sdk.d.ts",
29
+ "default": "./ai-sdk.js"
30
+ },
31
+ "./langchain": {
32
+ "types": "./langchain.d.ts",
33
+ "default": "./langchain.js"
34
+ }
35
+ },
36
+ "files": [
37
+ "core.js",
38
+ "tools.js",
39
+ "index.js",
40
+ "index.d.ts",
41
+ "ai-sdk.js",
42
+ "ai-sdk.d.ts",
43
+ "langchain.js",
44
+ "langchain.d.ts",
45
+ "README.md",
46
+ "LICENSE"
47
+ ],
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "dependencies": {
52
+ "carlyemail": "^0.6.0"
53
+ },
54
+ "peerDependencies": {
55
+ "@langchain/core": ">=0.3",
56
+ "ai": ">=5"
57
+ },
58
+ "peerDependenciesMeta": {
59
+ "@langchain/core": {
60
+ "optional": true
61
+ },
62
+ "ai": {
63
+ "optional": true
64
+ }
65
+ },
66
+ "devDependencies": {
67
+ "@langchain/core": "^1.0.0",
68
+ "ai": "^7.0.0"
69
+ },
70
+ "scripts": {
71
+ "test": "node --test"
72
+ }
73
+ }