@aj-archipelago/cortex 1.2.0 → 1.2.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/config.js CHANGED
@@ -244,6 +244,15 @@ var config = convict({
244
244
  "Content-Type": "application/json"
245
245
  },
246
246
  },
247
+ "replicate-recraft-v3": {
248
+ "type": "REPLICATE-API",
249
+ "url": "https://api.replicate.com/v1/models/recraft-ai/recraft-v3/predictions",
250
+ "headers": {
251
+ "Prefer": "wait",
252
+ "Authorization": "Token {{REPLICATE_API_KEY}}",
253
+ "Content-Type": "application/json"
254
+ },
255
+ },
247
256
  "azure-video-translate": {
248
257
  "type": "AZURE-VIDEO-TRANSLATE",
249
258
  "headers": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aj-archipelago/cortex",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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": {
@@ -5,9 +5,13 @@ export default {
5
5
  inputParameters: {
6
6
  model: "runware-flux-schnell",
7
7
  negativePrompt: "",
8
- width: 512,
9
- height: 512,
8
+ width: 1024,
9
+ height: 1024,
10
+ aspectRatio: "custom",
10
11
  numberResults: 1,
12
+ safety_tolerance: 5,
13
+ output_format: "webp",
14
+ output_quality: 80,
11
15
  steps: 4,
12
16
  },
13
17
  };
@@ -0,0 +1,10 @@
1
+ export default {
2
+ prompt: ["{{text}}"],
3
+
4
+ enableDuplicateRequests: false,
5
+ inputParameters: {
6
+ model: "replicate-recraft-v3",
7
+ size: "1024x1024",
8
+ style: "realistic_image",
9
+ },
10
+ };
package/pathways/index.js CHANGED
@@ -16,7 +16,6 @@ import edit from './edit.js';
16
16
  import embeddings from './embeddings.js';
17
17
  import entities from './entities.js';
18
18
  import expand_story from './expand_story.js';
19
- import flux_image from './flux_image.js';
20
19
  import format_paragraph_turbo from './format_paragraph_turbo.js';
21
20
  import gemini_15_vision from './gemini_15_vision.js';
22
21
  import gemini_vision from './gemini_vision.js';
@@ -26,6 +25,8 @@ import headline from './headline.js';
26
25
  import headline_custom from './headline_custom.js';
27
26
  import highlights from './highlights.js';
28
27
  import image from './image.js';
28
+ import image_flux from './image_flux.js';
29
+ import image_recraft from './image_recraft.js';
29
30
  import jira_story from './jira_story.js';
30
31
  import keywords from './keywords.js';
31
32
  import language from './language.js';
@@ -100,13 +101,14 @@ export {
100
101
  embeddings,
101
102
  entities,
102
103
  expand_story,
103
- flux_image,
104
104
  format_paragraph_turbo,
105
105
  gemini_15_vision,
106
106
  gemini_vision,
107
107
  grammar,
108
108
  hashtags, headline, headline_custom, highlights,
109
109
  image,
110
+ image_flux,
111
+ image_recraft,
110
112
  jira_story,
111
113
  keywords,
112
114
  language,
package/server/parser.js CHANGED
@@ -40,7 +40,12 @@ const isNumberedList = (data) => {
40
40
 
41
41
  async function parseJson(str) {
42
42
  try {
43
- JSON.parse(str); // Validate JSON
43
+ // check for the common error case that the JSON is surrounded by markdown
44
+ const match = str.match(/```\s*(?:json)?(.*?)```/s);
45
+ if (match) {
46
+ str = match[1].trim();
47
+ }
48
+ JSON.parse(str);
44
49
  return str;
45
50
  } catch (error) {
46
51
  try {
@@ -18,15 +18,19 @@ class ReplicateApiPlugin extends ModelPlugin {
18
18
 
19
19
  const requestParameters = {
20
20
  input: {
21
- aspect_ratio: "1:1",
22
- output_format: "webp",
23
- output_quality: 80,
21
+ aspect_ratio: combinedParameters.aspectRatio || "1:1",
22
+ output_format: combinedParameters.outputFormat || "webp",
23
+ output_quality: combinedParameters.outputQuality || 80,
24
24
  prompt: modelPromptText,
25
- //prompt_upsampling: false,
26
- //safety_tolerance: 5,
25
+ prompt_upsampling: combinedParameters.promptUpsampling || false,
26
+ safety_tolerance: combinedParameters.safety_tolerance || 3,
27
27
  go_fast: true,
28
28
  megapixels: "1",
29
29
  num_outputs: combinedParameters.numberResults,
30
+ width: combinedParameters.width,
31
+ height: combinedParameters.height,
32
+ size: combinedParameters.size || "1024x1024",
33
+ style: combinedParameters.style || "realistic_image",
30
34
  },
31
35
  };
32
36