@stratix/ai-openai 0.7.6 → 0.8.1

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 CHANGED
@@ -3,18 +3,25 @@
3
3
 
4
4
  # @stratix/ai-openai
5
5
 
6
- **🔧 Provider** | OpenAI LLM provider for Stratix AI agents
6
+ **OpenAI LLM provider for Stratix AI agents**
7
7
 
8
- [![npm version](https://img.shields.io/npm/v/@stratix/ai-openai.svg)](https://www.npmjs.com/package/@stratix/ai-openai)
8
+ [![npm version](https://img.shields.io/npm/v/@stratix/cli.svg)](https://www.npmjs.com/package/@stratix/cli)
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
10
10
 
11
- [Documentation](https://stratix-dev.github.io/stratix/) | [Getting Started](https://stratix-dev.github.io/stratix/docs/getting-started/quick-start)
11
+ [Documentation](https://stratix-dev.github.io/docs/)
12
12
 
13
13
  </div>
14
14
 
15
- > Part of **[Stratix Framework](https://stratix-dev.github.io/stratix/)** - A TypeScript framework for building scalable applications with Domain-Driven Design, Hexagonal Architecture, and CQRS patterns.
15
+ > Part of **[Stratix Framework](https://stratix-dev.github.io/docs/)** - A TypeScript framework for building scalable applications with Domain-Driven Design, Hexagonal Architecture, and CQRS patterns.
16
16
  >
17
- > **New to Stratix?** Start with the [Getting Started Guide](https://stratix-dev.github.io/stratix/docs/getting-started/quick-start)
17
+
18
+ ## ⚠️ Pre-Release Warning
19
+
20
+ **This is a pre-release version of @stratix/ai-openai.**
21
+
22
+ This package is under active development and should be considered unstable. The API may change significantly between versions without prior notice. Features may be added, modified, or removed entirely. This package may also be deprecated or discontinued in future releases.
23
+
24
+ **Stable versions will be available starting from version 1.0.0.** Not recommended for production use. Use at your own risk.
18
25
 
19
26
  ## About This Package
20
27
 
@@ -27,48 +34,19 @@ OpenAI LLM provider for Stratix AI agents
27
34
  Stratix is an AI-first TypeScript framework combining Domain-Driven Design, Hexagonal Architecture, and CQRS. It provides production-ready patterns for building scalable, maintainable applications with AI agents as first-class citizens.
28
35
 
29
36
  **Key Resources:**
30
- - [Documentation](https://stratix-dev.github.io/stratix/)
31
- - [Quick Start](https://stratix-dev.github.io/stratix/docs/getting-started/quick-start)
37
+ - [Documentation](https://stratix-dev.github.io/docs/)
32
38
  - [Report Issues](https://github.com/stratix-dev/stratix/issues)
33
39
 
34
40
  ## Installation
35
41
 
36
42
  **Prerequisites:**
37
43
  - Node.js 18.0.0 or higher
38
- - `@stratix/core` and `@stratix/runtime` installed
39
- - Basic understanding of [Stratix architecture](https://stratix-dev.github.io/stratix/docs/core-concepts/architecture-overview)
40
44
 
41
- **Recommended:** Use the Stratix CLI
42
- ```bash
43
- stratix add openai
44
- ```
45
-
46
- **Manual installation:**
45
+ **Installation:**
47
46
  ```bash
48
47
  npm install @stratix/ai-openai
49
48
  ```
50
49
 
51
- ## Related Packages
52
-
53
- **Essential:**
54
- - [`@stratix/core`](https://www.npmjs.com/package/@stratix/core) - Core primitives and abstractions
55
- - [`@stratix/runtime`](https://www.npmjs.com/package/@stratix/runtime) - Application runtime and plugin system
56
- - [`@stratix/cli`](https://www.npmjs.com/package/@stratix/cli) - Code generation and scaffolding
57
-
58
- [View all plugins](https://stratix-dev.github.io/stratix/docs/plugins/official-plugins)
59
-
60
- ## Documentation
61
-
62
- - [Getting Started](https://stratix-dev.github.io/stratix/docs/getting-started/quick-start)
63
- - [Core Concepts](https://stratix-dev.github.io/stratix/docs/core-concepts/architecture-overview)
64
- - [Plugin Architecture](https://stratix-dev.github.io/stratix/docs/plugins/plugin-architecture)
65
- - [Complete Documentation](https://stratix-dev.github.io/stratix/)
66
-
67
- ## Support
68
-
69
- - [GitHub Issues](https://github.com/stratix-dev/stratix/issues) - Report bugs and request features
70
- - [Documentation](https://stratix-dev.github.io/stratix/) - Comprehensive guides and tutorials
71
-
72
50
  ## License
73
51
 
74
52
  MIT - See [LICENSE](https://github.com/stratix-dev/stratix/blob/main/LICENSE) for details.
@@ -77,4 +55,4 @@ MIT - See [LICENSE](https://github.com/stratix-dev/stratix/blob/main/LICENSE) fo
77
55
 
78
56
  **[Stratix Framework](https://stratix-dev.github.io/stratix/)** - Build better software with proven patterns
79
57
 
80
- </div>
58
+ </div>
@@ -1,79 +1,97 @@
1
1
  import type { LLMProvider, ChatParams, ChatResponse, ChatChunk, EmbeddingParams, EmbeddingResponse } from '@stratix/core';
2
2
  import type { TokenUsage } from '@stratix/core';
3
+ /**
4
+ * Model configuration with optional pricing information
5
+ */
6
+ export interface ModelConfig {
7
+ readonly name: string;
8
+ readonly pricing?: {
9
+ readonly input: number;
10
+ readonly output: number;
11
+ };
12
+ }
13
+ /**
14
+ * Configuration for OpenAIProvider
15
+ */
16
+ export interface OpenAIConfig {
17
+ readonly apiKey: string;
18
+ readonly organization?: string;
19
+ readonly baseURL?: string;
20
+ readonly models: ModelConfig[];
21
+ }
3
22
  /**
4
23
  * OpenAI provider implementation for Stratix AI Agents.
5
24
  *
25
+ * Requires explicit model configuration - no defaults provided.
6
26
  * Supports GPT-4, GPT-3.5, and embeddings models with function calling and streaming.
7
27
  *
8
- * @example Basic chat
28
+ * @example Using predefined model constants
9
29
  * ```typescript
30
+ * import { OpenAIProvider, OPENAI_MODELS } from '@stratix/ai-openai';
31
+ *
10
32
  * const provider = new OpenAIProvider({
11
33
  * apiKey: process.env.OPENAI_API_KEY!,
12
- * organization: 'org-123'
34
+ * organization: 'org-123',
35
+ * models: [
36
+ * { name: gpt-5.2, pricing: { input: 1.75, output: 14.0 } },
37
+ * { name: gpt-5.1, pricing: { input: 1.25, output: 10.0 } }
38
+ * ]
13
39
  * });
14
40
  *
15
41
  * const response = await provider.chat({
16
- * model: 'gpt-4',
17
- * messages: [
18
- * { role: 'user', content: 'Hello!', timestamp: new Date() }
19
- * ],
20
- * temperature: 0.7
42
+ * model: 'gpt-4o',
43
+ * messages: [{ role: 'user', content: 'Hello!', timestamp: new Date() }]
21
44
  * });
22
45
  * ```
23
46
  *
24
- * @example Streaming
47
+ * @example Custom models with updated pricing
25
48
  * ```typescript
26
- * for await (const chunk of provider.streamChat({
27
- * model: 'gpt-4',
28
- * messages: [{ role: 'user', content: 'Write a story', timestamp: new Date() }]
29
- * })) {
30
- * process.stdout.write(chunk.content);
31
- * }
49
+ * const provider = new OpenAIProvider({
50
+ * apiKey: process.env.OPENAI_API_KEY!,
51
+ * models: [
52
+ * { name: 'gpt-4o', pricing: { input: 6.0, output: 22.0 } },
53
+ * { name: 'gpt-5', pricing: { input: 50.0, output: 150.0 } }
54
+ * ]
55
+ * });
32
56
  * ```
33
57
  *
34
- * @example Function calling
58
+ * @example Without pricing (calculateCost returns 0)
35
59
  * ```typescript
36
- * const response = await provider.chat({
37
- * model: 'gpt-4',
38
- * messages: [{ role: 'user', content: 'What is the weather?', timestamp: new Date() }],
39
- * tools: [{
40
- * name: 'getWeather',
41
- * description: 'Get weather for a location',
42
- * parameters: {
43
- * type: 'object',
44
- * properties: { city: { type: 'string' } }
45
- * }
46
- * }]
60
+ * const provider = new OpenAIProvider({
61
+ * apiKey: process.env.OPENAI_API_KEY!,
62
+ * models: [
63
+ * { name: 'gpt-4o' },
64
+ * { name: 'gpt-4o-mini' }
65
+ * ]
47
66
  * });
48
67
  * ```
49
68
  *
50
- * @example Embeddings
69
+ * @example Streaming
51
70
  * ```typescript
52
- * const result = await provider.embeddings({
53
- * model: 'text-embedding-3-small',
54
- * input: ['Hello world', 'Another text']
55
- * });
56
- * console.log(result.embeddings.length);
71
+ * for await (const chunk of provider.streamChat({
72
+ * model: 'gpt-4o',
73
+ * messages: [{ role: 'user', content: 'Write a story', timestamp: new Date() }]
74
+ * })) {
75
+ * process.stdout.write(chunk.content);
76
+ * }
57
77
  * ```
58
78
  */
59
79
  export declare class OpenAIProvider implements LLMProvider {
60
80
  readonly name = "openai";
61
81
  readonly models: string[];
62
82
  private client;
63
- constructor(config: {
64
- apiKey: string;
65
- organization?: string;
66
- baseURL?: string;
67
- });
83
+ private pricing;
84
+ constructor(config: OpenAIConfig);
68
85
  chat(params: ChatParams): Promise<ChatResponse>;
69
86
  streamChat(params: ChatParams): AsyncIterable<ChatChunk>;
70
87
  embeddings(params: EmbeddingParams): Promise<EmbeddingResponse>;
71
88
  /**
72
- * Calculates the cost of a chat completion based on token usage
89
+ * Calculates the cost of a chat completion based on token usage.
90
+ * Returns 0 if no pricing information is available for the model.
73
91
  *
74
92
  * @param model - The model used
75
93
  * @param usage - Token usage information
76
- * @returns Cost in USD
94
+ * @returns Cost in USD, or 0 if pricing not configured
77
95
  */
78
96
  calculateCost(model: string, usage: TokenUsage): number;
79
97
  private convertMessages;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenAIProvider.d.ts","sourceRoot":"","sources":["../src/OpenAIProvider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAgB,UAAU,EAAY,MAAM,eAAe,CAAC;AAoBxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,qBAAa,cAAe,YAAW,WAAW;IAChD,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,MAAM,WAQb;IAEF,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAQzE,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAuC9C,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC;IAuBzD,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoBrE;;;;;;OAMG;IACH,aAAa,CAAC,K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AAY,CAAC;IAuC9C,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC;IAuBzD,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoBrE;;;;;;;OAOG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM;IAYvD,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,qBAAqB;IA2B7B,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,eAAe;CAgBxB"}
@@ -1,90 +1,74 @@
1
1
  import OpenAI from 'openai';
2
- /**
3
- * Pricing per 1M tokens for OpenAI models (as of January 2025)
4
- * Source: https://openai.com/api/pricing/
5
- * Update these values as pricing changes
6
- */
7
- const MODEL_PRICING = {
8
- 'gpt-4o': { input: 5.0, output: 20.0 },
9
- 'gpt-4o-mini': { input: 0.6, output: 2.4 },
10
- 'gpt-4': { input: 30.0, output: 60.0 },
11
- 'gpt-4-turbo': { input: 10.0, output: 30.0 },
12
- 'gpt-4-turbo-preview': { input: 10.0, output: 30.0 },
13
- 'gpt-3.5-turbo': { input: 0.5, output: 1.5 },
14
- 'gpt-3.5-turbo-16k': { input: 3.0, output: 4.0 },
15
- 'text-embedding-3-small': { input: 0.02, output: 0 },
16
- 'text-embedding-3-large': { input: 0.13, output: 0 },
17
- 'text-embedding-ada-002': { input: 0.1, output: 0 },
18
- };
19
2
  /**
20
3
  * OpenAI provider implementation for Stratix AI Agents.
21
4
  *
5
+ * Requires explicit model configuration - no defaults provided.
22
6
  * Supports GPT-4, GPT-3.5, and embeddings models with function calling and streaming.
23
7
  *
24
- * @example Basic chat
8
+ * @example Using predefined model constants
25
9
  * ```typescript
10
+ * import { OpenAIProvider, OPENAI_MODELS } from '@stratix/ai-openai';
11
+ *
26
12
  * const provider = new OpenAIProvider({
27
13
  * apiKey: process.env.OPENAI_API_KEY!,
28
- * organization: 'org-123'
14
+ * organization: 'org-123',
15
+ * models: [
16
+ * { name: gpt-5.2, pricing: { input: 1.75, output: 14.0 } },
17
+ * { name: gpt-5.1, pricing: { input: 1.25, output: 10.0 } }
18
+ * ]
29
19
  * });
30
20
  *
31
21
  * const response = await provider.chat({
32
- * model: 'gpt-4',
33
- * messages: [
34
- * { role: 'user', content: 'Hello!', timestamp: new Date() }
35
- * ],
36
- * temperature: 0.7
22
+ * model: 'gpt-4o',
23
+ * messages: [{ role: 'user', content: 'Hello!', timestamp: new Date() }]
37
24
  * });
38
25
  * ```
39
26
  *
40
- * @example Streaming
27
+ * @example Custom models with updated pricing
41
28
  * ```typescript
42
- * for await (const chunk of provider.streamChat({
43
- * model: 'gpt-4',
44
- * messages: [{ role: 'user', content: 'Write a story', timestamp: new Date() }]
45
- * })) {
46
- * process.stdout.write(chunk.content);
47
- * }
29
+ * const provider = new OpenAIProvider({
30
+ * apiKey: process.env.OPENAI_API_KEY!,
31
+ * models: [
32
+ * { name: 'gpt-4o', pricing: { input: 6.0, output: 22.0 } },
33
+ * { name: 'gpt-5', pricing: { input: 50.0, output: 150.0 } }
34
+ * ]
35
+ * });
48
36
  * ```
49
37
  *
50
- * @example Function calling
38
+ * @example Without pricing (calculateCost returns 0)
51
39
  * ```typescript
52
- * const response = await provider.chat({
53
- * model: 'gpt-4',
54
- * messages: [{ role: 'user', content: 'What is the weather?', timestamp: new Date() }],
55
- * tools: [{
56
- * name: 'getWeather',
57
- * description: 'Get weather for a location',
58
- * parameters: {
59
- * type: 'object',
60
- * properties: { city: { type: 'string' } }
61
- * }
62
- * }]
40
+ * const provider = new OpenAIProvider({
41
+ * apiKey: process.env.OPENAI_API_KEY!,
42
+ * models: [
43
+ * { name: 'gpt-4o' },
44
+ * { name: 'gpt-4o-mini' }
45
+ * ]
63
46
  * });
64
47
  * ```
65
48
  *
66
- * @example Embeddings
49
+ * @example Streaming
67
50
  * ```typescript
68
- * const result = await provider.embeddings({
69
- * model: 'text-embedding-3-small',
70
- * input: ['Hello world', 'Another text']
71
- * });
72
- * console.log(result.embeddings.length);
51
+ * for await (const chunk of provider.streamChat({
52
+ * model: 'gpt-4o',
53
+ * messages: [{ role: 'user', content: 'Write a story', timestamp: new Date() }]
54
+ * })) {
55
+ * process.stdout.write(chunk.content);
56
+ * }
73
57
  * ```
74
58
  */
75
59
  export class OpenAIProvider {
76
60
  name = 'openai';
77
- models = [
78
- 'gpt-4o',
79
- 'gpt-4o-mini',
80
- 'gpt-4',
81
- 'gpt-4-turbo',
82
- 'gpt-4-turbo-preview',
83
- 'gpt-3.5-turbo',
84
- 'gpt-3.5-turbo-16k',
85
- ];
61
+ models;
86
62
  client;
63
+ pricing;
87
64
  constructor(config) {
65
+ if (!config.models || config.models.length === 0) {
66
+ throw new Error('OpenAIProvider requires at least one model to be configured');
67
+ }
68
+ this.models = config.models.map((m) => m.name);
69
+ this.pricing = new Map(config.models
70
+ .filter((m) => m.pricing !== undefined)
71
+ .map((m) => [m.name, m.pricing]));
88
72
  this.client = new OpenAI({
89
73
  apiKey: config.apiKey,
90
74
  organization: config.organization,
@@ -161,16 +145,16 @@ export class OpenAIProvider {
161
145
  };
162
146
  }
163
147
  /**
164
- * Calculates the cost of a chat completion based on token usage
148
+ * Calculates the cost of a chat completion based on token usage.
149
+ * Returns 0 if no pricing information is available for the model.
165
150
  *
166
151
  * @param model - The model used
167
152
  * @param usage - Token usage information
168
- * @returns Cost in USD
153
+ * @returns Cost in USD, or 0 if pricing not configured
169
154
  */
170
155
  calculateCost(model, usage) {
171
- const pricing = MODEL_PRICING[model];
156
+ const pricing = this.pricing.get(model);
172
157
  if (!pricing) {
173
- console.warn(`No pricing information for model: ${model}`);
174
158
  return 0;
175
159
  }
176
160
  const inputCost = (usage.promptTokens / 1_000_000) * pricing.input;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenAIProvider.js","sourceRoot":"","sources":["../src/OpenAIProvider.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ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AAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QACjC,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACnD,qEAAqE;YACrE,MAAM,yBAAyB,GAAG;gBAChC,GAAG,MAAM,CAAC,MAAM;gBAChB,oBAAoB,EAAE,KAAK;aAC5B,CAAC;YAEF,OAAO;gBACL,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE;oBACX,IAAI,EAAE,iBAAiB;oBACvB,MAAM,EAAE,yBAAyB;oBACjC,MAAM,EAAE,IAAI;iBACb;aACF,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,gBAAgB,CACtB,SAAkE;QAElE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC5B,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI;YACtB,mEAAmE;YACnE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;SAC7C,CAAC,CAAC,CAAC;IACN,CAAC;IAEO,eAAe,CACrB,MAAiC;QAEjC,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,MAAM;gBACT,OAAO,MAAM,CAAC;YAChB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB,KAAK,YAAY;gBACf,OAAO,YAAY,CAAC;YACtB,KAAK,gBAAgB;gBACnB,OAAO,gBAAgB,CAAC;YAC1B;gBACE,OAAO,MAAM,CAAC;QAClB,CAAC;IACH,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { OpenAIProvider } from './OpenAIProvider.js';
2
+ export type { ModelConfig, OpenAIConfig } from './OpenAIProvider.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stratix/ai-openai",
3
- "version": "0.7.6",
3
+ "version": "0.8.1",
4
4
  "description": "Stratix AI Agents - OpenAI Provider",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "openai": "^4.75.0",
43
- "@stratix/core": "^0.7.6"
43
+ "@stratix/core": "^0.8.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^20.0.0",