@wingman-ai/gateway 0.4.4 → 0.5.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.
@@ -27,6 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  ModelFactory: ()=>ModelFactory
28
28
  });
29
29
  const anthropic_namespaceObject = require("@langchain/anthropic");
30
+ const ollama_namespaceObject = require("@langchain/ollama");
30
31
  const openai_namespaceObject = require("@langchain/openai");
31
32
  const xai_namespaceObject = require("@langchain/xai");
32
33
  const codex_cjs_namespaceObject = require("../../providers/codex.cjs");
@@ -208,17 +209,18 @@ class ModelFactory {
208
209
  static createOllamaModel(model, options) {
209
210
  const tokenResult = (0, credentials_cjs_namespaceObject.resolveProviderToken)("ollama");
210
211
  const provider = (0, registry_cjs_namespaceObject.getProviderSpec)("ollama");
211
- const apiKey = tokenResult.token ?? "ollama";
212
212
  const params = {
213
213
  model,
214
214
  temperature: 1,
215
- apiKey: apiKey,
216
- configuration: {
217
- baseURL: provider?.baseURL
218
- }
215
+ baseUrl: provider?.baseURL,
216
+ ...tokenResult.token ? {
217
+ headers: {
218
+ Authorization: `Bearer ${tokenResult.token}`
219
+ }
220
+ } : {}
219
221
  };
220
- ModelFactory.applyOpenAIReasoningEffort(params, "ollama", model, options);
221
- return new openai_namespaceObject.ChatOpenAI(params);
222
+ if (options.reasoningEffort) ModelFactory.warnUnsupportedReasoningEffort("ollama", model, options.reasoningEffort, options.ownerLabel);
223
+ return new ollama_namespaceObject.ChatOllama(params);
222
224
  }
223
225
  static applyOpenAIReasoningEffort(params, provider, model, options) {
224
226
  const effort = options.reasoningEffort;
@@ -1,4 +1,5 @@
1
1
  import { ChatAnthropic } from "@langchain/anthropic";
2
+ import { ChatOllama } from "@langchain/ollama";
2
3
  import { ChatOpenAI } from "@langchain/openai";
3
4
  import { ChatXAI } from "@langchain/xai";
4
5
  import { createCodexFetch, resolveCodexAuthFromFile } from "../../providers/codex.js";
@@ -180,17 +181,18 @@ class ModelFactory {
180
181
  static createOllamaModel(model, options) {
181
182
  const tokenResult = resolveProviderToken("ollama");
182
183
  const provider = getProviderSpec("ollama");
183
- const apiKey = tokenResult.token ?? "ollama";
184
184
  const params = {
185
185
  model,
186
186
  temperature: 1,
187
- apiKey: apiKey,
188
- configuration: {
189
- baseURL: provider?.baseURL
190
- }
187
+ baseUrl: provider?.baseURL,
188
+ ...tokenResult.token ? {
189
+ headers: {
190
+ Authorization: `Bearer ${tokenResult.token}`
191
+ }
192
+ } : {}
191
193
  };
192
- ModelFactory.applyOpenAIReasoningEffort(params, "ollama", model, options);
193
- return new ChatOpenAI(params);
194
+ if (options.reasoningEffort) ModelFactory.warnUnsupportedReasoningEffort("ollama", model, options.reasoningEffort, options.ownerLabel);
195
+ return new ChatOllama(params);
194
196
  }
195
197
  static applyOpenAIReasoningEffort(params, provider, model, options) {
196
198
  const effort = options.reasoningEffort;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  var __webpack_exports__ = {};
3
3
  const anthropic_namespaceObject = require("@langchain/anthropic");
4
+ const ollama_namespaceObject = require("@langchain/ollama");
4
5
  const openai_namespaceObject = require("@langchain/openai");
5
6
  const xai_namespaceObject = require("@langchain/xai");
6
7
  const external_vitest_namespaceObject = require("vitest");
@@ -86,11 +87,12 @@ const originalXaiApiKey = process.env.XAI_API_KEY;
86
87
  });
87
88
  (0, external_vitest_namespaceObject.it)("should create an Ollama model", ()=>{
88
89
  const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("ollama:llama3.2");
89
- (0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
90
+ (0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(ollama_namespaceObject.ChatOllama);
91
+ (0, external_vitest_namespaceObject.expect)(model.baseUrl).toBe("http://localhost:11434");
90
92
  });
91
93
  (0, external_vitest_namespaceObject.it)("should allow model names with additional colons", ()=>{
92
94
  const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("ollama:phi4:14b-q8_0");
93
- (0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
95
+ (0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(ollama_namespaceObject.ChatOllama);
94
96
  });
95
97
  (0, external_vitest_namespaceObject.it)("should create native xAI image model for grok-imagine-image", ()=>{
96
98
  const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("xai:grok-imagine-image");
@@ -1,4 +1,5 @@
1
1
  import { ChatAnthropic } from "@langchain/anthropic";
2
+ import { ChatOllama } from "@langchain/ollama";
2
3
  import { ChatOpenAI } from "@langchain/openai";
3
4
  import { ChatXAI } from "@langchain/xai";
4
5
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
@@ -84,11 +85,12 @@ describe("ModelFactory", ()=>{
84
85
  });
85
86
  it("should create an Ollama model", ()=>{
86
87
  const model = ModelFactory.createModel("ollama:llama3.2");
87
- expect(model).toBeInstanceOf(ChatOpenAI);
88
+ expect(model).toBeInstanceOf(ChatOllama);
89
+ expect(model.baseUrl).toBe("http://localhost:11434");
88
90
  });
89
91
  it("should allow model names with additional colons", ()=>{
90
92
  const model = ModelFactory.createModel("ollama:phi4:14b-q8_0");
91
- expect(model).toBeInstanceOf(ChatOpenAI);
93
+ expect(model).toBeInstanceOf(ChatOllama);
92
94
  });
93
95
  it("should create native xAI image model for grok-imagine-image", ()=>{
94
96
  const model = ModelFactory.createModel("xai:grok-imagine-image");
@@ -109,7 +109,7 @@ const PROVIDERS = {
109
109
  envVars: [
110
110
  "OLLAMA_API_KEY"
111
111
  ],
112
- baseURL: "http://localhost:11434/v1",
112
+ baseURL: "http://localhost:11434",
113
113
  requiresAuth: false,
114
114
  category: "model"
115
115
  },
@@ -79,7 +79,7 @@ const PROVIDERS = {
79
79
  envVars: [
80
80
  "OLLAMA_API_KEY"
81
81
  ],
82
- baseURL: "http://localhost:11434/v1",
82
+ baseURL: "http://localhost:11434",
83
83
  requiresAuth: false,
84
84
  category: "model"
85
85
  },