glin-profanity 3.1.5 → 3.2.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.
Files changed (66) hide show
  1. package/README.md +84 -566
  2. package/dist/{types-CdDqSZY7.d.cts → Filter-BGcyIAvO.d.ts} +4 -162
  3. package/dist/{types-CdDqSZY7.d.ts → Filter-D34Wsmrj.d.cts} +4 -162
  4. package/dist/frameworks/index.cjs +5257 -0
  5. package/dist/frameworks/index.d.cts +2 -0
  6. package/dist/frameworks/index.d.ts +2 -0
  7. package/dist/frameworks/index.js +5252 -0
  8. package/dist/frameworks/nextjs.cjs +5257 -0
  9. package/dist/frameworks/nextjs.d.cts +173 -0
  10. package/dist/frameworks/nextjs.d.ts +173 -0
  11. package/dist/frameworks/nextjs.js +5252 -0
  12. package/dist/index.cjs +151 -85
  13. package/dist/index.d.cts +5 -29
  14. package/dist/index.d.ts +5 -29
  15. package/dist/index.js +152 -85
  16. package/dist/integrations/index.cjs +6110 -0
  17. package/dist/integrations/index.d.cts +5 -0
  18. package/dist/integrations/index.d.ts +5 -0
  19. package/dist/integrations/index.js +6082 -0
  20. package/dist/integrations/langchain.cjs +5252 -0
  21. package/dist/integrations/langchain.d.cts +231 -0
  22. package/dist/integrations/langchain.d.ts +231 -0
  23. package/dist/integrations/langchain.js +5239 -0
  24. package/dist/integrations/openai.cjs +5367 -0
  25. package/dist/integrations/openai.d.cts +167 -0
  26. package/dist/integrations/openai.d.ts +167 -0
  27. package/dist/integrations/openai.js +5362 -0
  28. package/dist/integrations/semantic.cjs +5314 -0
  29. package/dist/integrations/semantic.d.cts +268 -0
  30. package/dist/integrations/semantic.d.ts +268 -0
  31. package/dist/integrations/semantic.js +5309 -0
  32. package/dist/integrations/vercel-ai.cjs +5282 -0
  33. package/dist/integrations/vercel-ai.d.cts +224 -0
  34. package/dist/integrations/vercel-ai.d.ts +224 -0
  35. package/dist/integrations/vercel-ai.js +5273 -0
  36. package/dist/ml/index.cjs +358 -56
  37. package/dist/ml/index.d.cts +5 -2
  38. package/dist/ml/index.d.ts +5 -2
  39. package/dist/ml/index.js +354 -57
  40. package/dist/ml/transformers.cjs +5237 -0
  41. package/dist/ml/transformers.d.cts +232 -0
  42. package/dist/ml/transformers.d.ts +232 -0
  43. package/dist/ml/transformers.js +5231 -0
  44. package/dist/multimodal/audio.cjs +5269 -0
  45. package/dist/multimodal/audio.d.cts +255 -0
  46. package/dist/multimodal/audio.d.ts +255 -0
  47. package/dist/multimodal/audio.js +5264 -0
  48. package/dist/multimodal/index.cjs +5432 -0
  49. package/dist/multimodal/index.d.cts +4 -0
  50. package/dist/multimodal/index.d.ts +4 -0
  51. package/dist/multimodal/index.js +5422 -0
  52. package/dist/multimodal/ocr.cjs +5193 -0
  53. package/dist/multimodal/ocr.d.cts +157 -0
  54. package/dist/multimodal/ocr.d.ts +157 -0
  55. package/dist/multimodal/ocr.js +5187 -0
  56. package/dist/react.cjs +5133 -0
  57. package/dist/react.d.cts +13 -0
  58. package/dist/react.d.ts +13 -0
  59. package/dist/react.js +5131 -0
  60. package/dist/types-B9c_ik4k.d.cts +88 -0
  61. package/dist/types-B9c_ik4k.d.ts +88 -0
  62. package/dist/types-BuKh9tvV.d.ts +20 -0
  63. package/dist/types-Ct_ueYqw.d.cts +76 -0
  64. package/dist/types-Ct_ueYqw.d.ts +76 -0
  65. package/dist/types-DI8nzwWc.d.cts +20 -0
  66. package/package.json +170 -3
@@ -0,0 +1,231 @@
1
+ export { C as CheckProfanityResult, F as FilterConfig, L as Language } from '../types-B9c_ik4k.cjs';
2
+
3
+ /**
4
+ * LangChain Tool Integration for glin-profanity
5
+ *
6
+ * Provides ready-to-use tools for LangChain agents and chains.
7
+ * Compatible with LangChain.js and Python (via equivalent API).
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { createAgent } from 'langchain';
12
+ * import { profanityCheckTool, censorTextTool, batchCheckTool } from 'glin-profanity/ai/langchain';
13
+ *
14
+ * const agent = createAgent({
15
+ * model: 'gpt-4o',
16
+ * tools: [profanityCheckTool, censorTextTool, batchCheckTool],
17
+ * });
18
+ *
19
+ * const result = await agent.invoke('Check if "Hello world" contains profanity');
20
+ * ```
21
+ *
22
+ * @packageDocumentation
23
+ * @module glin-profanity/ai/langchain
24
+ */
25
+
26
+ /**
27
+ * LangChain tool definition interface
28
+ */
29
+ interface LangChainTool<T = unknown> {
30
+ name: string;
31
+ description: string;
32
+ schema: unknown;
33
+ invoke: (input: T) => Promise<unknown>;
34
+ }
35
+ /**
36
+ * Tool input types
37
+ */
38
+ interface CheckProfanityInput {
39
+ text: string;
40
+ languages?: string[];
41
+ detectLeetspeak?: boolean;
42
+ normalizeUnicode?: boolean;
43
+ }
44
+ interface CensorTextInput {
45
+ text: string;
46
+ replacement?: string;
47
+ languages?: string[];
48
+ }
49
+ interface BatchCheckInput {
50
+ texts: string[];
51
+ languages?: string[];
52
+ detectLeetspeak?: boolean;
53
+ }
54
+ interface AnalyzeContextInput {
55
+ text: string;
56
+ languages?: string[];
57
+ contextWindow?: number;
58
+ confidenceThreshold?: number;
59
+ }
60
+ /**
61
+ * Creates a profanity check tool for LangChain
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * import { tool } from '@langchain/core/tools';
66
+ * import { createProfanityCheckTool } from 'glin-profanity/ai/langchain';
67
+ *
68
+ * const profanityTool = createProfanityCheckTool();
69
+ * const result = await profanityTool.invoke({ text: 'Hello world' });
70
+ * ```
71
+ */
72
+ declare function createProfanityCheckTool(): {
73
+ name: string;
74
+ description: string;
75
+ schema: any;
76
+ invoke: (input: CheckProfanityInput) => Promise<string>;
77
+ };
78
+ /**
79
+ * Creates a censor text tool for LangChain
80
+ */
81
+ declare function createCensorTextTool(): {
82
+ name: string;
83
+ description: string;
84
+ schema: any;
85
+ invoke: (input: CensorTextInput) => Promise<string>;
86
+ };
87
+ /**
88
+ * Creates a batch check tool for LangChain
89
+ */
90
+ declare function createBatchCheckTool(): {
91
+ name: string;
92
+ description: string;
93
+ schema: any;
94
+ invoke: (input: BatchCheckInput) => Promise<string>;
95
+ };
96
+ /**
97
+ * Creates a context-aware analysis tool for LangChain
98
+ */
99
+ declare function createContextAnalysisTool(): {
100
+ name: string;
101
+ description: string;
102
+ schema: any;
103
+ invoke: (input: AnalyzeContextInput) => Promise<string>;
104
+ };
105
+ /**
106
+ * Creates a supported languages tool for LangChain
107
+ */
108
+ declare function createSupportedLanguagesTool(): {
109
+ name: string;
110
+ description: string;
111
+ schema: any;
112
+ invoke: () => Promise<string>;
113
+ };
114
+ /**
115
+ * Pre-built profanity check tool instance
116
+ * Use directly with LangChain agents
117
+ */
118
+ declare const profanityCheckTool: {
119
+ name: string;
120
+ description: string;
121
+ schema: any;
122
+ invoke: (input: CheckProfanityInput) => Promise<string>;
123
+ };
124
+ /**
125
+ * Pre-built censor text tool instance
126
+ */
127
+ declare const censorTextTool: {
128
+ name: string;
129
+ description: string;
130
+ schema: any;
131
+ invoke: (input: CensorTextInput) => Promise<string>;
132
+ };
133
+ /**
134
+ * Pre-built batch check tool instance
135
+ */
136
+ declare const batchCheckTool: {
137
+ name: string;
138
+ description: string;
139
+ schema: any;
140
+ invoke: (input: BatchCheckInput) => Promise<string>;
141
+ };
142
+ /**
143
+ * Pre-built context analysis tool instance
144
+ */
145
+ declare const contextAnalysisTool: {
146
+ name: string;
147
+ description: string;
148
+ schema: any;
149
+ invoke: (input: AnalyzeContextInput) => Promise<string>;
150
+ };
151
+ /**
152
+ * Pre-built supported languages tool instance
153
+ */
154
+ declare const supportedLanguagesTool: {
155
+ name: string;
156
+ description: string;
157
+ schema: any;
158
+ invoke: () => Promise<string>;
159
+ };
160
+ /**
161
+ * All profanity tools bundled together
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * import { createAgent } from 'langchain';
166
+ * import { allProfanityTools } from 'glin-profanity/ai/langchain';
167
+ *
168
+ * const agent = createAgent({
169
+ * model: 'gpt-4o',
170
+ * tools: allProfanityTools,
171
+ * });
172
+ * ```
173
+ */
174
+ declare const allProfanityTools: ({
175
+ name: string;
176
+ description: string;
177
+ schema: any;
178
+ invoke: (input: CheckProfanityInput) => Promise<string>;
179
+ } | {
180
+ name: string;
181
+ description: string;
182
+ schema: any;
183
+ invoke: (input: CensorTextInput) => Promise<string>;
184
+ } | {
185
+ name: string;
186
+ description: string;
187
+ schema: any;
188
+ invoke: (input: BatchCheckInput) => Promise<string>;
189
+ } | {
190
+ name: string;
191
+ description: string;
192
+ schema: any;
193
+ invoke: (input: AnalyzeContextInput) => Promise<string>;
194
+ })[];
195
+ /**
196
+ * Creates all profanity tools with custom configuration
197
+ *
198
+ * @param config - Optional filter configuration to apply to all tools
199
+ * @returns Array of LangChain-compatible tools
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * const tools = createAllProfanityTools({
204
+ * languages: ['english', 'spanish'],
205
+ * detectLeetspeak: true,
206
+ * });
207
+ * ```
208
+ */
209
+ declare function createAllProfanityTools(): ({
210
+ name: string;
211
+ description: string;
212
+ schema: any;
213
+ invoke: (input: CheckProfanityInput) => Promise<string>;
214
+ } | {
215
+ name: string;
216
+ description: string;
217
+ schema: any;
218
+ invoke: (input: CensorTextInput) => Promise<string>;
219
+ } | {
220
+ name: string;
221
+ description: string;
222
+ schema: any;
223
+ invoke: (input: BatchCheckInput) => Promise<string>;
224
+ } | {
225
+ name: string;
226
+ description: string;
227
+ schema: any;
228
+ invoke: (input: AnalyzeContextInput) => Promise<string>;
229
+ })[];
230
+
231
+ export { type AnalyzeContextInput, type BatchCheckInput, type CensorTextInput, type CheckProfanityInput, type LangChainTool, allProfanityTools, batchCheckTool, censorTextTool, contextAnalysisTool, createAllProfanityTools, createBatchCheckTool, createCensorTextTool, createContextAnalysisTool, createProfanityCheckTool, createSupportedLanguagesTool, profanityCheckTool, supportedLanguagesTool };
@@ -0,0 +1,231 @@
1
+ export { C as CheckProfanityResult, F as FilterConfig, L as Language } from '../types-B9c_ik4k.js';
2
+
3
+ /**
4
+ * LangChain Tool Integration for glin-profanity
5
+ *
6
+ * Provides ready-to-use tools for LangChain agents and chains.
7
+ * Compatible with LangChain.js and Python (via equivalent API).
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { createAgent } from 'langchain';
12
+ * import { profanityCheckTool, censorTextTool, batchCheckTool } from 'glin-profanity/ai/langchain';
13
+ *
14
+ * const agent = createAgent({
15
+ * model: 'gpt-4o',
16
+ * tools: [profanityCheckTool, censorTextTool, batchCheckTool],
17
+ * });
18
+ *
19
+ * const result = await agent.invoke('Check if "Hello world" contains profanity');
20
+ * ```
21
+ *
22
+ * @packageDocumentation
23
+ * @module glin-profanity/ai/langchain
24
+ */
25
+
26
+ /**
27
+ * LangChain tool definition interface
28
+ */
29
+ interface LangChainTool<T = unknown> {
30
+ name: string;
31
+ description: string;
32
+ schema: unknown;
33
+ invoke: (input: T) => Promise<unknown>;
34
+ }
35
+ /**
36
+ * Tool input types
37
+ */
38
+ interface CheckProfanityInput {
39
+ text: string;
40
+ languages?: string[];
41
+ detectLeetspeak?: boolean;
42
+ normalizeUnicode?: boolean;
43
+ }
44
+ interface CensorTextInput {
45
+ text: string;
46
+ replacement?: string;
47
+ languages?: string[];
48
+ }
49
+ interface BatchCheckInput {
50
+ texts: string[];
51
+ languages?: string[];
52
+ detectLeetspeak?: boolean;
53
+ }
54
+ interface AnalyzeContextInput {
55
+ text: string;
56
+ languages?: string[];
57
+ contextWindow?: number;
58
+ confidenceThreshold?: number;
59
+ }
60
+ /**
61
+ * Creates a profanity check tool for LangChain
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * import { tool } from '@langchain/core/tools';
66
+ * import { createProfanityCheckTool } from 'glin-profanity/ai/langchain';
67
+ *
68
+ * const profanityTool = createProfanityCheckTool();
69
+ * const result = await profanityTool.invoke({ text: 'Hello world' });
70
+ * ```
71
+ */
72
+ declare function createProfanityCheckTool(): {
73
+ name: string;
74
+ description: string;
75
+ schema: any;
76
+ invoke: (input: CheckProfanityInput) => Promise<string>;
77
+ };
78
+ /**
79
+ * Creates a censor text tool for LangChain
80
+ */
81
+ declare function createCensorTextTool(): {
82
+ name: string;
83
+ description: string;
84
+ schema: any;
85
+ invoke: (input: CensorTextInput) => Promise<string>;
86
+ };
87
+ /**
88
+ * Creates a batch check tool for LangChain
89
+ */
90
+ declare function createBatchCheckTool(): {
91
+ name: string;
92
+ description: string;
93
+ schema: any;
94
+ invoke: (input: BatchCheckInput) => Promise<string>;
95
+ };
96
+ /**
97
+ * Creates a context-aware analysis tool for LangChain
98
+ */
99
+ declare function createContextAnalysisTool(): {
100
+ name: string;
101
+ description: string;
102
+ schema: any;
103
+ invoke: (input: AnalyzeContextInput) => Promise<string>;
104
+ };
105
+ /**
106
+ * Creates a supported languages tool for LangChain
107
+ */
108
+ declare function createSupportedLanguagesTool(): {
109
+ name: string;
110
+ description: string;
111
+ schema: any;
112
+ invoke: () => Promise<string>;
113
+ };
114
+ /**
115
+ * Pre-built profanity check tool instance
116
+ * Use directly with LangChain agents
117
+ */
118
+ declare const profanityCheckTool: {
119
+ name: string;
120
+ description: string;
121
+ schema: any;
122
+ invoke: (input: CheckProfanityInput) => Promise<string>;
123
+ };
124
+ /**
125
+ * Pre-built censor text tool instance
126
+ */
127
+ declare const censorTextTool: {
128
+ name: string;
129
+ description: string;
130
+ schema: any;
131
+ invoke: (input: CensorTextInput) => Promise<string>;
132
+ };
133
+ /**
134
+ * Pre-built batch check tool instance
135
+ */
136
+ declare const batchCheckTool: {
137
+ name: string;
138
+ description: string;
139
+ schema: any;
140
+ invoke: (input: BatchCheckInput) => Promise<string>;
141
+ };
142
+ /**
143
+ * Pre-built context analysis tool instance
144
+ */
145
+ declare const contextAnalysisTool: {
146
+ name: string;
147
+ description: string;
148
+ schema: any;
149
+ invoke: (input: AnalyzeContextInput) => Promise<string>;
150
+ };
151
+ /**
152
+ * Pre-built supported languages tool instance
153
+ */
154
+ declare const supportedLanguagesTool: {
155
+ name: string;
156
+ description: string;
157
+ schema: any;
158
+ invoke: () => Promise<string>;
159
+ };
160
+ /**
161
+ * All profanity tools bundled together
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * import { createAgent } from 'langchain';
166
+ * import { allProfanityTools } from 'glin-profanity/ai/langchain';
167
+ *
168
+ * const agent = createAgent({
169
+ * model: 'gpt-4o',
170
+ * tools: allProfanityTools,
171
+ * });
172
+ * ```
173
+ */
174
+ declare const allProfanityTools: ({
175
+ name: string;
176
+ description: string;
177
+ schema: any;
178
+ invoke: (input: CheckProfanityInput) => Promise<string>;
179
+ } | {
180
+ name: string;
181
+ description: string;
182
+ schema: any;
183
+ invoke: (input: CensorTextInput) => Promise<string>;
184
+ } | {
185
+ name: string;
186
+ description: string;
187
+ schema: any;
188
+ invoke: (input: BatchCheckInput) => Promise<string>;
189
+ } | {
190
+ name: string;
191
+ description: string;
192
+ schema: any;
193
+ invoke: (input: AnalyzeContextInput) => Promise<string>;
194
+ })[];
195
+ /**
196
+ * Creates all profanity tools with custom configuration
197
+ *
198
+ * @param config - Optional filter configuration to apply to all tools
199
+ * @returns Array of LangChain-compatible tools
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * const tools = createAllProfanityTools({
204
+ * languages: ['english', 'spanish'],
205
+ * detectLeetspeak: true,
206
+ * });
207
+ * ```
208
+ */
209
+ declare function createAllProfanityTools(): ({
210
+ name: string;
211
+ description: string;
212
+ schema: any;
213
+ invoke: (input: CheckProfanityInput) => Promise<string>;
214
+ } | {
215
+ name: string;
216
+ description: string;
217
+ schema: any;
218
+ invoke: (input: CensorTextInput) => Promise<string>;
219
+ } | {
220
+ name: string;
221
+ description: string;
222
+ schema: any;
223
+ invoke: (input: BatchCheckInput) => Promise<string>;
224
+ } | {
225
+ name: string;
226
+ description: string;
227
+ schema: any;
228
+ invoke: (input: AnalyzeContextInput) => Promise<string>;
229
+ })[];
230
+
231
+ export { type AnalyzeContextInput, type BatchCheckInput, type CensorTextInput, type CheckProfanityInput, type LangChainTool, allProfanityTools, batchCheckTool, censorTextTool, contextAnalysisTool, createAllProfanityTools, createBatchCheckTool, createCensorTextTool, createContextAnalysisTool, createProfanityCheckTool, createSupportedLanguagesTool, profanityCheckTool, supportedLanguagesTool };