Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

fix: preserve watsonx TLS policy during onboarding (#2417)

Edwin Josea3f62a3056e5
diff --git a/enhancements/providers/watsonx/onprem.py b/enhancements/providers/watsonx/onprem.py
index d687ebb94..8c3dd3385 100644
--- a/enhancements/providers/watsonx/onprem.py
+++ b/enhancements/providers/watsonx/onprem.py
@@ -242,9 +242,14 @@ def litellm_runtime_kwargs(stored: Mapping[str, Any]) -> dict[str, Any]:
cache = litellm.in_memory_llm_clients_cache
client = cache.get_cache(cache_key)
if client is None:
+ # Isolation across TLS policies comes from cache_key above, which is
+ # already policy-specific. client_alias is a log-only label in this
+ # LiteLLM version (nothing reads it back for cache lookups) — keep it
+ # policy-specific anyway so distinct clients are distinguishable in
+ # logs and diagnostics.
client = AsyncHTTPHandler(
ssl_verify=tls,
- client_alias="openrag-watsonx-onprem",
+ client_alias=cache_key,
)
cache.set_cache(cache_key, client, litellm_owned_client=True)
return {"client": client}
diff --git a/frontend/app/api/mutations/useOnboardingMutation.test.tsx b/frontend/app/api/mutations/useOnboardingMutation.test.tsx
index 9975c8131..265e83db1 100644
--- a/frontend/app/api/mutations/useOnboardingMutation.test.tsx
+++ b/frontend/app/api/mutations/useOnboardingMutation.test.tsx
@@ -10,6 +10,11 @@ import { server } from "@/test-utils/msw/server";
import { createQueryWrapper, createTestQueryClient } from "@/test-utils/render";
import { useOnboardingMutation } from "./useOnboardingMutation";
+const toast = vi.hoisted(() => ({
+ info: vi.fn(),
+}));
+vi.mock("sonner", () => ({ toast }));
+
describe("useOnboardingMutation", () => {
it("posts the onboarding variables and resolves with the response", async () => {
let capturedBody: unknown;
@@ -66,6 +71,57 @@ describe("useOnboardingMutation", () => {
);
});
+ it("explains when watsonx.ai on-prem reduces the ingestion chunk size", async () => {
+ server.use(
+ http.post("/api/onboarding", () =>
+ HttpResponse.json({
+ message: "done",
+ edited: true,
+ chunk_size_adjusted_to: 500,
+ }),
+ ),
+ );
+
+ const { result } = renderHook(() => useOnboardingMutation(), {
+ wrapper: createQueryWrapper(),
+ });
+
+ act(() =>
+ result.current.mutate({
+ embedding_provider: "watsonx_onprem",
+ embedding_model: "ibm/slate-30m-english-rtrvr",
+ }),
+ );
+
+ await waitFor(() => expect(result.current.isSuccess).toBe(true));
+ expect(toast.info).toHaveBeenCalledWith("Chunk size reduced to 500", {
+ description:
+ "OpenRAG adjusted ingestion chunks to stay within watsonx.ai on-prem embedding limits.",
+ });
+ });
+
+ it("does not show a chunk-size toast when the backend reports no adjustment", async () => {
+ toast.info.mockClear();
+ server.use(
+ http.post("/api/onboarding", () =>
+ HttpResponse.json({
+ message: "done",
+ edited: true,
+ chunk_size_adjusted_to: null,
+ }),
+ ),
+ );
+
+ const { result } = renderHook(() => useOnboardingMutation(), {
+ wrapper: createQueryWrapper(),
+ });
+
+ act(() => result.current.mutate({ embedding_provider: "watsonx_onprem" }));
+
+ await waitFor(() => expect(result.current.isSuccess).toBe(true));
+ expect(toast.info).not.toHaveBeenCalled();
+ });
+
it("calls the caller's onSuccess for a completed onboarding request", async () => {
const onSuccess = vi.fn();
const response = {
diff --git a/frontend/app/api/mutations/useOnboardingMutation.ts b/frontend/app/api/mutations/useOnboardingMutation.ts
index c0283811a..c07a76c69 100644
--- a/frontend/app/api/mutations/useOnboardingMutation.ts
+++ b/frontend/app/api/mutations/useOnboardingMutation.ts
@@ -3,6 +3,7 @@ import {
useMutation,
useQueryClient,
} from "@tanstack/react-query";
+import { toast } from "sonner";
import { formatProviderErrorMessage } from "@/lib/chat-stream-errors";
import { useUpdateOnboardingStateMutation } from "./useUpdateOnboardingStateMutation";
@@ -32,6 +33,7 @@ interface OnboardingResponse {
edited: boolean;
openrag_docs_filter_id?: string;
task_id?: string;
+ chunk_size_adjusted_to?: number | null;
}
async function submitOnboarding(
@@ -68,20 +70,33 @@ export const useOnboardingMutation = (
const updateOnboardingMutation = useUpdateOnboardingStateMutation();
return useMutation({
+ ...options,
mutationFn: submitOnboarding,
- onSuccess: (data) => {
+ onSuccess: async (data, variables, onMutateResult, context) => {
// Save OpenRAG docs filter ID if sample data was ingested
if (data.openrag_docs_filter_id) {
- // Save to backend
- updateOnboardingMutation.mutateAsync({
+ await updateOnboardingMutation.mutateAsync({
openrag_docs_filter_id: data.openrag_docs_filter_id,
});
}
+ if (typeof data.chunk_size_adjusted_to === "number") {
+ toast.info(`Chunk size reduced to ${data.chunk_size_adjusted_to}`, {
+ description:
+ "OpenRAG adjusted ingestion chunks to stay within watsonx.ai on-prem embedding limits.",
+ });
+ }
+ await options?.onSuccess?.(data, variables, onMutateResult, context);
},
- onSettled: () => {
- // Invalidate settings query to refetch updated data
- queryClient.invalidateQueries({ queryKey: ["settings"] });
+ onSettled: async (data, error, variables, onMutateResult, context) => {
+ // Invalidate settings query to refetch updated onboarding state
+ await queryClient.invalidateQueries({ queryKey: ["settings"] });
+ await options?.onSettled?.(
+ data,
+ error,
+ variables,
+ onMutateResult,
+ context,
+ );
},
- ...options,
});
};
diff --git a/frontend/app/onboarding/_components/generic-provider-credential-fields.tsx b/frontend/app/onboarding/_components/generic-provider-credential-fields.tsx
index 52240560d..8e69a2da0 100644
--- a/frontend/app/onboarding/_components/generic-provider-credential-fields.tsx
+++ b/frontend/app/onboarding/_components/generic-provider-credential-fields.tsx
@@ -97,9 +97,9 @@ export function GenericProviderCredentialFields({
<AccordionTrigger>Advanced settings</AccordionTrigger>
<AccordionContent className="space-y-4">
{fieldsForKeys(fields, [
+ "ssl_verify",
"space_id",
"project_id",
- "ssl_verify",
]).map(renderField)}
</AccordionContent>
</AccordionItem>
diff --git a/frontend/components/models/watsonx-space-select.test.tsx b/frontend/components/models/watsonx-space-select.test.tsx
new file mode 100644
index 000000000..d0f582e3e
--- /dev/null
+++ b/frontend/components/models/watsonx-space-select.test.tsx
@@ -0,0 +1,101 @@
+import { HttpResponse, http } from "msw";
+import { describe, expect, it, vi } from "vitest";
+import { renderWithProviders, screen, userEvent } from "@/test-utils/render";
+import { WatsonxSpaceSelect } from "./watsonx-space-select";
+
+describe("WatsonxSpaceSelect", () => {
+ it("lets the user refresh deployment spaces after automatic discovery fails", async () => {
+ let attempts = 0;
+ const onValueChange = vi.fn();
+
+ renderWithProviders(
+ <WatsonxSpaceSelect
+ credentials={{
+ api_base: "https://cpd.example.com",
+ username: "cpd-user",
+ api_key: "secret",
+ ssl_verify: "true",
+ }}
+ value=""
+ onValueChange={onValueChange}
+ idPrefix="test"
+ />,
+ {
+ handlers: [
+ http.post("/api/models/watsonx_onprem/spaces", () => {
+ attempts += 1;
+ if (attempts === 1) {
+ return HttpResponse.json(
+ { error: "The deployment-space service is unavailable" },
+ { status: 503 },
+ );
+ }
+ return HttpResponse.json({
+ spaces: [{ id: "space-prod", name: "Production" }],
+ });
+ }),
+ ],
+ },
+ );
+
+ expect(
+ await screen.findByRole("alert", {
+ name: "",
+ }),
+ ).toHaveTextContent("The deployment-space service is unavailable");
+
+ expect(screen.getByRole("alert")).toHaveTextContent(
+ "Check the cluster URL, credentials, and that watsonx.ai is available.",
+ );
+ expect(screen.getByRole("alert")).toHaveTextContent(
+ "temporarily turn off Verify TLS certificates",
+ );
+ const user = userEvent.setup();
+ await user.click(
+ screen.getByRole("button", { name: "Refresh deployment spaces" }),
+ );
+ await user.click(
+ screen.getByRole("combobox", { name: "Deployment space ID" }),
+ );
+ await user.click(
+ await screen.findByRole("option", { name: /Production.*space-prod/ }),
+ );
+
+ expect(attempts).toBe(2);
+ expect(onValueChange).toHaveBeenCalledWith("space-prod");
+ });
+
+ it("does not suggest disabling TLS when verification is already off", async () => {
+ renderWithProviders(
+ <WatsonxSpaceSelect
+ credentials={{
+ api_base: "https://cpd.example.com",
+ username: "cpd-user",
+ api_key: "secret",
+ ssl_verify: "false",
+ }}
+ value=""
+ onValueChange={vi.fn()}
+ idPrefix="test"
+ />,
+ {
+ handlers: [
+ http.post("/api/models/watsonx_onprem/spaces", () =>
+ HttpResponse.json(
+ { error: "The deployment-space service is unavailable" },
+ { status: 503 },
+ ),
+ ),
+ ],
+ },
+ );
+
+ const alert = await screen.findByRole("alert");
+ expect(alert).toHaveTextContent(
+ "Check the cluster URL, credentials, and that watsonx.ai is available.",
+ );
+ expect(alert).not.toHaveTextContent(
+ "temporarily turn off Verify TLS certificates",
+ );
+ });
+});
diff --git a/frontend/components/models/watsonx-space-select.tsx b/frontend/components/models/watsonx-space-select.tsx
index bc791913a..45e0d9d9e 100644
--- a/frontend/components/models/watsonx-space-select.tsx
+++ b/frontend/components/models/watsonx-space-select.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Check, ChevronsUpDown, LoaderCircle, Plus, X } from "lucide-react";
+import { Check, ChevronsUpDown, Plus, RefreshCw, X } from "lucide-react";
import { useEffect, useId, useReducer, useState } from "react";
import { LabelWrapper } from "@/components/label-wrapper";
import { Button } from "@/components/ui/button";
@@ -18,6 +18,7 @@ import {
PopoverTrigger,
} from "@/components/ui/popover";
import { cn } from "@/lib/utils";
+import { WATSONX_TLS_DISABLED_VALUES } from "./watsonx-tls-settings";
interface WatsonxSpace {
id: string;
@@ -88,6 +89,7 @@ export function WatsonxSpaceSelect({
const id = `${idPrefix}-space-${generatedId.replaceAll(":", "")}`;
const [state, dispatch] = useReducer(reduceSpaceSelect, initialState);
const [search, setSearch] = useState("");
+ const [refreshAttempt, setRefreshAttempt] = useState(0);
const { open, spaces, status, error } = state;
const apiBase = credentials.api_base?.trim() ?? "";
@@ -95,12 +97,15 @@ export function WatsonxSpaceSelect({
const apiKey = credentials.api_key ?? "";
const zenApiKey = credentials.zen_api_key ?? "";
const sslVerify = credentials.ssl_verify ?? "";
+ const tlsVerificationEnabled =
+ WATSONX_TLS_DISABLED_VALUES[sslVerify.trim().toLowerCase()] !== true;
const ready =
Boolean(apiBase) &&
(authMethod === "zen_api_key"
? Boolean(zenApiKey.trim() || hasSavedZenApiKey)
: Boolean(username && (apiKey.trim() || hasSavedApiKey)));
+ // biome-ignore lint/correctness/useExhaustiveDependencies: refreshAttempt explicitly retriggers discovery.
useEffect(() => {
if (!ready) {
dispatch({ type: "reset" });
@@ -154,7 +159,16 @@ export function WatsonxSpaceSelect({
window.clearTimeout(timeout);
controller.abort();
};
- }, [apiBase, username, apiKey, zenApiKey, sslVerify, authMethod, ready]);
+ }, [
+ apiBase,
+ username,
+ apiKey,
+ zenApiKey,
+ sslVerify,
+ authMethod,
+ ready,
+ refreshAttempt,
+ ]);
const selected = spaces.find((space) => space.id === value);
const selectedLabel = selected?.name ?? value;
@@ -197,11 +211,7 @@ export function WatsonxSpaceSelect({
? "Loading deployment spaces…"
: selectedLabel || "Select a deployment space"}
</span>
- {status === "loading" ? (
- <LoaderCircle className="animate-spin opacity-60" />
- ) : (
- <ChevronsUpDown className="opacity-50" />
- )}
+ <ChevronsUpDown className="opacity-50" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-[var(--radix-popover-trigger-width)] p-0">
@@ -255,6 +265,18 @@ export function WatsonxSpaceSelect({
</Command>
</PopoverContent>
</Popover>
+ <Button
+ type="button"
+ variant="outline"
+ aria-label="Refresh deployment spaces"
+ disabled={!ready || status === "loading"}
+ onClick={() => setRefreshAttempt((attempt) => attempt + 1)}
+ className="shrink-0 px-3"
+ ignoreTitleCase
+ >
+ <RefreshCw className={cn(status === "loading" && "animate-spin")} />
+ <span className="hidden sm:inline">Refresh</span>
+ </Button>
{value && (
<Button
type="button"
@@ -274,9 +296,15 @@ export function WatsonxSpaceSelect({
</p>
)}
{error && (
- <p role="alert" className="text-sm text-destructive">
- {error}
- </p>
+ <div role="alert" className="space-y-1 text-sm text-destructive">
+ <p>{error}</p>
+ <p>
+ Check the cluster URL, credentials, and that watsonx.ai is
+ available.
+ {tlsVerificationEnabled &&
+ " For an internal or self-signed certificate, provide its CA bundle—or temporarily turn off Verify TLS certificates on a trusted network to diagnose—then refresh."}
+ </p>
+ </div>
)}
</div>
);
diff --git a/frontend/components/models/watsonx-tls-settings.tsx b/frontend/components/models/watsonx-tls-settings.tsx
index 9c65bfcb5..251e4668e 100644
--- a/frontend/components/models/watsonx-tls-settings.tsx
+++ b/frontend/components/models/watsonx-tls-settings.tsx
@@ -7,7 +7,7 @@ import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
-const FALSE_VALUES: Record<string, true> = {
+export const WATSONX_TLS_DISABLED_VALUES: Record<string, true> = {
false: true,
"0": true,
no: true,
@@ -30,11 +30,11 @@ export function WatsonxTlsSettings({
idPrefix: string;
}) {
const normalized = (value ?? "").trim().toLowerCase();
- const enabled = FALSE_VALUES[normalized] !== true;
+ const enabled = WATSONX_TLS_DISABLED_VALUES[normalized] !== true;
const caPath =
!normalized ||
TRUE_VALUES[normalized] === true ||
- FALSE_VALUES[normalized] === true
+ WATSONX_TLS_DISABLED_VALUES[normalized] === true
? ""
: (value ?? "");
const lastCaPath = useRef(caPath);
diff --git a/src/api/settings/endpoints.py b/src/api/settings/endpoints.py
index 22dbab14c..67803c511 100644
--- a/src/api/settings/endpoints.py
+++ b/src/api/settings/endpoints.py
@@ -113,6 +113,8 @@ from utils.version_utils import OPENRAG_VERSION
logger = get_logger(__name__)
+WATSONX_ONPREM_ONBOARDING_CHUNK_SIZE = 500
+
def _provider_key(provider: str | None) -> str:
"""Normalize a provider name the way credential storage does.
@@ -1206,6 +1208,7 @@ async def onboarding(
# Update knowledge settings (embedding)
embedding_model_selected = None
embedding_provider_selected = None
+ chunk_size_adjusted_to = None
if body.embedding_model:
embedding_model_selected = body.embedding_model.strip()
@@ -1230,6 +1233,19 @@ async def onboarding(
logger.info(
f"Embedding provider selected during onboarding: {embedding_provider_selected}"
)
+ if (
+ embedding_provider_selected.lower() == "watsonx_onprem"
+ and current_config.knowledge.chunk_size > WATSONX_ONPREM_ONBOARDING_CHUNK_SIZE
+ ):
+ current_config.knowledge.chunk_size = WATSONX_ONPREM_ONBOARDING_CHUNK_SIZE
+ if current_config.knowledge.chunk_overlap >= WATSONX_ONPREM_ONBOARDING_CHUNK_SIZE:
+ current_config.knowledge.chunk_overlap = 200
+ chunk_size_adjusted_to = WATSONX_ONPREM_ONBOARDING_CHUNK_SIZE
+ logger.info(
+ "Reduced chunk size for watsonx.ai on-prem embedding compatibility",
+ chunk_size=chunk_size_adjusted_to,
+ chunk_overlap=current_config.knowledge.chunk_overlap,
+ )
# Update provider-specific credentials
if body.openai_api_key:
@@ -1360,6 +1376,7 @@ async def onboarding(
project_id=getattr(llm_provider_config, "project_id", None),
test_completion=True, # Full validation with completion test - ensures provider health
credentials=current_config.providers.credential_values(llm_provider),
+ stored_credentials=current_config.providers.stored_credentials(llm_provider),
)
logger.info(
f"LLM provider setup validation completed successfully for {llm_provider}"
@@ -1383,6 +1400,9 @@ async def onboarding(
credentials=current_config.providers.credential_values(
embedding_provider, kind="embedding"
),
+ stored_credentials=current_config.providers.stored_credentials(
+ embedding_provider
+ ),
)
logger.info(
f"Embedding provider setup validation completed successfully for {embedding_provider}"
@@ -1645,6 +1665,7 @@ async def onboarding(
sample_data_ingested=should_ingest_sample_data,
openrag_docs_filter_id=openrag_docs_filter_id,
task_id=task_id,
+ chunk_size_adjusted_to=chunk_size_adjusted_to,
)
except Exception as e:
diff --git a/src/api/settings/models.py b/src/api/settings/models.py
index ecf161ed1..8a61cc9e1 100644
--- a/src/api/settings/models.py
+++ b/src/api/settings/models.py
@@ -263,6 +263,7 @@ class OnboardingResponse(BaseModel):
sample_data_ingested: bool
openrag_docs_filter_id: str | None = None
task_id: str | None = None
+ chunk_size_adjusted_to: int | None = None
class RefreshOpenRAGDocsResponse(BaseModel):
diff --git a/tests/unit/api/test_settings_endpoints.py b/tests/unit/api/test_settings_endpoints.py
index 7e1c04b9e..c375fe5f7 100644
--- a/tests/unit/api/test_settings_endpoints.py
+++ b/tests/unit/api/test_settings_endpoints.py
@@ -521,3 +521,178 @@ async def test_failed_onboarding_validation_does_not_mutate_cached_config():
assert response.status_code == 400
assert config.agent.llm_model == "old-model"
assert config.providers.openai.api_key == ""
+
+
+async def test_onboarding_validation_receives_onprem_tls_policy():
+ from api.settings.endpoints import onboarding
+ from config.config_manager import OpenRAGConfig
+
+ config = OpenRAGConfig.from_dict({})
+ body = OnboardingBody(
+ llm_provider="watsonx_onprem",
+ llm_model="ibm/granite-3-3-8b-instruct",
+ provider_credentials={
+ "watsonx_onprem": {
+ "api_base": "https://cpd.example.com",
+ "username": "cpd-user",
+ "api_key": "secret",
+ "ssl_verify": "false",
+ }
+ },
+ provider_auth_methods={"watsonx_onprem": "username_api_key"},
+ )
+
+ with (
+ patch("api.settings.endpoints.get_openrag_config", return_value=config),
+ patch(
+ "api.settings.endpoints.TelemetryClient.send_event",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints.validate_provider_setup",
+ new_callable=AsyncMock,
+ side_effect=Exception("stop after validation arguments are captured"),
+ ) as validate,
+ ):
+ response = await onboarding(
+ body=body,
+ flows_service=MagicMock(),
+ session_manager=AsyncMock(),
+ document_service=MagicMock(),
+ models_service=MagicMock(),
+ task_service=MagicMock(),
+ langflow_file_service=MagicMock(),
+ knowledge_filter_service=MagicMock(),
+ user=MagicMock(spec=User),
+ )
+
+ assert response.status_code == 400
+ assert validate.await_args.kwargs["stored_credentials"]["ssl_verify"] == "false"
+
+
+async def test_onboarding_embedding_validation_receives_onprem_tls_policy():
+ from api.settings.endpoints import onboarding
+ from config.config_manager import OpenRAGConfig
+
+ config = OpenRAGConfig.from_dict({})
+ body = OnboardingBody(
+ embedding_provider="watsonx_onprem",
+ embedding_model="ibm/slate-125m-english-rtrvr",
+ provider_credentials={
+ "watsonx_onprem": {
+ "api_base": "https://cpd.example.com",
+ "username": "cpd-user",
+ "api_key": "secret",
+ "ssl_verify": "false",
+ }
+ },
+ provider_auth_methods={"watsonx_onprem": "username_api_key"},
+ )
+
+ with (
+ patch("api.settings.endpoints.get_openrag_config", return_value=config),
+ patch(
+ "api.settings.endpoints.TelemetryClient.send_event",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints.validate_provider_setup",
+ new_callable=AsyncMock,
+ side_effect=Exception("stop after validation arguments are captured"),
+ ) as validate,
+ ):
+ response = await onboarding(
+ body=body,
+ flows_service=MagicMock(),
+ session_manager=AsyncMock(),
+ document_service=MagicMock(),
+ models_service=MagicMock(),
+ task_service=MagicMock(),
+ langflow_file_service=MagicMock(),
+ knowledge_filter_service=MagicMock(),
+ user=MagicMock(spec=User),
+ )
+
+ assert response.status_code == 400
+ assert validate.await_args.kwargs["stored_credentials"]["ssl_verify"] == "false"
+
+
+async def test_onboarding_caps_chunk_size_for_watsonx_onprem_embeddings():
+ from api.settings.endpoints import onboarding
+ from config.config_manager import OpenRAGConfig
+
+ config = OpenRAGConfig.from_dict({})
+ config.knowledge.chunk_size = 1000
+ body = OnboardingBody(
+ embedding_provider="watsonx_onprem",
+ embedding_model="ibm/slate-30m-english-rtrvr",
+ provider_credentials={
+ "watsonx_onprem": {
+ "api_base": "https://cpd.example.com",
+ "username": "cpd-user",
+ "api_key": "secret",
+ "ssl_verify": "false",
+ }
+ },
+ provider_auth_methods={"watsonx_onprem": "username_api_key"},
+ )
+
+ with (
+ patch("api.settings.endpoints.get_openrag_config", return_value=config),
+ patch("api.settings.endpoints.INGEST_SAMPLE_DATA", False),
+ patch(
+ "api.settings.endpoints.TelemetryClient.send_event",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints.validate_provider_setup",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints.wait_for_langflow",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints._update_langflow_global_variables",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints._update_mcp_server_urls",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints._update_langflow_model_values",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints.config_manager.save_config_file",
+ return_value=True,
+ ) as save_config,
+ patch(
+ "api.settings.endpoints.clients.refresh_patched_client",
+ new_callable=AsyncMock,
+ ),
+ patch(
+ "api.settings.endpoints.clients.create_index_admin_opensearch_client",
+ return_value=MagicMock(),
+ ),
+ patch("main.init_index", new_callable=AsyncMock),
+ ):
+ response = await onboarding(
+ body=body,
+ flows_service=MagicMock(),
+ session_manager=AsyncMock(),
+ document_service=MagicMock(),
+ models_service=MagicMock(),
+ task_service=MagicMock(),
+ langflow_file_service=MagicMock(),
+ knowledge_filter_service=MagicMock(),
+ user=MagicMock(spec=User),
+ )
+
+ saved_config = save_config.call_args.args[0]
+ assert saved_config.knowledge.chunk_size == 500
+ assert response.chunk_size_adjusted_to == 500
diff --git a/tests/unit/enhancements/providers/watsonx/test_onprem.py b/tests/unit/enhancements/providers/watsonx/test_onprem.py
index 520d7bf30..1861c806d 100644
--- a/tests/unit/enhancements/providers/watsonx/test_onprem.py
+++ b/tests/unit/enhancements/providers/watsonx/test_onprem.py
@@ -455,6 +455,7 @@ def test_tls_setting_is_scoped_to_the_onprem_provider(monkeypatch) -> None:
assert secure["client"].ssl_verify is True
assert insecure["client"].ssl_verify is False
+ assert secure["client"] is not insecure["client"]
assert "ssl_verify" not in secure
assert "ssl_verify" not in insecure
assert watsonx_onprem.ssl_verify({"ssl_verify": "true"}) is True