glin-profanity 3.2.0 → 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 (65) hide show
  1. package/dist/{types-Dj5vaoch.d.cts → Filter-BGcyIAvO.d.ts} +2 -162
  2. package/dist/{types-Dj5vaoch.d.ts → Filter-D34Wsmrj.d.cts} +2 -162
  3. package/dist/frameworks/index.cjs +5257 -0
  4. package/dist/frameworks/index.d.cts +2 -0
  5. package/dist/frameworks/index.d.ts +2 -0
  6. package/dist/frameworks/index.js +5252 -0
  7. package/dist/frameworks/nextjs.cjs +5257 -0
  8. package/dist/frameworks/nextjs.d.cts +173 -0
  9. package/dist/frameworks/nextjs.d.ts +173 -0
  10. package/dist/frameworks/nextjs.js +5252 -0
  11. package/dist/index.cjs +0 -28
  12. package/dist/index.d.cts +5 -29
  13. package/dist/index.d.ts +5 -29
  14. package/dist/index.js +1 -28
  15. package/dist/integrations/index.cjs +6110 -0
  16. package/dist/integrations/index.d.cts +5 -0
  17. package/dist/integrations/index.d.ts +5 -0
  18. package/dist/integrations/index.js +6082 -0
  19. package/dist/integrations/langchain.cjs +5252 -0
  20. package/dist/integrations/langchain.d.cts +231 -0
  21. package/dist/integrations/langchain.d.ts +231 -0
  22. package/dist/integrations/langchain.js +5239 -0
  23. package/dist/integrations/openai.cjs +5367 -0
  24. package/dist/integrations/openai.d.cts +167 -0
  25. package/dist/integrations/openai.d.ts +167 -0
  26. package/dist/integrations/openai.js +5362 -0
  27. package/dist/integrations/semantic.cjs +5314 -0
  28. package/dist/integrations/semantic.d.cts +268 -0
  29. package/dist/integrations/semantic.d.ts +268 -0
  30. package/dist/integrations/semantic.js +5309 -0
  31. package/dist/integrations/vercel-ai.cjs +5282 -0
  32. package/dist/integrations/vercel-ai.d.cts +224 -0
  33. package/dist/integrations/vercel-ai.d.ts +224 -0
  34. package/dist/integrations/vercel-ai.js +5273 -0
  35. package/dist/ml/index.cjs +207 -0
  36. package/dist/ml/index.d.cts +5 -2
  37. package/dist/ml/index.d.ts +5 -2
  38. package/dist/ml/index.js +203 -1
  39. package/dist/ml/transformers.cjs +5237 -0
  40. package/dist/ml/transformers.d.cts +232 -0
  41. package/dist/ml/transformers.d.ts +232 -0
  42. package/dist/ml/transformers.js +5231 -0
  43. package/dist/multimodal/audio.cjs +5269 -0
  44. package/dist/multimodal/audio.d.cts +255 -0
  45. package/dist/multimodal/audio.d.ts +255 -0
  46. package/dist/multimodal/audio.js +5264 -0
  47. package/dist/multimodal/index.cjs +5432 -0
  48. package/dist/multimodal/index.d.cts +4 -0
  49. package/dist/multimodal/index.d.ts +4 -0
  50. package/dist/multimodal/index.js +5422 -0
  51. package/dist/multimodal/ocr.cjs +5193 -0
  52. package/dist/multimodal/ocr.d.cts +157 -0
  53. package/dist/multimodal/ocr.d.ts +157 -0
  54. package/dist/multimodal/ocr.js +5187 -0
  55. package/dist/react.cjs +5133 -0
  56. package/dist/react.d.cts +13 -0
  57. package/dist/react.d.ts +13 -0
  58. package/dist/react.js +5131 -0
  59. package/dist/types-B9c_ik4k.d.cts +88 -0
  60. package/dist/types-B9c_ik4k.d.ts +88 -0
  61. package/dist/types-BuKh9tvV.d.ts +20 -0
  62. package/dist/types-Ct_ueYqw.d.cts +76 -0
  63. package/dist/types-Ct_ueYqw.d.ts +76 -0
  64. package/dist/types-DI8nzwWc.d.cts +20 -0
  65. package/package.json +170 -3
@@ -0,0 +1,167 @@
1
+ export { C as CheckProfanityResult, F as FilterConfig, L as Language } from '../types-B9c_ik4k.cjs';
2
+
3
+ /**
4
+ * OpenAI Function Calling Integration for glin-profanity
5
+ *
6
+ * Provides ready-to-use tool definitions for OpenAI's function calling API.
7
+ * Compatible with GPT-4o, GPT-4, GPT-3.5-turbo, and other OpenAI models.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import OpenAI from 'openai';
12
+ * import { profanityTools, executeProfanityTool } from 'glin-profanity/ai/openai';
13
+ *
14
+ * const client = new OpenAI();
15
+ * const response = await client.chat.completions.create({
16
+ * model: 'gpt-4o',
17
+ * messages: [{ role: 'user', content: 'Check if this text is appropriate: "Hello world"' }],
18
+ * tools: profanityTools,
19
+ * });
20
+ *
21
+ * // Handle tool calls
22
+ * const toolCall = response.choices[0]?.message.tool_calls?.[0];
23
+ * if (toolCall) {
24
+ * const result = await executeProfanityTool(toolCall.function.name, JSON.parse(toolCall.function.arguments));
25
+ * }
26
+ * ```
27
+ *
28
+ * @packageDocumentation
29
+ * @module glin-profanity/ai/openai
30
+ */
31
+
32
+ /**
33
+ * OpenAI tool definition type
34
+ */
35
+ interface OpenAITool {
36
+ type: 'function';
37
+ function: {
38
+ name: string;
39
+ description: string;
40
+ parameters: {
41
+ type: 'object';
42
+ properties: Record<string, unknown>;
43
+ required?: string[];
44
+ };
45
+ };
46
+ }
47
+ /**
48
+ * Check profanity tool parameters
49
+ */
50
+ interface CheckProfanityParams {
51
+ text: string;
52
+ languages?: string[];
53
+ detectLeetspeak?: boolean;
54
+ normalizeUnicode?: boolean;
55
+ }
56
+ /**
57
+ * Censor text tool parameters
58
+ */
59
+ interface CensorTextParams {
60
+ text: string;
61
+ replacement?: string;
62
+ languages?: string[];
63
+ }
64
+ /**
65
+ * Batch check tool parameters
66
+ */
67
+ interface BatchCheckParams {
68
+ texts: string[];
69
+ languages?: string[];
70
+ detectLeetspeak?: boolean;
71
+ }
72
+ /**
73
+ * Analyze context tool parameters
74
+ */
75
+ interface AnalyzeContextParams {
76
+ text: string;
77
+ languages?: string[];
78
+ contextWindow?: number;
79
+ confidenceThreshold?: number;
80
+ }
81
+ /**
82
+ * OpenAI-compatible tool definitions for profanity detection
83
+ */
84
+ declare const profanityTools: OpenAITool[];
85
+ /**
86
+ * Execute a profanity tool by name with the given arguments
87
+ *
88
+ * @param toolName - The name of the tool to execute
89
+ * @param args - The arguments for the tool
90
+ * @returns The tool execution result
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const result = await executeProfanityTool('check_profanity', {
95
+ * text: 'Hello world',
96
+ * detectLeetspeak: true,
97
+ * });
98
+ * console.log(result.containsProfanity); // false
99
+ * ```
100
+ */
101
+ declare function executeProfanityTool(toolName: string, args: Record<string, unknown>): Promise<unknown>;
102
+ /**
103
+ * Zod schemas for OpenAI tool parameters (requires zod peer dependency)
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * import { zodFunction } from 'openai/helpers/zod';
108
+ * import { profanityToolSchemas } from 'glin-profanity/ai/openai';
109
+ *
110
+ * const tools = [
111
+ * zodFunction({ name: 'check_profanity', parameters: profanityToolSchemas.checkProfanity }),
112
+ * ];
113
+ * ```
114
+ */
115
+ declare const profanityToolSchemas: {
116
+ /**
117
+ * Returns Zod schema for check_profanity tool
118
+ * Lazily loaded to avoid requiring zod as a hard dependency
119
+ */
120
+ readonly checkProfanity: any;
121
+ /**
122
+ * Returns Zod schema for censor_text tool
123
+ */
124
+ readonly censorText: any;
125
+ /**
126
+ * Returns Zod schema for batch_check_profanity tool
127
+ */
128
+ readonly batchCheck: any;
129
+ /**
130
+ * Returns Zod schema for analyze_context tool
131
+ */
132
+ readonly analyzeContext: any;
133
+ };
134
+ /**
135
+ * Creates a runnable tools configuration for OpenAI's runTools helper
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * import OpenAI from 'openai';
140
+ * import { createRunnableTools } from 'glin-profanity/ai/openai';
141
+ *
142
+ * const client = new OpenAI();
143
+ * const runner = client.chat.completions.runTools({
144
+ * model: 'gpt-4o',
145
+ * messages: [{ role: 'user', content: 'Check this text for profanity: "Hello world"' }],
146
+ * tools: createRunnableTools(),
147
+ * });
148
+ *
149
+ * const result = await runner.finalContent();
150
+ * ```
151
+ */
152
+ declare function createRunnableTools(): {
153
+ type: "function";
154
+ function: {
155
+ function: (args: Record<string, unknown>) => Promise<unknown>;
156
+ parse: (text: string, reviver?: (this: any, key: string, value: any) => any) => any;
157
+ name: string;
158
+ description: string;
159
+ parameters: {
160
+ type: "object";
161
+ properties: Record<string, unknown>;
162
+ required?: string[];
163
+ };
164
+ };
165
+ }[];
166
+
167
+ export { type AnalyzeContextParams, type BatchCheckParams, type CensorTextParams, type CheckProfanityParams, type OpenAITool, createRunnableTools, executeProfanityTool, profanityToolSchemas, profanityTools };
@@ -0,0 +1,167 @@
1
+ export { C as CheckProfanityResult, F as FilterConfig, L as Language } from '../types-B9c_ik4k.js';
2
+
3
+ /**
4
+ * OpenAI Function Calling Integration for glin-profanity
5
+ *
6
+ * Provides ready-to-use tool definitions for OpenAI's function calling API.
7
+ * Compatible with GPT-4o, GPT-4, GPT-3.5-turbo, and other OpenAI models.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import OpenAI from 'openai';
12
+ * import { profanityTools, executeProfanityTool } from 'glin-profanity/ai/openai';
13
+ *
14
+ * const client = new OpenAI();
15
+ * const response = await client.chat.completions.create({
16
+ * model: 'gpt-4o',
17
+ * messages: [{ role: 'user', content: 'Check if this text is appropriate: "Hello world"' }],
18
+ * tools: profanityTools,
19
+ * });
20
+ *
21
+ * // Handle tool calls
22
+ * const toolCall = response.choices[0]?.message.tool_calls?.[0];
23
+ * if (toolCall) {
24
+ * const result = await executeProfanityTool(toolCall.function.name, JSON.parse(toolCall.function.arguments));
25
+ * }
26
+ * ```
27
+ *
28
+ * @packageDocumentation
29
+ * @module glin-profanity/ai/openai
30
+ */
31
+
32
+ /**
33
+ * OpenAI tool definition type
34
+ */
35
+ interface OpenAITool {
36
+ type: 'function';
37
+ function: {
38
+ name: string;
39
+ description: string;
40
+ parameters: {
41
+ type: 'object';
42
+ properties: Record<string, unknown>;
43
+ required?: string[];
44
+ };
45
+ };
46
+ }
47
+ /**
48
+ * Check profanity tool parameters
49
+ */
50
+ interface CheckProfanityParams {
51
+ text: string;
52
+ languages?: string[];
53
+ detectLeetspeak?: boolean;
54
+ normalizeUnicode?: boolean;
55
+ }
56
+ /**
57
+ * Censor text tool parameters
58
+ */
59
+ interface CensorTextParams {
60
+ text: string;
61
+ replacement?: string;
62
+ languages?: string[];
63
+ }
64
+ /**
65
+ * Batch check tool parameters
66
+ */
67
+ interface BatchCheckParams {
68
+ texts: string[];
69
+ languages?: string[];
70
+ detectLeetspeak?: boolean;
71
+ }
72
+ /**
73
+ * Analyze context tool parameters
74
+ */
75
+ interface AnalyzeContextParams {
76
+ text: string;
77
+ languages?: string[];
78
+ contextWindow?: number;
79
+ confidenceThreshold?: number;
80
+ }
81
+ /**
82
+ * OpenAI-compatible tool definitions for profanity detection
83
+ */
84
+ declare const profanityTools: OpenAITool[];
85
+ /**
86
+ * Execute a profanity tool by name with the given arguments
87
+ *
88
+ * @param toolName - The name of the tool to execute
89
+ * @param args - The arguments for the tool
90
+ * @returns The tool execution result
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const result = await executeProfanityTool('check_profanity', {
95
+ * text: 'Hello world',
96
+ * detectLeetspeak: true,
97
+ * });
98
+ * console.log(result.containsProfanity); // false
99
+ * ```
100
+ */
101
+ declare function executeProfanityTool(toolName: string, args: Record<string, unknown>): Promise<unknown>;
102
+ /**
103
+ * Zod schemas for OpenAI tool parameters (requires zod peer dependency)
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * import { zodFunction } from 'openai/helpers/zod';
108
+ * import { profanityToolSchemas } from 'glin-profanity/ai/openai';
109
+ *
110
+ * const tools = [
111
+ * zodFunction({ name: 'check_profanity', parameters: profanityToolSchemas.checkProfanity }),
112
+ * ];
113
+ * ```
114
+ */
115
+ declare const profanityToolSchemas: {
116
+ /**
117
+ * Returns Zod schema for check_profanity tool
118
+ * Lazily loaded to avoid requiring zod as a hard dependency
119
+ */
120
+ readonly checkProfanity: any;
121
+ /**
122
+ * Returns Zod schema for censor_text tool
123
+ */
124
+ readonly censorText: any;
125
+ /**
126
+ * Returns Zod schema for batch_check_profanity tool
127
+ */
128
+ readonly batchCheck: any;
129
+ /**
130
+ * Returns Zod schema for analyze_context tool
131
+ */
132
+ readonly analyzeContext: any;
133
+ };
134
+ /**
135
+ * Creates a runnable tools configuration for OpenAI's runTools helper
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * import OpenAI from 'openai';
140
+ * import { createRunnableTools } from 'glin-profanity/ai/openai';
141
+ *
142
+ * const client = new OpenAI();
143
+ * const runner = client.chat.completions.runTools({
144
+ * model: 'gpt-4o',
145
+ * messages: [{ role: 'user', content: 'Check this text for profanity: "Hello world"' }],
146
+ * tools: createRunnableTools(),
147
+ * });
148
+ *
149
+ * const result = await runner.finalContent();
150
+ * ```
151
+ */
152
+ declare function createRunnableTools(): {
153
+ type: "function";
154
+ function: {
155
+ function: (args: Record<string, unknown>) => Promise<unknown>;
156
+ parse: (text: string, reviver?: (this: any, key: string, value: any) => any) => any;
157
+ name: string;
158
+ description: string;
159
+ parameters: {
160
+ type: "object";
161
+ properties: Record<string, unknown>;
162
+ required?: string[];
163
+ };
164
+ };
165
+ }[];
166
+
167
+ export { type AnalyzeContextParams, type BatchCheckParams, type CensorTextParams, type CheckProfanityParams, type OpenAITool, createRunnableTools, executeProfanityTool, profanityToolSchemas, profanityTools };