From e9865901dd0eb0617fcda837d350c2b6a2cdb594 Mon Sep 17 00:00:00 2001 From: Lorenzo <57605930+lmtr0@users.noreply.github.com> Date: Fri, 18 Apr 2025 21:39:24 +0000 Subject: [PATCH 1/2] new: filter logic for a better way of filtering models --- examples/pipelines/providers/openai_manifold_pipeline.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/pipelines/providers/openai_manifold_pipeline.py b/examples/pipelines/providers/openai_manifold_pipeline.py index e46bf04..d1303a8 100644 --- a/examples/pipelines/providers/openai_manifold_pipeline.py +++ b/examples/pipelines/providers/openai_manifold_pipeline.py @@ -59,6 +59,13 @@ class Pipeline: f"{self.valves.OPENAI_API_BASE_URL}/models", headers=headers ) + allowed_models = [ + "gpt", + "o1", + "o3", + "o4", + ] + models = r.json() return [ { @@ -66,7 +73,7 @@ class Pipeline: "name": model["name"] if "name" in model else model["id"], } for model in models["data"] - if "gpt" in model["id"] or "o1" in model["id"] or "o3" in model["id"] + if any(substring in model["id"] for substring in allowed_models): ] except Exception as e: From 72768c272e965f8a038bbdaef0c044bd4b137665 Mon Sep 17 00:00:00 2001 From: Lorenzo <57605930+lmtr0@users.noreply.github.com> Date: Fri, 18 Apr 2025 21:46:29 +0000 Subject: [PATCH 2/2] fix: removed invalid syntax --- examples/pipelines/providers/openai_manifold_pipeline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pipelines/providers/openai_manifold_pipeline.py b/examples/pipelines/providers/openai_manifold_pipeline.py index d1303a8..84bc5cd 100644 --- a/examples/pipelines/providers/openai_manifold_pipeline.py +++ b/examples/pipelines/providers/openai_manifold_pipeline.py @@ -73,7 +73,7 @@ class Pipeline: "name": model["name"] if "name" in model else model["id"], } for model in models["data"] - if any(substring in model["id"] for substring in allowed_models): + if any(substring in model["id"] for substring in allowed_models) ] except Exception as e: