@aj-archipelago/cortex 1.1.14 → 1.1.15

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.
@@ -1,8 +1,9 @@
1
1
  import { selectEndpoint } from './requestExecutor.js';
2
2
 
3
3
  class CortexRequest {
4
- constructor( { url, data, params, headers, cache, model, pathwayResolver, selectedEndpoint, stream } = {}) {
4
+ constructor( { url, urlSuffix, data, params, headers, cache, model, pathwayResolver, selectedEndpoint, stream } = {}) {
5
5
  this._url = url || '';
6
+ this._urlSuffix = urlSuffix || '';
6
7
  this._data = data || {};
7
8
  this._params = params || {};
8
9
  this._headers = headers || {};
@@ -35,13 +36,22 @@ class CortexRequest {
35
36
 
36
37
  // url getter and setter
37
38
  get url() {
38
- return this._url;
39
+ return this._url + this._urlSuffix;
39
40
  }
40
41
 
41
42
  set url(value) {
42
43
  this._url = value;
43
44
  }
44
45
 
46
+ // urlSuffix getter and setter
47
+ get urlSuffix() {
48
+ return this._urlSuffix;
49
+ }
50
+
51
+ set urlSuffix(value) {
52
+ this._urlSuffix = value;
53
+ }
54
+
45
55
  // method getter and setter
46
56
  get method() {
47
57
  return this._method;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aj-archipelago/cortex",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
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": {
@@ -79,7 +79,7 @@ class Claude3VertexPlugin extends OpenAIVisionPlugin {
79
79
  cortexRequest.data = { ...(cortexRequest.data || {}), ...requestParameters };
80
80
  cortexRequest.params = {}; // query params
81
81
  cortexRequest.stream = stream;
82
- cortexRequest.url = cortexRequest.stream ? `${cortexRequest.url}:streamRawPredict` : `${cortexRequest.url}:rawPredict`;
82
+ cortexRequest.urlSuffix = cortexRequest.stream ? ':streamRawPredict' : ':rawPredict';
83
83
 
84
84
  const gcpAuthTokenHelper = this.config.get('gcpAuthTokenHelper');
85
85
  const authToken = await gcpAuthTokenHelper.getAccessToken();
@@ -335,7 +335,7 @@ try {
335
335
 
336
336
  totalCount = mediaChunks.length + 1; // total number of chunks that will be processed
337
337
 
338
- const batchSize = 2;
338
+ const batchSize = 4;
339
339
  sendProgress();
340
340
 
341
341
  for (let i = 0; i < uris.length; i += batchSize) {