graphile-llm 0.2.0 → 0.2.2

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/chat.d.ts CHANGED
@@ -26,10 +26,10 @@ export declare function buildChatCompleter(config: ChatConfig): ChatFunction | n
26
26
  */
27
27
  export declare function buildChatCompleterFromModule(data: LlmModuleData): ChatFunction | null;
28
28
  /**
29
- * Resolve a chat completer from environment variables.
29
+ * Resolve a chat completer from environment variables via getEnvOptions().
30
30
  * This is a fallback for development when no llm_module or defaultChatCompleter is configured.
31
31
  *
32
- * Environment variables:
32
+ * Environment variables (parsed by @constructive-io/graphql-env):
33
33
  * CHAT_PROVIDER - Provider name ('ollama')
34
34
  * CHAT_MODEL - Model identifier (e.g. 'llama3')
35
35
  * CHAT_BASE_URL - Provider base URL
package/chat.js CHANGED
@@ -20,6 +20,7 @@ exports.buildChatCompleter = buildChatCompleter;
20
20
  exports.buildChatCompleterFromModule = buildChatCompleterFromModule;
21
21
  exports.buildChatCompleterFromEnv = buildChatCompleterFromEnv;
22
22
  const ollama_1 = __importDefault(require("@agentic-kit/ollama"));
23
+ const graphql_env_1 = require("@constructive-io/graphql-env");
23
24
  // ─── Built-in Providers ─────────────────────────────────────────────────────
24
25
  /**
25
26
  * Create an Ollama-based chat completion function.
@@ -85,21 +86,22 @@ function buildChatCompleterFromModule(data) {
85
86
  });
86
87
  }
87
88
  /**
88
- * Resolve a chat completer from environment variables.
89
+ * Resolve a chat completer from environment variables via getEnvOptions().
89
90
  * This is a fallback for development when no llm_module or defaultChatCompleter is configured.
90
91
  *
91
- * Environment variables:
92
+ * Environment variables (parsed by @constructive-io/graphql-env):
92
93
  * CHAT_PROVIDER - Provider name ('ollama')
93
94
  * CHAT_MODEL - Model identifier (e.g. 'llama3')
94
95
  * CHAT_BASE_URL - Provider base URL
95
96
  */
96
97
  function buildChatCompleterFromEnv() {
97
- const provider = process.env.CHAT_PROVIDER;
98
+ const { llm } = (0, graphql_env_1.getEnvOptions)();
99
+ const provider = llm?.chat?.provider;
98
100
  if (!provider)
99
101
  return null;
100
102
  return buildChatCompleter({
101
103
  provider,
102
- model: process.env.CHAT_MODEL,
103
- baseUrl: process.env.CHAT_BASE_URL,
104
+ model: llm?.chat?.model,
105
+ baseUrl: llm?.chat?.baseUrl,
104
106
  });
105
107
  }
package/embedder.d.ts CHANGED
@@ -24,10 +24,10 @@ export declare function buildEmbedder(config: EmbedderConfig): EmbedderFunction
24
24
  */
25
25
  export declare function buildEmbedderFromModule(data: LlmModuleData): EmbedderFunction | null;
26
26
  /**
27
- * Resolve an embedder from environment variables.
27
+ * Resolve an embedder from environment variables via getEnvOptions().
28
28
  * This is a fallback for development when no llm_module or defaultEmbedder is configured.
29
29
  *
30
- * Environment variables:
30
+ * Environment variables (parsed by @constructive-io/graphql-env):
31
31
  * EMBEDDER_PROVIDER - Provider name ('ollama')
32
32
  * EMBEDDER_MODEL - Model identifier
33
33
  * EMBEDDER_BASE_URL - Provider base URL
package/embedder.js CHANGED
@@ -18,6 +18,7 @@ exports.buildEmbedder = buildEmbedder;
18
18
  exports.buildEmbedderFromModule = buildEmbedderFromModule;
19
19
  exports.buildEmbedderFromEnv = buildEmbedderFromEnv;
20
20
  const ollama_1 = __importDefault(require("@agentic-kit/ollama"));
21
+ const graphql_env_1 = require("@constructive-io/graphql-env");
21
22
  // ─── Built-in Providers ─────────────────────────────────────────────────────
22
23
  /**
23
24
  * Create an Ollama-based embedder function.
@@ -59,21 +60,22 @@ function buildEmbedderFromModule(data) {
59
60
  });
60
61
  }
61
62
  /**
62
- * Resolve an embedder from environment variables.
63
+ * Resolve an embedder from environment variables via getEnvOptions().
63
64
  * This is a fallback for development when no llm_module or defaultEmbedder is configured.
64
65
  *
65
- * Environment variables:
66
+ * Environment variables (parsed by @constructive-io/graphql-env):
66
67
  * EMBEDDER_PROVIDER - Provider name ('ollama')
67
68
  * EMBEDDER_MODEL - Model identifier
68
69
  * EMBEDDER_BASE_URL - Provider base URL
69
70
  */
70
71
  function buildEmbedderFromEnv() {
71
- const provider = process.env.EMBEDDER_PROVIDER;
72
+ const { llm } = (0, graphql_env_1.getEnvOptions)();
73
+ const provider = llm?.embedder?.provider;
72
74
  if (!provider)
73
75
  return null;
74
76
  return buildEmbedder({
75
77
  provider,
76
- model: process.env.EMBEDDER_MODEL,
77
- baseUrl: process.env.EMBEDDER_BASE_URL,
78
+ model: llm?.embedder?.model,
79
+ baseUrl: llm?.embedder?.baseUrl,
78
80
  });
79
81
  }
package/esm/chat.d.ts CHANGED
@@ -26,10 +26,10 @@ export declare function buildChatCompleter(config: ChatConfig): ChatFunction | n
26
26
  */
27
27
  export declare function buildChatCompleterFromModule(data: LlmModuleData): ChatFunction | null;
28
28
  /**
29
- * Resolve a chat completer from environment variables.
29
+ * Resolve a chat completer from environment variables via getEnvOptions().
30
30
  * This is a fallback for development when no llm_module or defaultChatCompleter is configured.
31
31
  *
32
- * Environment variables:
32
+ * Environment variables (parsed by @constructive-io/graphql-env):
33
33
  * CHAT_PROVIDER - Provider name ('ollama')
34
34
  * CHAT_MODEL - Model identifier (e.g. 'llama3')
35
35
  * CHAT_BASE_URL - Provider base URL
package/esm/chat.js CHANGED
@@ -12,6 +12,7 @@
12
12
  * 3. Environment variables (CHAT_PROVIDER, CHAT_MODEL, CHAT_BASE_URL)
13
13
  */
14
14
  import OllamaClient from '@agentic-kit/ollama';
15
+ import { getEnvOptions } from '@constructive-io/graphql-env';
15
16
  // ─── Built-in Providers ─────────────────────────────────────────────────────
16
17
  /**
17
18
  * Create an Ollama-based chat completion function.
@@ -77,21 +78,22 @@ export function buildChatCompleterFromModule(data) {
77
78
  });
78
79
  }
79
80
  /**
80
- * Resolve a chat completer from environment variables.
81
+ * Resolve a chat completer from environment variables via getEnvOptions().
81
82
  * This is a fallback for development when no llm_module or defaultChatCompleter is configured.
82
83
  *
83
- * Environment variables:
84
+ * Environment variables (parsed by @constructive-io/graphql-env):
84
85
  * CHAT_PROVIDER - Provider name ('ollama')
85
86
  * CHAT_MODEL - Model identifier (e.g. 'llama3')
86
87
  * CHAT_BASE_URL - Provider base URL
87
88
  */
88
89
  export function buildChatCompleterFromEnv() {
89
- const provider = process.env.CHAT_PROVIDER;
90
+ const { llm } = getEnvOptions();
91
+ const provider = llm?.chat?.provider;
90
92
  if (!provider)
91
93
  return null;
92
94
  return buildChatCompleter({
93
95
  provider,
94
- model: process.env.CHAT_MODEL,
95
- baseUrl: process.env.CHAT_BASE_URL,
96
+ model: llm?.chat?.model,
97
+ baseUrl: llm?.chat?.baseUrl,
96
98
  });
97
99
  }
package/esm/embedder.d.ts CHANGED
@@ -24,10 +24,10 @@ export declare function buildEmbedder(config: EmbedderConfig): EmbedderFunction
24
24
  */
25
25
  export declare function buildEmbedderFromModule(data: LlmModuleData): EmbedderFunction | null;
26
26
  /**
27
- * Resolve an embedder from environment variables.
27
+ * Resolve an embedder from environment variables via getEnvOptions().
28
28
  * This is a fallback for development when no llm_module or defaultEmbedder is configured.
29
29
  *
30
- * Environment variables:
30
+ * Environment variables (parsed by @constructive-io/graphql-env):
31
31
  * EMBEDDER_PROVIDER - Provider name ('ollama')
32
32
  * EMBEDDER_MODEL - Model identifier
33
33
  * EMBEDDER_BASE_URL - Provider base URL
package/esm/embedder.js CHANGED
@@ -10,6 +10,7 @@
10
10
  * 3. Environment variables (EMBEDDER_PROVIDER, EMBEDDER_MODEL, EMBEDDER_BASE_URL)
11
11
  */
12
12
  import OllamaClient from '@agentic-kit/ollama';
13
+ import { getEnvOptions } from '@constructive-io/graphql-env';
13
14
  // ─── Built-in Providers ─────────────────────────────────────────────────────
14
15
  /**
15
16
  * Create an Ollama-based embedder function.
@@ -51,21 +52,22 @@ export function buildEmbedderFromModule(data) {
51
52
  });
52
53
  }
53
54
  /**
54
- * Resolve an embedder from environment variables.
55
+ * Resolve an embedder from environment variables via getEnvOptions().
55
56
  * This is a fallback for development when no llm_module or defaultEmbedder is configured.
56
57
  *
57
- * Environment variables:
58
+ * Environment variables (parsed by @constructive-io/graphql-env):
58
59
  * EMBEDDER_PROVIDER - Provider name ('ollama')
59
60
  * EMBEDDER_MODEL - Model identifier
60
61
  * EMBEDDER_BASE_URL - Provider base URL
61
62
  */
62
63
  export function buildEmbedderFromEnv() {
63
- const provider = process.env.EMBEDDER_PROVIDER;
64
+ const { llm } = getEnvOptions();
65
+ const provider = llm?.embedder?.provider;
64
66
  if (!provider)
65
67
  return null;
66
68
  return buildEmbedder({
67
69
  provider,
68
- model: process.env.EMBEDDER_MODEL,
69
- baseUrl: process.env.EMBEDDER_BASE_URL,
70
+ model: llm?.embedder?.model,
71
+ baseUrl: llm?.embedder?.baseUrl,
70
72
  });
71
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-llm",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "LLM integration plugin for PostGraphile v5 — server-side text-to-vector embedding and text companion fields for pgvector columns",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "homepage": "https://github.com/constructive-io/constructive",
@@ -29,7 +29,8 @@
29
29
  "url": "https://github.com/constructive-io/constructive/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@agentic-kit/ollama": "^1.0.3"
32
+ "@agentic-kit/ollama": "^1.0.3",
33
+ "@constructive-io/graphql-env": "^3.6.1"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "@dataplan/pg": "1.0.0",
@@ -53,11 +54,11 @@
53
54
  },
54
55
  "devDependencies": {
55
56
  "@types/node": "^22.19.11",
56
- "graphile-connection-filter": "^1.5.1",
57
- "graphile-search": "^1.7.1",
58
- "graphile-test": "^4.9.0",
57
+ "graphile-connection-filter": "^1.5.3",
58
+ "graphile-search": "^1.7.3",
59
+ "graphile-test": "^4.9.2",
59
60
  "makage": "^0.3.0",
60
- "pgsql-test": "^4.9.0"
61
+ "pgsql-test": "^4.9.2"
61
62
  },
62
63
  "keywords": [
63
64
  "postgraphile",
@@ -72,5 +73,5 @@
72
73
  "ollama",
73
74
  "openai"
74
75
  ],
75
- "gitHead": "e52a76e08338b00aa866f7cea3abb7414a3ac34c"
76
+ "gitHead": "4988b64539a61786647412a456c56cb486722e18"
76
77
  }