Skip to content

filter pipeline with valves without pipelines value breaks the pipelines #538

@sancelot

Description

@sancelot

I created an hybrid search pipeline. (The reason is that the server that runs open-webui has not gpu resources so, I have to offload it to machines supporting it,that may be not the right way to do it ?)

I create it as follow with valves but without pipelines parameters.

the application fails with the next logs.

I have not pushed a PR, but to correct it, you have to add parenthesis around in main.py :
"pipelines": (
pipeline.valves.pipelines
if (hasattr(pipeline, "valves")
and hasattr(pipeline.valves, "pipelines"))

else []
),

but that sounds a bit more complicated, because it then crashes int get_models()

At the moment, there are few things i have not understood with this pipelines variable intended usage .

exemple pipeline Valves crashing it :

class Pipeline:
    class Valves(BaseModel):
        # Pipeline configuration
        PIPELINE_NAME: str = "Hybrid Search Pipeline"
        HYBRID_SEARCH_API_URL: str = "https://your-hybrid-search-service.com/api/v1"
        HYBRID_SEARCH_API_KEY: str = ""
        BM25_WEIGHT: float = 0.5
        VECTOR_WEIGHT: float = 0.5
        RERANK_ENABLED: bool = True
        RERANK_TOP_K: int = 10
        MIN_RELEVANCE_SCORE: float = 0.0
        REQUEST_TIMEOUT: int = 30

    def __init__(self):
        self.type = "filter"
        self.name = "Hybrid Search"
        self.valves = self.Valves()
        .......

: 10.1.42.88:36712 - "GET /models HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette_utils.py", line 87, in collapse_excgroups
    | yield
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\base.py", line 190, in call
    | async with anyio.create_task_group() as task_group:
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\anyio_backends_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 435, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\fastapi\applications.py", line 1054, in call
    | await super().call(scope, receive, send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\applications.py", line 123, in call
    | await self.middleware_stack(scope, receive, send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\errors.py", line 186, in call
    | raise exc
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\base.py", line 189, in call
    | with collapse_excgroups():
    | File "C:\Users\sancelot\AppData\Roaming\uv\python\cpython-3.11.11-windows-x86_64-none\Lib\contextlib.py", line 158, in exit
    | self.gen.throw(typ, value, traceback)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette_utils.py", line 93, in collapse_excgroups
    | raise exc
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\base.py", line 191, in call
    | response = await self.dispatch_func(request, call_next)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "E:\WORKSPACE\pipelines\main.py", line 287, in check_url
    | response = await call_next(request)
    | ^^^^^^^^^^^^^^^^^^^^^^^^
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\base.py", line 165, in call_next
    | raise app_exc
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\base.py", line 151, in coro
    | await self.app(scope, receive_or_disconnect, send_no_error)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\cors.py", line 85, in call
    | await self.app(scope, receive, send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 65, in call
    | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
    | raise exc
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
    | await app(scope, receive, sender)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\routing.py", line 756, in call
    | await self.middleware_stack(scope, receive, send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\routing.py", line 776, in app
    | await route.handle(scope, receive, send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\routing.py", line 297, in handle
    | await self.app(scope, receive, send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\routing.py", line 77, in app
    | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
    | raise exc
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
    | await app(scope, receive, sender)
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\starlette\routing.py", line 72, in app
    | response = await func(request)
    | ^^^^^^^^^^^^^^^^^^^
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\fastapi\routing.py", line 278, in app
    | raw_response = await run_endpoint_function(
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\fastapi\routing.py", line 191, in run_endpoint_function
    | return await dependant.call(**values)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "E:\WORKSPACE\pipelines\main.py", line 302, in get_models
    | "data": [
    | ^
    | File "E:\WORKSPACE\pipelines\main.py", line 314, in
    | pipeline["valves"].pipelines
    | File "E:\WORKSPACE\pipelines.venv\Lib\site-packages\pydantic\main.py", line 811, in getattr
    | raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
    | AttributeError: 'Valves' object has no attribute 'pipelines'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions