Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

Numeric values (int/float) in rank_properties were being incorrectly wrapped in quotes in the generated schema, violating Vespa schema syntax.

Before:

RankProfile(
    name="default",
    first_phase="closeness(label,nns)",
    rank_properties=[
        ("approximate-threshold", 0.05),
        ("filter-first-threshold", 0.0),
    ],
)

Generated:

rank-properties {
    approximate-threshold: "0.05"
    filter-first-threshold: "0.0"
}

After:

rank-properties {
    approximate-threshold: 0.05
    filter-first-threshold: 0.0
}

Changes

  • Modified vespa/templates/schema.txt to conditionally quote rank_properties values using Jinja2's is number test
    • Numeric values (int, float) render unquoted
    • String values remain quoted
  • Added unit tests covering numeric-only, string-only, and mixed-type scenarios
Original prompt

This section details on the original issue you should resolve

<issue_title>Do not wrap rank_properties with float/int-type in quotes</issue_title>
<issue_description>Current behavior:

# Define the rank profile with HNSW tuning parameters
rank_profile = RankProfile(
    name="default",
    first_phase="closeness(label,nns)",
    rank_properties=[
        ("approximate-threshold", 0.05),
        ("filter-first-threshold", 0.0),
        ("filter-first-exploration", 0.3),
        ("exploration-slack", 0.0),
    ],
)

generates schema like:

rank-profile default {
        first-phase {
            expression {
                closeness(label,nns)
            }
        }
        rank-properties {
            approximate-threshold: "0.05"
            filter-first-threshold: "0.0"
            filter-first-exploration: "0.3"
            exploration-slack: "0.0"
        }
    }

Still can be deployed and works, but we should avoid quoting for numeric values.
Maybe this is done several places as well.

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix rank properties quoting issue in RankProfile Fix rank_properties to not quote numeric values Nov 5, 2025
Copilot AI requested a review from oyving November 5, 2025 11:51
Copilot finished work on behalf of oyving November 5, 2025 11:51
@thomasht86 thomasht86 marked this pull request as ready for review November 11, 2025 07:11
@thomasht86 thomasht86 self-requested a review November 11, 2025 07:11
@thomasht86 thomasht86 merged commit 746c5a2 into master Nov 11, 2025
33 checks passed
@thomasht86 thomasht86 deleted the copilot/fix-rank-properties-quotes branch November 11, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not wrap rank_properties with float/int-type in quotes

3 participants