@aj-archipelago/cortex 1.3.61 → 1.3.63
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/.github/workflows/cortex-file-handler-test.yml +61 -0
- package/README.md +31 -7
- package/config/default.example.json +15 -0
- package/config.js +158 -12
- package/helper-apps/cortex-autogen2/DigiCertGlobalRootCA.crt.pem +22 -0
- package/helper-apps/cortex-autogen2/Dockerfile +31 -0
- package/helper-apps/cortex-autogen2/Dockerfile.worker +41 -0
- package/helper-apps/cortex-autogen2/README.md +183 -0
- package/helper-apps/cortex-autogen2/__init__.py +1 -0
- package/helper-apps/cortex-autogen2/agents.py +131 -0
- package/helper-apps/cortex-autogen2/docker-compose.yml +20 -0
- package/helper-apps/cortex-autogen2/function_app.py +55 -0
- package/helper-apps/cortex-autogen2/host.json +15 -0
- package/helper-apps/cortex-autogen2/main.py +126 -0
- package/helper-apps/cortex-autogen2/poetry.lock +3652 -0
- package/helper-apps/cortex-autogen2/pyproject.toml +36 -0
- package/helper-apps/cortex-autogen2/requirements.txt +20 -0
- package/helper-apps/cortex-autogen2/send_task.py +105 -0
- package/helper-apps/cortex-autogen2/services/__init__.py +1 -0
- package/helper-apps/cortex-autogen2/services/azure_queue.py +85 -0
- package/helper-apps/cortex-autogen2/services/redis_publisher.py +153 -0
- package/helper-apps/cortex-autogen2/task_processor.py +488 -0
- package/helper-apps/cortex-autogen2/tools/__init__.py +24 -0
- package/helper-apps/cortex-autogen2/tools/azure_blob_tools.py +175 -0
- package/helper-apps/cortex-autogen2/tools/azure_foundry_agents.py +601 -0
- package/helper-apps/cortex-autogen2/tools/coding_tools.py +72 -0
- package/helper-apps/cortex-autogen2/tools/download_tools.py +48 -0
- package/helper-apps/cortex-autogen2/tools/file_tools.py +545 -0
- package/helper-apps/cortex-autogen2/tools/search_tools.py +646 -0
- package/helper-apps/cortex-azure-cleaner/README.md +36 -0
- package/helper-apps/cortex-file-converter/README.md +93 -0
- package/helper-apps/cortex-file-converter/key_to_pdf.py +104 -0
- package/helper-apps/cortex-file-converter/list_blob_extensions.py +89 -0
- package/helper-apps/cortex-file-converter/process_azure_keynotes.py +181 -0
- package/helper-apps/cortex-file-converter/requirements.txt +1 -0
- package/helper-apps/cortex-file-handler/.env.test.azure.ci +7 -0
- package/helper-apps/cortex-file-handler/.env.test.azure.sample +1 -1
- package/helper-apps/cortex-file-handler/.env.test.gcs.ci +10 -0
- package/helper-apps/cortex-file-handler/.env.test.gcs.sample +2 -2
- package/helper-apps/cortex-file-handler/INTERFACE.md +41 -0
- package/helper-apps/cortex-file-handler/package.json +1 -1
- package/helper-apps/cortex-file-handler/scripts/setup-azure-container.js +41 -17
- package/helper-apps/cortex-file-handler/scripts/setup-test-containers.js +30 -15
- package/helper-apps/cortex-file-handler/scripts/test-azure.sh +32 -6
- package/helper-apps/cortex-file-handler/scripts/test-gcs.sh +24 -2
- package/helper-apps/cortex-file-handler/scripts/validate-env.js +128 -0
- package/helper-apps/cortex-file-handler/src/blobHandler.js +161 -51
- package/helper-apps/cortex-file-handler/src/constants.js +3 -0
- package/helper-apps/cortex-file-handler/src/fileChunker.js +10 -8
- package/helper-apps/cortex-file-handler/src/index.js +116 -9
- package/helper-apps/cortex-file-handler/src/redis.js +61 -1
- package/helper-apps/cortex-file-handler/src/services/ConversionService.js +11 -8
- package/helper-apps/cortex-file-handler/src/services/FileConversionService.js +2 -2
- package/helper-apps/cortex-file-handler/src/services/storage/AzureStorageProvider.js +88 -6
- package/helper-apps/cortex-file-handler/src/services/storage/GCSStorageProvider.js +58 -0
- package/helper-apps/cortex-file-handler/src/services/storage/StorageFactory.js +25 -5
- package/helper-apps/cortex-file-handler/src/services/storage/StorageProvider.js +9 -0
- package/helper-apps/cortex-file-handler/src/services/storage/StorageService.js +120 -16
- package/helper-apps/cortex-file-handler/src/start.js +27 -17
- package/helper-apps/cortex-file-handler/tests/FileConversionService.test.js +52 -1
- package/helper-apps/cortex-file-handler/tests/blobHandler.test.js +40 -0
- package/helper-apps/cortex-file-handler/tests/checkHashShortLived.test.js +553 -0
- package/helper-apps/cortex-file-handler/tests/cleanup.test.js +46 -52
- package/helper-apps/cortex-file-handler/tests/containerConversionFlow.test.js +451 -0
- package/helper-apps/cortex-file-handler/tests/containerNameParsing.test.js +229 -0
- package/helper-apps/cortex-file-handler/tests/containerParameterFlow.test.js +392 -0
- package/helper-apps/cortex-file-handler/tests/conversionResilience.test.js +7 -2
- package/helper-apps/cortex-file-handler/tests/deleteOperations.test.js +348 -0
- package/helper-apps/cortex-file-handler/tests/fileChunker.test.js +23 -2
- package/helper-apps/cortex-file-handler/tests/fileUpload.test.js +11 -5
- package/helper-apps/cortex-file-handler/tests/getOperations.test.js +58 -24
- package/helper-apps/cortex-file-handler/tests/postOperations.test.js +11 -4
- package/helper-apps/cortex-file-handler/tests/shortLivedUrlConversion.test.js +225 -0
- package/helper-apps/cortex-file-handler/tests/start.test.js +8 -12
- package/helper-apps/cortex-file-handler/tests/storage/StorageFactory.test.js +80 -0
- package/helper-apps/cortex-file-handler/tests/storage/StorageService.test.js +388 -22
- package/helper-apps/cortex-file-handler/tests/testUtils.helper.js +74 -0
- package/lib/cortexResponse.js +153 -0
- package/lib/entityConstants.js +19 -12
- package/lib/logger.js +21 -4
- package/lib/pathwayTools.js +28 -9
- package/lib/util.js +49 -0
- package/package.json +1 -1
- package/pathways/basePathway.js +1 -0
- package/pathways/bing_afagent.js +54 -1
- package/pathways/call_tools.js +2 -3
- package/pathways/chat_jarvis.js +1 -1
- package/pathways/google_cse.js +27 -0
- package/pathways/grok_live_search.js +18 -0
- package/pathways/system/entity/memory/sys_memory_lookup_required.js +1 -0
- package/pathways/system/entity/memory/sys_memory_required.js +1 -0
- package/pathways/system/entity/memory/sys_search_memory.js +1 -0
- package/pathways/system/entity/sys_entity_agent.js +56 -4
- package/pathways/system/entity/sys_generator_quick.js +1 -0
- package/pathways/system/entity/tools/sys_tool_bing_search.js +2 -0
- package/pathways/system/entity/tools/sys_tool_bing_search_afagent.js +31 -5
- package/pathways/system/entity/tools/sys_tool_google_search.js +141 -0
- package/pathways/system/entity/tools/sys_tool_grok_x_search.js +237 -0
- package/pathways/system/entity/tools/sys_tool_image.js +1 -1
- package/pathways/system/rest_streaming/sys_claude_37_sonnet.js +21 -0
- package/pathways/system/rest_streaming/sys_claude_41_opus.js +21 -0
- package/pathways/system/rest_streaming/sys_claude_4_sonnet.js +21 -0
- package/pathways/system/rest_streaming/sys_google_gemini_25_flash.js +25 -0
- package/pathways/system/rest_streaming/{sys_google_gemini_chat.js → sys_google_gemini_25_pro.js} +6 -4
- package/pathways/system/rest_streaming/sys_grok_4.js +23 -0
- package/pathways/system/rest_streaming/sys_grok_4_fast_non_reasoning.js +23 -0
- package/pathways/system/rest_streaming/sys_grok_4_fast_reasoning.js +23 -0
- package/pathways/system/rest_streaming/sys_openai_chat.js +3 -0
- package/pathways/system/rest_streaming/sys_openai_chat_gpt41.js +22 -0
- package/pathways/system/rest_streaming/sys_openai_chat_gpt41_mini.js +21 -0
- package/pathways/system/rest_streaming/sys_openai_chat_gpt41_nano.js +21 -0
- package/pathways/system/rest_streaming/{sys_claude_35_sonnet.js → sys_openai_chat_gpt4_omni.js} +6 -4
- package/pathways/system/rest_streaming/sys_openai_chat_gpt4_omni_mini.js +21 -0
- package/pathways/system/rest_streaming/{sys_claude_3_haiku.js → sys_openai_chat_gpt5.js} +7 -5
- package/pathways/system/rest_streaming/sys_openai_chat_gpt5_chat.js +21 -0
- package/pathways/system/rest_streaming/sys_openai_chat_gpt5_mini.js +21 -0
- package/pathways/system/rest_streaming/sys_openai_chat_gpt5_nano.js +21 -0
- package/pathways/system/rest_streaming/{sys_openai_chat_o1.js → sys_openai_chat_o3.js} +6 -3
- package/pathways/system/rest_streaming/sys_openai_chat_o3_mini.js +3 -0
- package/pathways/system/workspaces/run_workspace_prompt.js +99 -0
- package/pathways/vision.js +1 -1
- package/server/graphql.js +1 -1
- package/server/modelExecutor.js +8 -0
- package/server/pathwayResolver.js +166 -16
- package/server/pathwayResponseParser.js +16 -8
- package/server/plugins/azureFoundryAgentsPlugin.js +12 -23
- package/server/plugins/claude3VertexPlugin.js +193 -45
- package/server/plugins/gemini15ChatPlugin.js +21 -0
- package/server/plugins/gemini15VisionPlugin.js +360 -0
- package/server/plugins/googleCsePlugin.js +94 -0
- package/server/plugins/grokVisionPlugin.js +365 -0
- package/server/plugins/modelPlugin.js +3 -1
- package/server/plugins/openAiChatPlugin.js +106 -13
- package/server/plugins/openAiVisionPlugin.js +42 -30
- package/server/resolver.js +28 -4
- package/server/rest.js +270 -53
- package/server/typeDef.js +1 -0
- package/tests/{mocks.js → helpers/mocks.js} +5 -2
- package/tests/{server.js → helpers/server.js} +2 -2
- package/tests/helpers/sseAssert.js +23 -0
- package/tests/helpers/sseClient.js +73 -0
- package/tests/helpers/subscriptionAssert.js +11 -0
- package/tests/helpers/subscriptions.js +113 -0
- package/tests/{sublong.srt → integration/features/translate/sublong.srt} +4543 -4543
- package/tests/integration/features/translate/translate_chunking_stream.test.js +100 -0
- package/tests/{translate_srt.test.js → integration/features/translate/translate_srt.test.js} +2 -2
- package/tests/integration/graphql/async/stream/agentic.test.js +477 -0
- package/tests/integration/graphql/async/stream/subscription_streaming.test.js +62 -0
- package/tests/integration/graphql/async/stream/sys_entity_start_streaming.test.js +71 -0
- package/tests/integration/graphql/async/stream/vendors/claude_streaming.test.js +56 -0
- package/tests/integration/graphql/async/stream/vendors/gemini_streaming.test.js +66 -0
- package/tests/integration/graphql/async/stream/vendors/grok_streaming.test.js +56 -0
- package/tests/integration/graphql/async/stream/vendors/openai_streaming.test.js +72 -0
- package/tests/integration/graphql/features/google/sysToolGoogleSearch.test.js +96 -0
- package/tests/integration/graphql/features/grok/grok.test.js +688 -0
- package/tests/integration/graphql/features/grok/grok_x_search_tool.test.js +354 -0
- package/tests/{main.test.js → integration/graphql/features/main.test.js} +1 -1
- package/tests/{call_tools.test.js → integration/graphql/features/tools/call_tools.test.js} +2 -2
- package/tests/{vision.test.js → integration/graphql/features/vision/vision.test.js} +1 -1
- package/tests/integration/graphql/subscriptions/connection.test.js +26 -0
- package/tests/{openai_api.test.js → integration/rest/oai/openai_api.test.js} +63 -238
- package/tests/integration/rest/oai/tool_calling_api.test.js +343 -0
- package/tests/integration/rest/oai/tool_calling_streaming.test.js +85 -0
- package/tests/integration/rest/vendors/claude_streaming.test.js +47 -0
- package/tests/integration/rest/vendors/claude_tool_calling_streaming.test.js +75 -0
- package/tests/integration/rest/vendors/gemini_streaming.test.js +47 -0
- package/tests/integration/rest/vendors/gemini_tool_calling_streaming.test.js +75 -0
- package/tests/integration/rest/vendors/grok_streaming.test.js +55 -0
- package/tests/integration/rest/vendors/grok_tool_calling_streaming.test.js +75 -0
- package/tests/{azureAuthTokenHelper.test.js → unit/core/azureAuthTokenHelper.test.js} +1 -1
- package/tests/{chunkfunction.test.js → unit/core/chunkfunction.test.js} +2 -2
- package/tests/{config.test.js → unit/core/config.test.js} +3 -3
- package/tests/{encodeCache.test.js → unit/core/encodeCache.test.js} +1 -1
- package/tests/{fastLruCache.test.js → unit/core/fastLruCache.test.js} +1 -1
- package/tests/{handleBars.test.js → unit/core/handleBars.test.js} +1 -1
- package/tests/{memoryfunction.test.js → unit/core/memoryfunction.test.js} +2 -2
- package/tests/unit/core/mergeResolver.test.js +952 -0
- package/tests/{parser.test.js → unit/core/parser.test.js} +3 -3
- package/tests/unit/core/pathwayResolver.test.js +187 -0
- package/tests/{requestMonitor.test.js → unit/core/requestMonitor.test.js} +1 -1
- package/tests/{requestMonitorDurationEstimator.test.js → unit/core/requestMonitorDurationEstimator.test.js} +1 -1
- package/tests/{truncateMessages.test.js → unit/core/truncateMessages.test.js} +3 -3
- package/tests/{util.test.js → unit/core/util.test.js} +1 -1
- package/tests/{apptekTranslatePlugin.test.js → unit/plugins/apptekTranslatePlugin.test.js} +3 -3
- package/tests/{azureFoundryAgents.test.js → unit/plugins/azureFoundryAgents.test.js} +142 -9
- package/tests/{claude3VertexPlugin.test.js → unit/plugins/claude3VertexPlugin.test.js} +32 -10
- package/tests/{claude3VertexToolConversion.test.js → unit/plugins/claude3VertexToolConversion.test.js} +3 -3
- package/tests/unit/plugins/googleCsePlugin.test.js +111 -0
- package/tests/unit/plugins/grokVisionPlugin.test.js +1392 -0
- package/tests/{modelPlugin.test.js → unit/plugins/modelPlugin.test.js} +3 -3
- package/tests/{multimodal_conversion.test.js → unit/plugins/multimodal_conversion.test.js} +4 -4
- package/tests/{openAiChatPlugin.test.js → unit/plugins/openAiChatPlugin.test.js} +13 -4
- package/tests/{openAiToolPlugin.test.js → unit/plugins/openAiToolPlugin.test.js} +35 -27
- package/tests/{tokenHandlingTests.test.js → unit/plugins/tokenHandlingTests.test.js} +5 -5
- package/tests/{translate_apptek.test.js → unit/plugins/translate_apptek.test.js} +3 -3
- package/tests/{streaming.test.js → unit/plugins.streaming/plugin_stream_events.test.js} +19 -58
- package/helper-apps/mogrt-handler/tests/test-files/test.gif +0 -1
- package/helper-apps/mogrt-handler/tests/test-files/test.mogrt +0 -1
- package/helper-apps/mogrt-handler/tests/test-files/test.mp4 +0 -1
- package/pathways/system/rest_streaming/sys_openai_chat_gpt4.js +0 -19
- package/pathways/system/rest_streaming/sys_openai_chat_gpt4_32.js +0 -19
- package/pathways/system/rest_streaming/sys_openai_chat_gpt4_turbo.js +0 -19
- package/pathways/system/workspaces/run_claude35_sonnet.js +0 -21
- package/pathways/system/workspaces/run_claude3_haiku.js +0 -20
- package/pathways/system/workspaces/run_gpt35turbo.js +0 -20
- package/pathways/system/workspaces/run_gpt4.js +0 -20
- package/pathways/system/workspaces/run_gpt4_32.js +0 -20
- package/tests/agentic.test.js +0 -256
- package/tests/pathwayResolver.test.js +0 -78
- package/tests/subscription.test.js +0 -387
- /package/tests/{subchunk.srt → integration/features/translate/subchunk.srt} +0 -0
- /package/tests/{subhorizontal.srt → integration/features/translate/subhorizontal.srt} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Cortex File Handler Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, dev ]
|
|
6
|
+
paths:
|
|
7
|
+
- 'helper-apps/cortex-file-handler/**'
|
|
8
|
+
- '.github/workflows/cortex-file-handler-test.yml'
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ main, dev ]
|
|
11
|
+
paths:
|
|
12
|
+
- 'helper-apps/cortex-file-handler/**'
|
|
13
|
+
- '.github/workflows/cortex-file-handler-test.yml'
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
test:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
defaults:
|
|
21
|
+
run:
|
|
22
|
+
working-directory: helper-apps/cortex-file-handler
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout code
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
|
|
28
|
+
- name: Setup Node.js 20.x
|
|
29
|
+
uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: '20.x'
|
|
32
|
+
cache: 'npm'
|
|
33
|
+
cache-dependency-path: helper-apps/cortex-file-handler/package-lock.json
|
|
34
|
+
|
|
35
|
+
- name: Install system dependencies
|
|
36
|
+
run: |
|
|
37
|
+
sudo apt-get update
|
|
38
|
+
sudo apt-get install -y ffmpeg
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: npm ci
|
|
42
|
+
|
|
43
|
+
- name: Install Azurite
|
|
44
|
+
run: npm install -g azurite
|
|
45
|
+
|
|
46
|
+
- name: Setup GCS test environment
|
|
47
|
+
run: cp .env.test.gcs.ci .env.test.gcs
|
|
48
|
+
|
|
49
|
+
- name: Setup Azure test environment
|
|
50
|
+
run: cp .env.test.azure.ci .env.test.azure
|
|
51
|
+
|
|
52
|
+
- name: Run GCS tests
|
|
53
|
+
run: npm run test:gcs
|
|
54
|
+
|
|
55
|
+
- name: Run Azure tests
|
|
56
|
+
run: npm run test:azure
|
|
57
|
+
|
|
58
|
+
- name: Run tests
|
|
59
|
+
run: npm test
|
|
60
|
+
env:
|
|
61
|
+
NODE_ENV: test
|
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Cortex
|
|
2
|
-
Cortex simplifies and accelerates the process of creating applications that harness the power of modern AI models like GPT-
|
|
2
|
+
Cortex simplifies and accelerates the process of creating applications that harness the power of modern AI models like GPT-5 (chatGPT), o4, 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
4
|
## Why build Cortex?
|
|
4
5
|
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
6
|
|
|
@@ -18,6 +19,7 @@ Just about anything! It's kind of an LLM swiss army knife. Here are some ideas:
|
|
|
18
19
|
* Simple architecture to build custom functional endpoints (called `pathways`), that implement common NL AI tasks. Default pathways include chat, summarization, translation, paraphrasing, completion, spelling and grammar correction, entity extraction, sentiment analysis, and bias analysis.
|
|
19
20
|
* Extensive model support with built-in integrations for:
|
|
20
21
|
- OpenAI models:
|
|
22
|
+
- GPT-5 (all flavors and router)
|
|
21
23
|
- GPT-4.1 (+mini, +nano)
|
|
22
24
|
- GPT-4 Omni (GPT-4o)
|
|
23
25
|
- O3 and O4-mini (Advanced reasoning models)
|
|
@@ -28,10 +30,15 @@ Just about anything! It's kind of an LLM swiss army knife. Here are some ideas:
|
|
|
28
30
|
- Gemini 2.0 Flash
|
|
29
31
|
- Earlier Google models (Gemini 1.5 series)
|
|
30
32
|
- Anthropic models:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
- Claude 4 Sonnet (Vertex)
|
|
34
|
+
- Claude 4.1 Opus (Vertex)
|
|
35
|
+
- Claude 3.7 Sonnet
|
|
36
|
+
- Claude 3.5 Sonnet
|
|
37
|
+
- Claude 3.5 Haiku
|
|
38
|
+
- Claude 3 Series
|
|
39
|
+
- Grok (XAI) models:
|
|
40
|
+
- Grok 3 and Grok 4 series (including fast-reasoning and code-fast variants)
|
|
41
|
+
- Multimodal chat with vision, streaming, and tool calling
|
|
35
42
|
- Ollama support
|
|
36
43
|
- Azure OpenAI support
|
|
37
44
|
- Custom model implementations
|
|
@@ -419,6 +426,11 @@ Each pathway can define the following properties (with defaults from basePathway
|
|
|
419
426
|
- `temperature`: Model temperature setting (0.0 to 1.0). Default: 0.9
|
|
420
427
|
- `json`: Require valid JSON response from model. Default: false
|
|
421
428
|
- `manageTokenLength`: Manage input token length for model. Default: true
|
|
429
|
+
|
|
430
|
+
#### Dynamic model override
|
|
431
|
+
|
|
432
|
+
- `model`: In many cases, specifying the model as an input parameter will tell the pathway which model to use when setting up the pathway for execution.
|
|
433
|
+
- `modelOverride`: In some cases, you need even more dynamic model selection. At runtime, a pathway can optionally specify `modelOverride` in request args to switch the model used for execution without restarting the server. Cortex will attempt a hot swap and continue execution; errors are logged gracefully if the model is invalid.
|
|
422
434
|
|
|
423
435
|
## Core (Default) Pathways
|
|
424
436
|
|
|
@@ -528,6 +540,7 @@ Models are configured in the `models` section of the config. Each model can have
|
|
|
528
540
|
- `GEMINI-1.5-CHAT`: For Gemini 1.5 Pro chat models
|
|
529
541
|
- `GEMINI-1.5-VISION`: For Gemini vision models (including 2.0 Flash experimental)
|
|
530
542
|
- `CLAUDE-3-VERTEX`: For Claude-3 and 3.5 models (Haiku, Opus, Sonnet)
|
|
543
|
+
- `GROK-VISION`: For XAI Grok models (Grok-3, Grok-4, fast-reasoning, code-fast) with multimodal/vision and reasoning
|
|
531
544
|
- `AZURE-TRANSLATE`: For Azure translation services
|
|
532
545
|
|
|
533
546
|
Each model configuration can include:
|
|
@@ -606,6 +619,18 @@ To enable Ollama support, add the following to your configuration:
|
|
|
606
619
|
}
|
|
607
620
|
```
|
|
608
621
|
|
|
622
|
+
#### Tool Calling and Structured Responses
|
|
623
|
+
|
|
624
|
+
When using the OpenAI-compatible REST endpoints, Cortex supports vendor-agnostic tool calling with OpenAI-style `tool_calls` deltas in streaming mode. Pathway responses now include a structured `resultData` field (also exposed via GraphQL) that may contain:
|
|
625
|
+
|
|
626
|
+
- `toolCalls` and/or `functionCall` objects
|
|
627
|
+
- vendor-specific metadata (e.g., search citations)
|
|
628
|
+
- usage details
|
|
629
|
+
|
|
630
|
+
Notes:
|
|
631
|
+
- `tool_choice` accepts either a string (e.g., `"auto"`, `"required"`) or an object (`{ type: 'function', function: 'name' }`); Cortex normalizes this across vendors (OpenAI, Claude via Vertex, Gemini, Grok).
|
|
632
|
+
- Arrays for `[String]` inputs are passed directly through REST conversion.
|
|
633
|
+
|
|
609
634
|
You can then use any Ollama model through the standard OpenAI-compatible endpoints:
|
|
610
635
|
|
|
611
636
|
```bash
|
|
@@ -846,8 +871,7 @@ Cortex includes a powerful Entity System that allows you to build autonomous age
|
|
|
846
871
|
### Overview
|
|
847
872
|
|
|
848
873
|
The Entity System is built around two core pathways:
|
|
849
|
-
- `
|
|
850
|
-
- `sys_entity_continue.js`: Manages callback execution in synchronous mode
|
|
874
|
+
- `sys_entity_agent.js`: The entry point for entity interactions, handling initial routing and tool selection
|
|
851
875
|
|
|
852
876
|
### Key Features
|
|
853
877
|
|
|
@@ -159,6 +159,21 @@
|
|
|
159
159
|
],
|
|
160
160
|
"requestsPerSecond": 10,
|
|
161
161
|
"maxTokenLength": 1024
|
|
162
|
+
},
|
|
163
|
+
"xai-grok-3": {
|
|
164
|
+
"type": "GROK-VISION",
|
|
165
|
+
"url": "https://api.x.ai/v1/chat/completions",
|
|
166
|
+
"headers": {
|
|
167
|
+
"Authorization": "Bearer {{XAI_API_KEY}}",
|
|
168
|
+
"Content-Type": "application/json"
|
|
169
|
+
},
|
|
170
|
+
"params": {
|
|
171
|
+
"model": "grok-3-latest"
|
|
172
|
+
},
|
|
173
|
+
"requestsPerSecond": 10,
|
|
174
|
+
"maxTokenLength": 131072,
|
|
175
|
+
"maxReturnTokens": 4096,
|
|
176
|
+
"supportsStreaming": true
|
|
162
177
|
}
|
|
163
178
|
},
|
|
164
179
|
"enableCache": false,
|
package/config.js
CHANGED
|
@@ -59,7 +59,7 @@ var config = convict({
|
|
|
59
59
|
},
|
|
60
60
|
defaultModelName: {
|
|
61
61
|
format: String,
|
|
62
|
-
default:
|
|
62
|
+
default: 'oai-gpt4o',
|
|
63
63
|
env: 'DEFAULT_MODEL_NAME'
|
|
64
64
|
},
|
|
65
65
|
defaultEntityName: {
|
|
@@ -94,12 +94,12 @@ var config = convict({
|
|
|
94
94
|
},
|
|
95
95
|
claudeVertexUrl: {
|
|
96
96
|
format: String,
|
|
97
|
-
default: 'https://region.googleapis.com/v1/projects/projectid/locations/location/publishers/anthropic/models/claude-
|
|
97
|
+
default: 'https://region.googleapis.com/v1/projects/projectid/locations/location/publishers/anthropic/models/claude-4-sonnet@20250722',
|
|
98
98
|
env: 'CLAUDE_VERTEX_URL'
|
|
99
99
|
},
|
|
100
100
|
geminiFlashUrl: {
|
|
101
101
|
format: String,
|
|
102
|
-
default: 'https://region.googleapis.com/v1/projects/projectid/locations/location/publishers/google/models/gemini-2.
|
|
102
|
+
default: 'https://region.googleapis.com/v1/projects/projectid/locations/location/publishers/google/models/gemini-2.5-flash',
|
|
103
103
|
env: 'GEMINI_FLASH_URL'
|
|
104
104
|
},
|
|
105
105
|
entityConfig: {
|
|
@@ -295,6 +295,21 @@ var config = convict({
|
|
|
295
295
|
"maxReturnTokens": 100000,
|
|
296
296
|
"supportsStreaming": false
|
|
297
297
|
},
|
|
298
|
+
"oai-o3": {
|
|
299
|
+
"type": "OPENAI-REASONING",
|
|
300
|
+
"url": "https://api.openai.com/v1/chat/completions",
|
|
301
|
+
"headers": {
|
|
302
|
+
"Authorization": "Bearer {{OPENAI_API_KEY}}",
|
|
303
|
+
"Content-Type": "application/json"
|
|
304
|
+
},
|
|
305
|
+
"params": {
|
|
306
|
+
"model": "o3"
|
|
307
|
+
},
|
|
308
|
+
"requestsPerSecond": 10,
|
|
309
|
+
"maxTokenLength": 200000,
|
|
310
|
+
"maxReturnTokens": 100000,
|
|
311
|
+
"supportsStreaming": true
|
|
312
|
+
},
|
|
298
313
|
"oai-o3-mini": {
|
|
299
314
|
"type": "OPENAI-REASONING",
|
|
300
315
|
"url": "https://api.openai.com/v1/chat/completions",
|
|
@@ -308,7 +323,7 @@ var config = convict({
|
|
|
308
323
|
"requestsPerSecond": 10,
|
|
309
324
|
"maxTokenLength": 200000,
|
|
310
325
|
"maxReturnTokens": 100000,
|
|
311
|
-
"supportsStreaming":
|
|
326
|
+
"supportsStreaming": true
|
|
312
327
|
},
|
|
313
328
|
"azure-bing": {
|
|
314
329
|
"type": "AZURE-BING",
|
|
@@ -320,6 +335,15 @@ var config = convict({
|
|
|
320
335
|
"requestsPerSecond": 10,
|
|
321
336
|
"maxTokenLength": 200000
|
|
322
337
|
},
|
|
338
|
+
"google-cse": {
|
|
339
|
+
"type": "GOOGLE-CSE",
|
|
340
|
+
"url": "https://www.googleapis.com/customsearch/v1",
|
|
341
|
+
"headers": {
|
|
342
|
+
"Content-Type": "application/json"
|
|
343
|
+
},
|
|
344
|
+
"requestsPerSecond": 10,
|
|
345
|
+
"maxTokenLength": 200000
|
|
346
|
+
},
|
|
323
347
|
"runware-flux-schnell": {
|
|
324
348
|
"type": "RUNWARE-AI",
|
|
325
349
|
"url": "https://api.runware.ai/v1",
|
|
@@ -449,7 +473,7 @@ var config = convict({
|
|
|
449
473
|
"maxReturnTokens": 4096,
|
|
450
474
|
"supportsStreaming": true
|
|
451
475
|
},
|
|
452
|
-
"claude-
|
|
476
|
+
"claude-37-sonnet-vertex": {
|
|
453
477
|
"type": "CLAUDE-3-VERTEX",
|
|
454
478
|
"url": "{{claudeVertexUrl}}",
|
|
455
479
|
"headers": {
|
|
@@ -461,15 +485,102 @@ var config = convict({
|
|
|
461
485
|
"maxImageSize": 5242880,
|
|
462
486
|
"supportsStreaming": true
|
|
463
487
|
},
|
|
464
|
-
"
|
|
465
|
-
"type": "
|
|
466
|
-
"url": "{{
|
|
488
|
+
"claude-4-sonnet-vertex": {
|
|
489
|
+
"type": "CLAUDE-3-VERTEX",
|
|
490
|
+
"url": "{{claudeVertexUrl}}",
|
|
467
491
|
"headers": {
|
|
468
492
|
"Content-Type": "application/json"
|
|
469
493
|
},
|
|
470
494
|
"requestsPerSecond": 10,
|
|
471
495
|
"maxTokenLength": 200000,
|
|
472
496
|
"maxReturnTokens": 4096,
|
|
497
|
+
"maxImageSize": 5242880,
|
|
498
|
+
"supportsStreaming": true
|
|
499
|
+
},
|
|
500
|
+
"gemini-flash-25-vision": {
|
|
501
|
+
"type": "GEMINI-1.5-VISION",
|
|
502
|
+
"url": "{{geminiFlashUrl}}",
|
|
503
|
+
"headers": {
|
|
504
|
+
"Content-Type": "application/json"
|
|
505
|
+
},
|
|
506
|
+
"requestsPerSecond": 10,
|
|
507
|
+
"maxTokenLength": 1048576,
|
|
508
|
+
"maxReturnTokens": 65535,
|
|
509
|
+
"supportsStreaming": true
|
|
510
|
+
},
|
|
511
|
+
"xai-grok-3": {
|
|
512
|
+
"type": "GROK-VISION",
|
|
513
|
+
"url": "https://api.x.ai/v1/chat/completions",
|
|
514
|
+
"headers": {
|
|
515
|
+
"Authorization": "Bearer {{XAI_API_KEY}}",
|
|
516
|
+
"Content-Type": "application/json"
|
|
517
|
+
},
|
|
518
|
+
"params": {
|
|
519
|
+
"model": "grok-3-latest"
|
|
520
|
+
},
|
|
521
|
+
"requestsPerSecond": 10,
|
|
522
|
+
"maxTokenLength": 131072,
|
|
523
|
+
"maxReturnTokens": 32000,
|
|
524
|
+
"supportsStreaming": true
|
|
525
|
+
},
|
|
526
|
+
"xai-grok-4": {
|
|
527
|
+
"type": "GROK-VISION",
|
|
528
|
+
"url": "https://api.x.ai/v1/chat/completions",
|
|
529
|
+
"headers": {
|
|
530
|
+
"Authorization": "Bearer {{XAI_API_KEY}}",
|
|
531
|
+
"Content-Type": "application/json"
|
|
532
|
+
},
|
|
533
|
+
"params": {
|
|
534
|
+
"model": "grok-4-0709"
|
|
535
|
+
},
|
|
536
|
+
"requestsPerSecond": 10,
|
|
537
|
+
"maxTokenLength": 256000,
|
|
538
|
+
"maxReturnTokens": 128000,
|
|
539
|
+
"supportsStreaming": true
|
|
540
|
+
},
|
|
541
|
+
"xai-grok-code-fast-1": {
|
|
542
|
+
"type": "GROK-VISION",
|
|
543
|
+
"url": "https://api.x.ai/v1/chat/completions",
|
|
544
|
+
"headers": {
|
|
545
|
+
"Authorization": "Bearer {{XAI_API_KEY}}",
|
|
546
|
+
"Content-Type": "application/json"
|
|
547
|
+
},
|
|
548
|
+
"params": {
|
|
549
|
+
"model": "grok-code-fast-1"
|
|
550
|
+
},
|
|
551
|
+
"requestsPerSecond": 10,
|
|
552
|
+
"maxTokenLength": 2000000,
|
|
553
|
+
"maxReturnTokens": 128000,
|
|
554
|
+
"supportsStreaming": true
|
|
555
|
+
},
|
|
556
|
+
"xai-grok-4-fast-reasoning": {
|
|
557
|
+
"type": "GROK-VISION",
|
|
558
|
+
"url": "https://api.x.ai/v1/chat/completions",
|
|
559
|
+
"headers": {
|
|
560
|
+
"Authorization": "Bearer {{XAI_API_KEY}}",
|
|
561
|
+
"Content-Type": "application/json"
|
|
562
|
+
},
|
|
563
|
+
"params": {
|
|
564
|
+
"model": "grok-4-fast-reasoning"
|
|
565
|
+
},
|
|
566
|
+
"requestsPerSecond": 10,
|
|
567
|
+
"maxTokenLength": 2000000,
|
|
568
|
+
"maxReturnTokens": 128000,
|
|
569
|
+
"supportsStreaming": true
|
|
570
|
+
},
|
|
571
|
+
"xai-grok-4-fast-non-reasoning": {
|
|
572
|
+
"type": "GROK-VISION",
|
|
573
|
+
"url": "https://api.x.ai/v1/chat/completions",
|
|
574
|
+
"headers": {
|
|
575
|
+
"Authorization": "Bearer {{XAI_API_KEY}}",
|
|
576
|
+
"Content-Type": "application/json"
|
|
577
|
+
},
|
|
578
|
+
"params": {
|
|
579
|
+
"model": "grok-4-fast-non-reasoning"
|
|
580
|
+
},
|
|
581
|
+
"requestsPerSecond": 10,
|
|
582
|
+
"maxTokenLength": 256000,
|
|
583
|
+
"maxReturnTokens": 128000,
|
|
473
584
|
"supportsStreaming": true
|
|
474
585
|
},
|
|
475
586
|
"apptek-translate": {
|
|
@@ -483,6 +594,21 @@ var config = convict({
|
|
|
483
594
|
"requestsPerSecond": 10,
|
|
484
595
|
"maxTokenLength": 128000
|
|
485
596
|
},
|
|
597
|
+
"azure-bing-agent": {
|
|
598
|
+
"type": "AZURE-FOUNDRY-AGENTS",
|
|
599
|
+
"url": "{{azureFoundryAgentUrl}}",
|
|
600
|
+
"headers": {
|
|
601
|
+
"Content-Type": "application/json"
|
|
602
|
+
},
|
|
603
|
+
"params": {
|
|
604
|
+
"api-version": "2025-05-01",
|
|
605
|
+
"assistant_id": "{{azureFoundryAgentId}}"
|
|
606
|
+
},
|
|
607
|
+
"requestsPerSecond": 10,
|
|
608
|
+
"maxTokenLength": 32768,
|
|
609
|
+
"maxReturnTokens": 4096,
|
|
610
|
+
"supportsStreaming": false
|
|
611
|
+
}
|
|
486
612
|
},
|
|
487
613
|
env: 'CORTEX_MODELS'
|
|
488
614
|
},
|
|
@@ -592,6 +718,21 @@ var config = convict({
|
|
|
592
718
|
format: String,
|
|
593
719
|
default: null,
|
|
594
720
|
env: 'APPTEK_API_ENDPOINT'
|
|
721
|
+
},
|
|
722
|
+
azureFoundryAgentUrl: {
|
|
723
|
+
format: String,
|
|
724
|
+
default: null,
|
|
725
|
+
env: 'AZURE_FOUNDRY_AGENT_URL'
|
|
726
|
+
},
|
|
727
|
+
azureFoundryAgentId: {
|
|
728
|
+
format: String,
|
|
729
|
+
default: null,
|
|
730
|
+
env: 'AZURE_FOUNDRY_AGENT_ID'
|
|
731
|
+
},
|
|
732
|
+
azureFoundryBingSearchConnectionId: {
|
|
733
|
+
format: String,
|
|
734
|
+
default: null,
|
|
735
|
+
env: 'AZURE_FOUNDRY_BING_SEARCH_CONNECTION_ID'
|
|
595
736
|
}
|
|
596
737
|
});
|
|
597
738
|
|
|
@@ -716,10 +857,15 @@ const buildPathways = async (config) => {
|
|
|
716
857
|
Object.assign(pathways, subPathways);
|
|
717
858
|
} else if (file.name.endsWith('.js')) {
|
|
718
859
|
// Load individual pathway file
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
860
|
+
try {
|
|
861
|
+
const pathwayURL = pathToFileURL(fullPath).toString();
|
|
862
|
+
const pathway = await import(pathwayURL).then(module => module.default || module);
|
|
863
|
+
const pathwayName = path.basename(file.name, '.js');
|
|
864
|
+
pathways[pathwayName] = pathway;
|
|
865
|
+
} catch (pathwayError) {
|
|
866
|
+
logger.error(`Error loading pathway file ${fullPath}: ${pathwayError.message}`);
|
|
867
|
+
throw pathwayError; // Re-throw to be caught by outer catch block
|
|
868
|
+
}
|
|
723
869
|
}
|
|
724
870
|
}
|
|
725
871
|
} catch (error) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
|
|
3
|
+
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
|
4
|
+
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
|
|
5
|
+
QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
|
|
6
|
+
MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
|
|
7
|
+
b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
|
|
8
|
+
9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
|
|
9
|
+
CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
|
|
10
|
+
nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
|
|
11
|
+
43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
|
|
12
|
+
T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
|
|
13
|
+
gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
|
|
14
|
+
BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
|
|
15
|
+
TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
|
|
16
|
+
DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
|
|
17
|
+
hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
|
|
18
|
+
06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
|
|
19
|
+
PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
|
|
20
|
+
YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
|
|
21
|
+
CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
|
|
22
|
+
-----END CERTIFICATE-----
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Use the official Azure Functions Python base image
|
|
2
|
+
FROM mcr.microsoft.com/azure-functions/python:4-python3.11
|
|
3
|
+
|
|
4
|
+
# Set the working directory
|
|
5
|
+
WORKDIR /home/site/wwwroot
|
|
6
|
+
|
|
7
|
+
# Install system dependencies
|
|
8
|
+
RUN apt-get update && apt-get install -y \
|
|
9
|
+
build-essential \
|
|
10
|
+
curl \
|
|
11
|
+
git \
|
|
12
|
+
libgirepository1.0-dev \
|
|
13
|
+
pkg-config \
|
|
14
|
+
libfreetype6-dev \
|
|
15
|
+
libpng-dev \
|
|
16
|
+
fontconfig \
|
|
17
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
18
|
+
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg \
|
|
19
|
+
&& mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg \
|
|
20
|
+
&& sh -c 'echo "deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/azure-cli.list' \
|
|
21
|
+
&& apt-get update \
|
|
22
|
+
&& apt-get install -y azure-functions-core-tools
|
|
23
|
+
|
|
24
|
+
# Copy requirements and install Python dependencies
|
|
25
|
+
COPY requirements.txt .
|
|
26
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
27
|
+
|
|
28
|
+
# Copy application code
|
|
29
|
+
COPY . .
|
|
30
|
+
CMD ["func", "start", "--port", "80", "--verbose"]
|
|
31
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Use an official Python runtime as a parent image
|
|
2
|
+
FROM python:3.11-slim
|
|
3
|
+
|
|
4
|
+
# Set the working directory in the container
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
# Install system dependencies that might be needed
|
|
8
|
+
RUN apt-get update && apt-get install -y \
|
|
9
|
+
gcc \
|
|
10
|
+
curl \
|
|
11
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
12
|
+
|
|
13
|
+
# Install poetry
|
|
14
|
+
RUN pip install poetry
|
|
15
|
+
|
|
16
|
+
# Configure poetry: Don't create virtual env (we're already in container)
|
|
17
|
+
RUN poetry config virtualenvs.create false
|
|
18
|
+
|
|
19
|
+
# Copy project descriptor files first (for better Docker layer caching)
|
|
20
|
+
COPY pyproject.toml poetry.lock* ./
|
|
21
|
+
|
|
22
|
+
# Create the coding directory inside the container
|
|
23
|
+
RUN mkdir -p /app/coding
|
|
24
|
+
|
|
25
|
+
# Create a minimal README.md if it's needed for build context
|
|
26
|
+
RUN touch README.md
|
|
27
|
+
|
|
28
|
+
# Copy the application's code before installing dependencies
|
|
29
|
+
COPY . /app/src/cortex_autogen2
|
|
30
|
+
|
|
31
|
+
# Install dependencies (including the current project)
|
|
32
|
+
RUN poetry install --without dev --no-ansi --no-interaction
|
|
33
|
+
|
|
34
|
+
# Install Playwright browser binaries
|
|
35
|
+
RUN playwright install
|
|
36
|
+
|
|
37
|
+
# Ensure Python can import our source package
|
|
38
|
+
ENV PYTHONPATH="/app/src:/app/src/cortex_autogen2"
|
|
39
|
+
|
|
40
|
+
# The command to run the application
|
|
41
|
+
CMD ["python", "-m", "cortex_autogen2.main"]
|