[GH-ISSUE #5883] Make metadata.chat_id available in custom pipeline #14159

Closed
opened 2026-04-19 20:36:46 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @weixu365 on GitHub (Oct 3, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/5883

Is your feature request related to a problem? Please describe.

I'm integrating open-webui with AWS Bedrock Agents using bedrock_agent_runtime.invoke_agent() in a custom pipeline. This method requires a sessionId parameter, as the Bedrock Agent manages the chat session.

I would like to use chat_id as the sessionId, but it's no longer available in the pipeline.pipe() method. The metadata field, where this information was previously stored, was removed 3 months ago in commit f462744.

Describe the solution you'd like

I propose restoring the metadata field from the payload at: https://github.com/open-webui/open-webui/blob/main/backend/open_webui/apps/openai/main.py#L383-L384

Describe alternatives you've considered

If reintroducing the metadata field could cause other issues, I suggest adding an environment variable, such as ENABLE_PIPELINE_METADATA. When this variable is not set or set to false, the default behavior (without metadata) would remain unchanged, while enabling it would send the field to custom pipelines

Additional context
None

Originally created by @weixu365 on GitHub (Oct 3, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/5883 **Is your feature request related to a problem? Please describe.** I'm integrating open-webui with AWS Bedrock Agents using bedrock_agent_runtime.invoke_agent() in a custom pipeline. This method requires a sessionId parameter, as the Bedrock Agent manages the chat session. I would like to use chat_id as the sessionId, but it's no longer available in the pipeline.pipe() method. The metadata field, where this information was previously stored, was removed 3 months ago in commit [f462744](https://github.com/open-webui/open-webui/commit/f462744#diff-84fe56d58871cf1f81dfe7cc81a247f1f61226cf2a152e95c8ee06c13d83f28fR360). **Describe the solution you'd like** I propose restoring the metadata field from the payload at: https://github.com/open-webui/open-webui/blob/main/backend/open_webui/apps/openai/main.py#L383-L384 **Describe alternatives you've considered** If reintroducing the metadata field could cause other issues, I suggest adding an environment variable, such as `ENABLE_PIPELINE_METADATA`. When this variable is not set or set to false, the default behavior (without metadata) would remain unchanged, while enabling it would send the field to custom pipelines **Additional context** None
Author
Owner

@weixu365 commented on GitHub (Oct 3, 2024):

Solved by adding to a custom field in body:

    async def inlet(self, body: dict, user: Optional[dict] = None) -> dict:
        body["pipeline_metadata"] = {"chat_id": body["chat_id"]}

        return body
<!-- gh-comment-id:2392513269 --> @weixu365 commented on GitHub (Oct 3, 2024): Solved by adding to a custom field in body: ``` async def inlet(self, body: dict, user: Optional[dict] = None) -> dict: body["pipeline_metadata"] = {"chat_id": body["chat_id"]} return body ```
Author
Owner

@codysandahl commented on GitHub (Jan 4, 2025):

For future people, if you need to get the extra metadata to the Pipelines server, I wrote a Pipe to package the info into the body and send it to Pipelines.
https://openwebui.com/f/codysandahl/pipeline_enriched_with_metadata

<!-- gh-comment-id:2570164906 --> @codysandahl commented on GitHub (Jan 4, 2025): For future people, if you need to get the extra metadata to the Pipelines server, I wrote a Pipe to package the info into the body and send it to Pipelines. https://openwebui.com/f/codysandahl/pipeline_enriched_with_metadata
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#14159