@aj-archipelago/cortex 1.3.19 → 1.3.20

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
@@ -1,5 +1,5 @@
1
1
  # Cortex
2
- Cortex simplifies and accelerates the process of creating applications that harness the power of modern AI models like GPT-4o (chatGPT), o1, Gemini, the Claude series, Flux, Grok and more by poviding a structured interface (GraphQL or REST) to a powerful prompt execution environment. This enables complex augmented prompting and abstracts away most of the complexity of managing model connections like chunking input, rate limiting, formatting output, caching, and handling errors.
2
+ Cortex simplifies and accelerates the process of creating applications that harness the power of modern AI models like GPT-4o (chatGPT), o1, o3-mini, Gemini, the Claude series, Flux, Grok and more by poviding a structured interface (GraphQL or REST) to a powerful prompt execution environment. This enables complex augmented prompting and abstracts away most of the complexity of managing model connections like chunking input, rate limiting, formatting output, caching, and handling errors.
3
3
  ## Why build Cortex?
4
4
  Modern AI models are transformational, but a number of complexities emerge when developers start using them to deliver application-ready functions. Most models require precisely formatted, carefully engineered and sequenced prompts to produce consistent results, and the responses are typically largely unstructured text without validation or formatting. Additionally, these models are evolving rapidly, are typically costly and slow to query and implement hard request size and rate restrictions that need to be carefully navigated for optimum throughput. Cortex offers a solution to these problems and provides a simple and extensible package for interacting with NL AI models.
5
5
 
@@ -20,7 +20,7 @@ Just about anything! It's kind of an LLM swiss army knife. Here are some ideas:
20
20
  - OpenAI models:
21
21
  - GPT-4 Omni (GPT-4o)
22
22
  - GPT-4 Omni Mini (GPT-4o-mini)
23
- - O1 (including o1-mini and o1-preview) (Advanced reasoning models)
23
+ - O1 and O3-mini (Advanced reasoning models)
24
24
  - Most of the earlier GPT models (GPT-4, 3.5 Turbo, etc.)
25
25
  - Google models:
26
26
  - Gemini 1.5 Pro
@@ -521,7 +521,7 @@ Models are configured in the `models` section of the config. Each model can have
521
521
 
522
522
  - `OPENAI-CHAT`: For OpenAI chat models (legacy GPT-3.5)
523
523
  - `OPENAI-VISION`: For multimodal models (GPT-4o, GPT-4o-mini) supporting text, images, and other content types
524
- - `OPENAI-REASONING`: For O1 reasoning model with vision capabilities
524
+ - `OPENAI-REASONING`: For O1 and O3-mini reasoning models with vision capabilities
525
525
  - `OPENAI-COMPLETION`: For OpenAI completion models
526
526
  - `OPENAI-WHISPER`: For Whisper transcription
527
527
  - `GEMINI-1.5-CHAT`: For Gemini 1.5 Pro chat models
package/config.js CHANGED
@@ -207,7 +207,7 @@ var config = convict({
207
207
  "maxReturnTokens": 100000,
208
208
  "supportsStreaming": false
209
209
  },
210
- "oai-o1-mini": {
210
+ "oai-o3-mini": {
211
211
  "type": "OPENAI-REASONING",
212
212
  "url": "https://api.openai.com/v1/chat/completions",
213
213
  "headers": {
@@ -215,26 +215,11 @@ var config = convict({
215
215
  "Content-Type": "application/json"
216
216
  },
217
217
  "params": {
218
- "model": "o1-mini"
218
+ "model": "o3-mini"
219
219
  },
220
220
  "requestsPerSecond": 10,
221
- "maxTokenLength": 128000,
222
- "maxReturnTokens": 65536,
223
- "supportsStreaming": false
224
- },
225
- "oai-o1-preview": {
226
- "type": "OPENAI-REASONING",
227
- "url": "https://api.openai.com/v1/chat/completions",
228
- "headers": {
229
- "Authorization": "Bearer {{OPENAI_API_KEY}}",
230
- "Content-Type": "application/json"
231
- },
232
- "params": {
233
- "model": "o1-preview"
234
- },
235
- "requestsPerSecond": 10,
236
- "maxTokenLength": 128000,
237
- "maxReturnTokens": 32768,
221
+ "maxTokenLength": 200000,
222
+ "maxReturnTokens": 100000,
238
223
  "supportsStreaming": false
239
224
  },
240
225
  "azure-bing": {
@@ -77,16 +77,23 @@ export const ACCEPTED_MIME_TYPES = {
77
77
  'audio/aac': ['.aac'],
78
78
  'audio/ogg': ['.ogg'],
79
79
  'audio/flac': ['.flac'],
80
+ 'audio/m4a': ['.m4a'],
81
+ 'audio/x-m4a': ['.m4a'],
82
+ 'audio/mp3': ['.mp3'],
83
+ 'audio/mp4': ['.mp4'],
80
84
 
81
85
  // Video types
82
86
  'video/mp4': ['.mp4'],
83
87
  'video/mpeg': ['.mpeg', '.mpg'],
88
+ 'video/mov': ['.mov'],
84
89
  'video/quicktime': ['.mov'],
85
90
  'video/x-msvideo': ['.avi'],
86
91
  'video/x-flv': ['.flv'],
92
+ 'video/mpg': ['.mpeg', '.mpg'],
87
93
  'video/webm': ['.webm'],
88
- 'video/x-ms-wmv': ['.wmv'],
89
- 'video/3gpp': ['.3gp']
94
+ 'video/wmv': ['.wmv'],
95
+ 'video/3gpp': ['.3gp'],
96
+ 'video/m4v': ['.m4v'],
90
97
  };
91
98
 
92
99
  // Helper function to check if a mime type is accepted
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aj-archipelago/cortex",
3
- "version": "1.3.19",
3
+ "version": "1.3.20",
4
4
  "description": "Cortex is a GraphQL API for AI. It provides a simple, extensible interface for using AI services from OpenAI, Azure and others.",
5
5
  "private": false,
6
6
  "repository": {
@@ -57,7 +57,15 @@ export default {
57
57
 
58
58
  const result = await callPathway(generatorPathway, newArgs, resolver);
59
59
 
60
- return args.stream ? "" : result;
60
+ if (args.stream) {
61
+ return "";
62
+ }
63
+
64
+ if (!result) {
65
+ result = await callPathway('sys_generator_error', { ...args, text: `Tried to use a tool (${generatorPathway}), but no result was returned`, stream: false }, resolver);
66
+ }
67
+
68
+ return result;
61
69
 
62
70
  } catch (e) {
63
71
  resolver.logError(e.message ?? e);
@@ -15,7 +15,7 @@ export default {
15
15
  aiName: "Jarvis",
16
16
  language: "English",
17
17
  },
18
- model: 'oai-o1',
18
+ model: 'oai-o3-mini',
19
19
  useInputChunking: false,
20
20
  enableDuplicateRequests: false,
21
21
  timeout: 600,
@@ -1,4 +1,4 @@
1
- // sys_openai_chat_o1_mini.js
1
+ // sys_openai_chat_o3_mini.js
2
2
 
3
3
  import { Prompt } from '../../../server/prompt.js';
4
4
 
@@ -12,8 +12,8 @@ export default {
12
12
  inputParameters: {
13
13
  messages: [],
14
14
  },
15
- model: 'oai-o1-mini',
15
+ model: 'oai-o3-mini',
16
16
  useInputChunking: false,
17
- emulateOpenAIChatModel: 'o1-mini',
17
+ emulateOpenAIChatModel: 'o3-mini',
18
18
  enableDuplicateRequests: false,
19
19
  }