@axemere/gateway-langchain 0.1.10 → 0.2.0

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
@@ -21,8 +21,11 @@ console.log(res.content);
21
21
 
22
22
  ## Supported providers
23
23
 
24
- `openai`, `anthropic`, `mistral`, `google`, `xai`, `deepseek`, `groq`, `together`, `fireworks`,
25
- `perplexity`, `openrouter`, `cohere`
24
+ Every provider in the MVGC gateway registry, re-exported as `PROVIDER_ROUTES` from
25
+ `@axemere/gateway`: `openai`, `anthropic`, `gemini` (alias `google`), `cohere`, `mistral`,
26
+ `groq`, `deepseek`, `together`, `minimax`, `moonshot`, `zhipu`, `xai`, `perplexity`,
27
+ `openrouter`, `nvidia-nim`, `upstage`, `fireworks`, `qwen`, `bytedance`, `stepfun`, `bedrock`,
28
+ `vertex`, `azure_openai`.
26
29
 
27
30
  ## Proxy-mode convenience re-exports
28
31
 
package/dist/index.js CHANGED
@@ -13,20 +13,6 @@ const gateway_openai_1 = require("@axemere/gateway-openai");
13
13
  Object.defineProperty(exports, "aiGatewayOpenAIClient", { enumerable: true, get: function () { return gateway_openai_1.openaiClient; } });
14
14
  const gateway_anthropic_1 = require("@axemere/gateway-anthropic");
15
15
  Object.defineProperty(exports, "aiGatewayAnthropicClient", { enumerable: true, get: function () { return gateway_anthropic_1.anthropicClient; } });
16
- const PROVIDER_ROUTES = {
17
- openai: { target_host: "api.openai.com", target_path: "/v1/chat/completions", format: "openai" },
18
- anthropic: { target_host: "api.anthropic.com", target_path: "/v1/messages", format: "anthropic" },
19
- mistral: { target_host: "api.mistral.ai", target_path: "/v1/chat/completions", format: "openai" },
20
- google: { target_host: "generativelanguage.googleapis.com", target_path: "/v1beta/models/{model}:generateContent", format: "gemini" },
21
- xai: { target_host: "api.x.ai", target_path: "/v1/chat/completions", format: "openai" },
22
- deepseek: { target_host: "api.deepseek.com", target_path: "/v1/chat/completions", format: "openai" },
23
- groq: { target_host: "api.groq.com", target_path: "/openai/v1/chat/completions", format: "openai" },
24
- together: { target_host: "api.together.ai", target_path: "/v1/chat/completions", format: "openai" },
25
- fireworks: { target_host: "api.fireworks.ai", target_path: "/inference/v1/chat/completions", format: "openai" },
26
- perplexity: { target_host: "api.perplexity.ai", target_path: "/chat/completions", format: "openai" },
27
- openrouter: { target_host: "openrouter.ai", target_path: "/api/v1/chat/completions", format: "openai" },
28
- cohere: { target_host: "api.cohere.com", target_path: "/v2/chat", format: "openai" },
29
- };
30
16
  function messageToString(content) {
31
17
  if (typeof content === "string")
32
18
  return content;
@@ -231,8 +217,8 @@ function extractStreamText(format, chunk) {
231
217
  class ChatAiGateway extends chat_models_1.BaseChatModel {
232
218
  constructor(fields) {
233
219
  super(fields);
234
- if (!PROVIDER_ROUTES[fields.provider]) {
235
- throw new gateway_1.GatewayError(`Unsupported provider "${fields.provider}". Supported: ${Object.keys(PROVIDER_ROUTES).sort().join(", ")}`);
220
+ if (!gateway_1.PROVIDER_ROUTES[fields.provider]) {
221
+ throw new gateway_1.GatewayError(`Unsupported provider "${fields.provider}". Supported: ${Object.keys(gateway_1.PROVIDER_ROUTES).sort().join(", ")}`);
236
222
  }
237
223
  this.provider = fields.provider;
238
224
  this.model = fields.model;
@@ -260,8 +246,8 @@ class ChatAiGateway extends chat_models_1.BaseChatModel {
260
246
  return base;
261
247
  }
262
248
  _buildActionRequest(messages, cfg, stream, tools) {
263
- const route = PROVIDER_ROUTES[this.provider];
264
- const targetPath = route.target_path.replace("{model}", this.model);
249
+ const route = gateway_1.PROVIDER_ROUTES[this.provider];
250
+ const targetPath = route.path.replace("{model}", this.model);
265
251
  let params;
266
252
  if (route.format === "openai") {
267
253
  params = {
@@ -306,9 +292,9 @@ class ChatAiGateway extends chat_models_1.BaseChatModel {
306
292
  workload_id: workloadId ?? "",
307
293
  ingress_mode: "explicit_action_request",
308
294
  action: {
309
- type: "llm_chat",
295
+ type: "ai.infer",
310
296
  method: "POST",
311
- target_host: route.target_host,
297
+ target_host: route.host,
312
298
  target_path: targetPath,
313
299
  params,
314
300
  },
@@ -374,7 +360,7 @@ class ChatAiGateway extends chat_models_1.BaseChatModel {
374
360
  JSON.stringify(body);
375
361
  throw new gateway_1.GatewayError(`Upstream ${this.provider} returned HTTP ${upstreamStatus}: ${msg}`);
376
362
  }
377
- const route = PROVIDER_ROUTES[this.provider];
363
+ const route = gateway_1.PROVIDER_ROUTES[this.provider];
378
364
  let aiMessage;
379
365
  if (route.format === "openai")
380
366
  aiMessage = parseOpenAIBody(body);
@@ -400,7 +386,7 @@ class ChatAiGateway extends chat_models_1.BaseChatModel {
400
386
  }
401
387
  async *_stream(messages, _options, runManager) {
402
388
  const cfg = this._getConfig();
403
- const route = PROVIDER_ROUTES[this.provider];
389
+ const route = gateway_1.PROVIDER_ROUTES[this.provider];
404
390
  const actionRequest = this._buildActionRequest(messages, cfg, true);
405
391
  let response;
406
392
  try {
@@ -28,16 +28,14 @@ describe("ChatAiGateway — construction", () => {
28
28
  const llm = new index_1.ChatAiGateway({ provider: "anthropic", model: "claude-haiku-4-5-20251001" });
29
29
  expect(llm._llmType()).toBe("axemere-gateway");
30
30
  });
31
- it("supports all documented providers", () => {
32
- const providers = [
33
- "openai", "anthropic", "mistral", "google",
34
- "xai", "deepseek", "groq", "together",
35
- "fireworks", "perplexity", "openrouter", "cohere",
36
- ];
37
- for (const provider of providers) {
31
+ it("supports every provider in the shared routing table", () => {
32
+ for (const provider of Object.keys(gateway_1.PROVIDER_ROUTES)) {
38
33
  expect(() => new index_1.ChatAiGateway({ provider, model: "some-model" })).not.toThrow();
39
34
  }
40
35
  });
36
+ it("supports the google alias for gemini", () => {
37
+ expect(() => new index_1.ChatAiGateway({ provider: "google", model: "some-model" })).not.toThrow();
38
+ });
41
39
  });
42
40
  describe("ChatAiGateway — _generate wire body", () => {
43
41
  function mockFetch(body, status = 200) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axemere/gateway-langchain",
3
- "version": "0.1.10",
3
+ "version": "0.2.0",
4
4
  "description": "Axemere AI Gateway SDK — LangChain BaseChatModel integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,9 +24,9 @@
24
24
  "@langchain/core": ">=0.3.0"
25
25
  },
26
26
  "dependencies": {
27
- "@axemere/gateway": "0.1.10",
28
- "@axemere/gateway-openai": "0.1.10",
29
- "@axemere/gateway-anthropic": "0.1.10"
27
+ "@axemere/gateway": "0.2.0",
28
+ "@axemere/gateway-openai": "0.2.0",
29
+ "@axemere/gateway-anthropic": "0.2.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@langchain/core": "^0.3.0",