lfx-nightly 0.1.12.dev32__py3-none-any.whl → 0.1.12.dev33__py3-none-any.whl
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.
Potentially problematic release.
This version of lfx-nightly might be problematic. Click here for more details.
- lfx/components/ollama/ollama.py +26 -9
- {lfx_nightly-0.1.12.dev32.dist-info → lfx_nightly-0.1.12.dev33.dist-info}/METADATA +1 -1
- {lfx_nightly-0.1.12.dev32.dist-info → lfx_nightly-0.1.12.dev33.dist-info}/RECORD +5 -5
- {lfx_nightly-0.1.12.dev32.dist-info → lfx_nightly-0.1.12.dev33.dist-info}/WHEEL +0 -0
- {lfx_nightly-0.1.12.dev32.dist-info → lfx_nightly-0.1.12.dev33.dist-info}/entry_points.txt +0 -0
lfx/components/ollama/ollama.py
CHANGED
|
@@ -32,8 +32,8 @@ class ChatOllamaComponent(LCModelComponent):
|
|
|
32
32
|
MessageTextInput(
|
|
33
33
|
name="base_url",
|
|
34
34
|
display_name="Base URL",
|
|
35
|
-
info="Endpoint of the Ollama API.",
|
|
36
|
-
value="",
|
|
35
|
+
info="Endpoint of the Ollama API. Defaults to http://localhost:11434 .",
|
|
36
|
+
value="http://localhost:11434",
|
|
37
37
|
real_time_refresh=True,
|
|
38
38
|
),
|
|
39
39
|
DropdownInput(
|
|
@@ -157,6 +157,18 @@ class ChatOllamaComponent(LCModelComponent):
|
|
|
157
157
|
mirostat_tau = self.mirostat_tau
|
|
158
158
|
|
|
159
159
|
transformed_base_url = transform_localhost_url(self.base_url)
|
|
160
|
+
|
|
161
|
+
# Check if URL contains /v1 suffix (OpenAI-compatible mode)
|
|
162
|
+
if transformed_base_url and transformed_base_url.rstrip("/").endswith("/v1"):
|
|
163
|
+
# Strip /v1 suffix and log warning
|
|
164
|
+
transformed_base_url = transformed_base_url.rstrip("/").removesuffix("/v1")
|
|
165
|
+
logger.warning(
|
|
166
|
+
"Detected '/v1' suffix in base URL. The Ollama component uses the native Ollama API, "
|
|
167
|
+
"not the OpenAI-compatible API. The '/v1' suffix has been automatically removed. "
|
|
168
|
+
"If you want to use the OpenAI-compatible API, please use the OpenAI component instead. "
|
|
169
|
+
"Learn more at https://docs.ollama.com/openai#openai-compatibility"
|
|
170
|
+
)
|
|
171
|
+
|
|
160
172
|
# Mapping system settings to their corresponding values
|
|
161
173
|
llm_params = {
|
|
162
174
|
"base_url": transformed_base_url,
|
|
@@ -190,8 +202,8 @@ class ChatOllamaComponent(LCModelComponent):
|
|
|
190
202
|
output = ChatOllama(**llm_params)
|
|
191
203
|
except Exception as e:
|
|
192
204
|
msg = (
|
|
193
|
-
"Unable to connect to the Ollama API. "
|
|
194
|
-
"Please verify the base URL, ensure the relevant Ollama model is pulled, and try again."
|
|
205
|
+
"Unable to connect to the Ollama API. "
|
|
206
|
+
"Please verify the base URL, ensure the relevant Ollama model is pulled, and try again."
|
|
195
207
|
)
|
|
196
208
|
raise ValueError(msg) from e
|
|
197
209
|
|
|
@@ -201,6 +213,12 @@ class ChatOllamaComponent(LCModelComponent):
|
|
|
201
213
|
try:
|
|
202
214
|
async with httpx.AsyncClient() as client:
|
|
203
215
|
url = transform_localhost_url(url)
|
|
216
|
+
if not url:
|
|
217
|
+
return False
|
|
218
|
+
# Strip /v1 suffix if present, as Ollama API endpoints are at root level
|
|
219
|
+
url = url.rstrip("/").removesuffix("/v1")
|
|
220
|
+
if not url.endswith("/"):
|
|
221
|
+
url = url + "/"
|
|
204
222
|
return (await client.get(urljoin(url, "api/tags"))).status_code == HTTP_STATUS_OK
|
|
205
223
|
except httpx.RequestError:
|
|
206
224
|
return False
|
|
@@ -224,9 +242,6 @@ class ChatOllamaComponent(LCModelComponent):
|
|
|
224
242
|
build_config["mirostat_eta"]["value"] = 0.1
|
|
225
243
|
build_config["mirostat_tau"]["value"] = 5
|
|
226
244
|
|
|
227
|
-
if field_name in {"base_url", "model_name"} and not await self.is_valid_ollama_url(self.base_url):
|
|
228
|
-
msg = "Ollama is not running on the provided base URL. Please start Ollama and try again."
|
|
229
|
-
raise ValueError(msg)
|
|
230
245
|
if field_name in {"model_name", "base_url", "tool_model_enabled"}:
|
|
231
246
|
if await self.is_valid_ollama_url(self.base_url):
|
|
232
247
|
tool_model_enabled = build_config["tool_model_enabled"].get("value", False) or self.tool_model_enabled
|
|
@@ -264,8 +279,10 @@ class ChatOllamaComponent(LCModelComponent):
|
|
|
264
279
|
names cannot be retrieved.
|
|
265
280
|
"""
|
|
266
281
|
try:
|
|
267
|
-
#
|
|
268
|
-
base_url = base_url_value.rstrip("/")
|
|
282
|
+
# Strip /v1 suffix if present, as Ollama API endpoints are at root level
|
|
283
|
+
base_url = base_url_value.rstrip("/").removesuffix("/v1")
|
|
284
|
+
if not base_url.endswith("/"):
|
|
285
|
+
base_url = base_url + "/"
|
|
269
286
|
base_url = transform_localhost_url(base_url)
|
|
270
287
|
|
|
271
288
|
# Ollama REST API to return models
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lfx-nightly
|
|
3
|
-
Version: 0.1.12.
|
|
3
|
+
Version: 0.1.12.dev33
|
|
4
4
|
Summary: Langflow Executor - A lightweight CLI tool for executing and serving Langflow AI flows
|
|
5
5
|
Author-email: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
|
|
6
6
|
Requires-Python: <3.14,>=3.10
|
|
@@ -408,7 +408,7 @@ lfx/components/nvidia/system_assist.py,sha256=G8cgsLQxRBBnUt49_Uzxt7cdTNplVAzUlD
|
|
|
408
408
|
lfx/components/olivya/__init__.py,sha256=ilZR88huL3vnQHO27g4jsUkyIYSgN7RPOq8Corbi6xA,67
|
|
409
409
|
lfx/components/olivya/olivya.py,sha256=PDmsn8dBdSwAZUM2QGTyTwxGWsINCKaYR4yTjE-4lIQ,4192
|
|
410
410
|
lfx/components/ollama/__init__.py,sha256=fau8QcWs_eHO2MmtQ4coiKj9CzFA9X4hqFf541ekgXk,1068
|
|
411
|
-
lfx/components/ollama/ollama.py,sha256=
|
|
411
|
+
lfx/components/ollama/ollama.py,sha256=KSaBAdgyh1xmkIvVcBHRVwFwzBtR7wPkH4j3dlJnPC4,13946
|
|
412
412
|
lfx/components/ollama/ollama_embeddings.py,sha256=nvg-JQvue6j7tcrbbPeq1U_-LUj1MKawWbXxnnvJlWM,3976
|
|
413
413
|
lfx/components/openai/__init__.py,sha256=G4Fgw4pmmDohdIOmzaeSCGijzKjyqFXNJPLwlcUDZ3w,1113
|
|
414
414
|
lfx/components/openai/openai.py,sha256=imWO1tTJ0tTLqax1v5bNBPCRINTj2f2wN8j5G-a07GI,4505
|
|
@@ -719,7 +719,7 @@ lfx/utils/schemas.py,sha256=NbOtVQBrn4d0BAu-0H_eCTZI2CXkKZlRY37XCSmuJwc,3865
|
|
|
719
719
|
lfx/utils/util.py,sha256=Ww85wbr1-vjh2pXVtmTqoUVr6MXAW8S7eDx_Ys6HpE8,20696
|
|
720
720
|
lfx/utils/util_strings.py,sha256=nU_IcdphNaj6bAPbjeL-c1cInQPfTBit8mp5Y57lwQk,1686
|
|
721
721
|
lfx/utils/version.py,sha256=cHpbO0OJD2JQAvVaTH_6ibYeFbHJV0QDHs_YXXZ-bT8,671
|
|
722
|
-
lfx_nightly-0.1.12.
|
|
723
|
-
lfx_nightly-0.1.12.
|
|
724
|
-
lfx_nightly-0.1.12.
|
|
725
|
-
lfx_nightly-0.1.12.
|
|
722
|
+
lfx_nightly-0.1.12.dev33.dist-info/METADATA,sha256=VaDj2VJuP8XeX3yfpiiLcY97pMlZTeEt-AizBHHGSss,8290
|
|
723
|
+
lfx_nightly-0.1.12.dev33.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
724
|
+
lfx_nightly-0.1.12.dev33.dist-info/entry_points.txt,sha256=1724p3RHDQRT2CKx_QRzEIa7sFuSVO0Ux70YfXfoMT4,42
|
|
725
|
+
lfx_nightly-0.1.12.dev33.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|