@aeye/openai 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/dist/types.js ADDED
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Provider-specific types and utilities
3
+ *
4
+ * Common types and helpers for implementing AI providers.
5
+ */
6
+ // Placeholder for provider-specific types
7
+ // This will be filled in when implementing specific providers
8
+ /**
9
+ * Base error class for provider-specific errors.
10
+ *
11
+ * Wraps underlying errors and adds provider context to error messages.
12
+ * All provider errors extend from this base class.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * throw new ProviderError('openai', 'Invalid model specified', originalError);
17
+ * ```
18
+ */
19
+ export class ProviderError extends Error {
20
+ provider;
21
+ cause;
22
+ constructor(
23
+ // The provider identifier (e.g., 'openai', 'anthropic')
24
+ provider, message,
25
+ // Original error that caused this provider error
26
+ cause) {
27
+ super(`[${provider}] ${message}`);
28
+ this.provider = provider;
29
+ this.cause = cause;
30
+ this.name = 'ProviderError';
31
+ }
32
+ }
33
+ /**
34
+ * Error thrown when authentication with the provider fails.
35
+ *
36
+ * This typically indicates an invalid API key, expired credentials,
37
+ * or insufficient permissions.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * throw new ProviderAuthError('openai', originalError);
42
+ * ```
43
+ */
44
+ export class ProviderAuthError extends ProviderError {
45
+ constructor(provider, cause) {
46
+ super(provider, `Authentication failed`, cause);
47
+ this.name = 'ProviderAuthError';
48
+ }
49
+ }
50
+ /**
51
+ * Error thrown when rate limits are exceeded.
52
+ *
53
+ * Contains information about when the request can be retried.
54
+ * Rate limits are enforced by the provider to control API usage.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * throw new RateLimitError('openai', 'Too many requests', 60, originalError);
59
+ * ```
60
+ */
61
+ export class RateLimitError extends ProviderError {
62
+ retryAfter;
63
+ constructor(provider, message,
64
+ // Number of seconds to wait before retrying
65
+ retryAfter, cause) {
66
+ super(provider, message, cause);
67
+ this.retryAfter = retryAfter;
68
+ this.name = 'RateLimitError';
69
+ }
70
+ }
71
+ /**
72
+ * Error thrown when provider rate limits are exceeded.
73
+ *
74
+ * Specialized version of RateLimitError with a standard message.
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * throw new ProviderRateLimitError('openai', 60, originalError);
79
+ * ```
80
+ */
81
+ export class ProviderRateLimitError extends RateLimitError {
82
+ retryAfter;
83
+ constructor(provider,
84
+ // Number of seconds to wait before retrying
85
+ retryAfter, cause) {
86
+ super(provider, `Rate limit exceeded`, retryAfter, cause);
87
+ this.retryAfter = retryAfter;
88
+ this.name = 'ProviderRateLimitError';
89
+ }
90
+ }
91
+ /**
92
+ * Error thrown when quota limits are exceeded.
93
+ *
94
+ * This indicates the account has reached its usage quota
95
+ * and needs to upgrade or wait for quota reset.
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * throw new ProviderQuotaError('openai', originalError);
100
+ * ```
101
+ */
102
+ export class ProviderQuotaError extends ProviderError {
103
+ constructor(provider, cause) {
104
+ super(provider, `Quota exceeded`, cause);
105
+ this.name = 'ProviderQuotaError';
106
+ }
107
+ }
108
+ /**
109
+ * Error thrown when the request exceeds the model's context window.
110
+ *
111
+ * This typically occurs with status 413 when the input is too long
112
+ * for the model's maximum context length.
113
+ *
114
+ * @example
115
+ * ```typescript
116
+ * throw new ContextWindowError('openai', 'Input too long', 128000, originalError);
117
+ * ```
118
+ */
119
+ export class ContextWindowError extends ProviderError {
120
+ contextWindow;
121
+ constructor(provider, message,
122
+ // The context window size in tokens (if known)
123
+ contextWindow, cause) {
124
+ super(provider, message, cause);
125
+ this.contextWindow = contextWindow;
126
+ this.name = 'ContextWindowError';
127
+ }
128
+ }
129
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0CAA0C;AAC1C,8DAA8D;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,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EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IAK1C;IAJT,YACE,QAAgB,EAChB,OAAe;IACf,+CAA+C;IACxC,aAAsB,EAC7B,KAAa;QAEb,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAHzB,kBAAa,GAAb,aAAa,CAAS;QAI7B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@aeye/openai",
3
+ "version": "0.1.0",
4
+ "description": "@aeye OpenAI - OpenAI integration for @aeye",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "jest",
11
+ "test:unit": "jest --testPathIgnorePatterns=__integration__",
12
+ "test:integration": "jest --testPathPattern=__integration__",
13
+ "test:coverage": "jest --coverage --testPathIgnorePatterns=__integration__",
14
+ "test:watch": "jest --watch",
15
+ "clean": "rimraf dist tsconfig.tsbuildinfo",
16
+ "typecheck": "tsc --noEmit"
17
+ },
18
+ "keywords": [
19
+ "ai",
20
+ "openai",
21
+ "typescript"
22
+ ],
23
+ "author": "ClickerMonkey",
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/ClickerMonkey/aeye.git",
28
+ "directory": "packages/openai"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "dependencies": {
36
+ "@aeye/ai": "^0.1.0",
37
+ "@aeye/core": "^0.1.0",
38
+ "openai": "^6.6.0",
39
+ "zod": "^4.1.12"
40
+ },
41
+ "devDependencies": {
42
+ "@types/jest": "^30.0.0",
43
+ "jest": "^30.2.0",
44
+ "ts-jest": "^29.4.5",
45
+ "typescript": "^5.9.3"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "engines": {
51
+ "node": ">=16.0.0"
52
+ },
53
+ "homepage": "https://github.com/ClickerMonkey/aeye#readme",
54
+ "bugs": {
55
+ "url": "https://github.com/ClickerMonkey/aeye/issues"
56
+ }
57
+ }