Skip to content

function_openai_responses.ResponsesBody() got multiple values for keyword argument 'user' #718

@pascal-sidlee

Description

@pascal-sidlee

Hi,

On the main branch.

If we use a custom Filter who adds a "user" in body, when the pipeline openai_responses_manifold.pyis used, we get this error: function_openai_responses.ResponsesBody() got multiple values for keyword argument 'user'.

If we add this check, everything is working succesfully:

# Start at Line 653

# Transform request body (Completions API -> Responses API).
completions_body = CompletionsBody.model_validate(body)

# Check if 'user' already exists in the body to avoid duplication
has_user = hasattr(completions_body, "user") or "user" in body

responses_body = ResponsesBody.from_completions(
    completions_body=completions_body,
    # If chat_id and openwebui_model_id are provided, from_completions() uses them to fetch previously persisted items (function_calls, reasoning, etc.) from DB and reconstruct the input array in the correct order.
    **(
        {"chat_id": __metadata__["chat_id"]}
        if __metadata__.get("chat_id")
        else {}
    ),
    **(
        {"openwebui_model_id": openwebui_model_id} if openwebui_model_id else {}
    ),
    # Additional optional parameters passed directly to ResponsesBody without validation. Overrides any parameters in the original body with the same name.
    truncation=valves.TRUNCATION,
    **({"user": user_identifier} if not has_user else {}),  # Only add user if not already present
    service_tier=valves.SERVICE_TIER,
    **(
        {"max_tool_calls": valves.MAX_TOOL_CALLS}
        if valves.MAX_TOOL_CALLS is not None
        else {}
    ),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions