Skip to content

feat(gsf): Add tool text_to_pql in GSF data source - #434

Merged
rapids-bot[bot] merged 2 commits into
NVIDIA-AI-Blueprints:developfrom
soumilinandi:feat/gsf-text-to-pql
Aug 11, 2026
Merged

feat(gsf): Add tool text_to_pql in GSF data source#434
rapids-bot[bot] merged 2 commits into
NVIDIA-AI-Blueprints:developfrom
soumilinandi:feat/gsf-text-to-pql

Conversation

@soumilinandi

@soumilinandi soumilinandi commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds the gsf__text_to_pql tool to the existing GSF function group. The tool calls POST /api/chat/completions with prediction: true and returns generated PQL, bounded prediction rows, response text, thoughts, and available diagnostics.

Normal AI-Q calls rely on GSF routing without specifying a database. Automated benchmarks may optionally provide database_name, which is forwarded as target_db.

The README documents the tool, API mapping, request-scoped user-token forwarding, and password-session lifecycle for development and evaluation.

DCO sign-off for the squash commit

Signed-off-by: Soumili Nandi soumilin@nvidia.com

Validation

  • .venv/bin/pytest sources/gsf/tests — 43 passed

  • .venv/bin/ruff check sources/gsf — passed

  • .venv/bin/ruff format --check sources/gsf — passed

  • git diff --check — passed

  • Pre-commit hooks, including secret detection and Markdown link checking — passed

  • I ran the relevant local checks or explained why they are not applicable.

  • I added or updated tests for behavior changes.

  • I updated documentation for user-facing or contributor-facing changes.

  • I confirmed this PR does not include secrets, credentials, or internal-only data.

  • I certify this contribution under the Developer Certificate of Origin (DCO) and signed my commits with git commit -s or an equivalent sign-off.

  • I replaced the DCO sign-off placeholder with my GitHub commit identity and kept the required angle brackets around the email address.

Where should reviewers start?

Start with text_to_pql in sources/gsf/src/gsf/client.py, its registration in sources/gsf/src/gsf/register.py, and the default versus benchmark-scoped request tests in sources/gsf/tests/test_client.py.

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Added text-to-PQL support for generating queries from natural-language requests.
    • Added optional result limits, normalized columns and rows, truncation status, and analysis metadata.
    • Preserved diagnostic details when predictions fail to produce PQL.
    • Added optional database targeting and request-scoped authentication.
  • Documentation

    • Updated GSF documentation with text-to-PQL usage, configuration, authentication behavior, and API mappings.
  • Tests

    • Expanded coverage for routing, result normalization, truncation, diagnostics, and tool registration.

Signed-off-by: Soumili Nandi <soumilin@nvidia.com>
@soumilinandi
soumilinandi requested a review from a team August 11, 2026 21:50
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 96ed304a-ed9c-4965-83cc-b3492a86947c

📥 Commits

Reviewing files that changed from the base of the PR and between 859af32 and 2e850b6.

📒 Files selected for processing (1)
  • sources/gsf/src/gsf/register.py
📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Pytest and Coverage
  • GitHub Check: Script Validation
  • GitHub Check: Lint and Hooks
🧰 Additional context used
📓 Path-based instructions (7)
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Do not include secrets, credentials, private hostnames, internal-only logs, customer data, or generated local artifacts.
Add or update tests for behavior changes.

**/*: For substantial behavior, authentication, UI, or architecture changes, open a design discussion before coding rather than landing a large unreviewed change.
Keep changes scoped to this repository and avoid editing adjacent repositories; treat each sources/* package independently and prefer the smallest package-scoped change.
Keep pull requests scoped, avoid unrelated files and generated artifacts, provide validation evidence, and ensure every commit has DCO sign-off.

Files:

  • sources/gsf/src/gsf/register.py
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.py: Run uv run ruff check . and uv run ruff format --check . for root Python changes.
Run uv run pytest for root project Python changes.

Files:

  • sources/gsf/src/gsf/register.py
**/*.{py,pyi}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{py,pyi}: Format and lint Python code with Ruff using line length 120, Python 3.11 targeting, rules E, F, W, I, PL, and UP, with single-line imports; do not reformat unrelated code.
Missing-secret paths must degrade gracefully by stubbing or skipping rather than crashing or leaking secrets.

Files:

  • sources/gsf/src/gsf/register.py
sources/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

sources/**/*.py: Implement new tools and data sources as NeMo Agent Toolkit functions registered with @register_function; configuration schemas must inherit from FunctionBaseConfig.
Register new data sources in data_source_registry so the UI can toggle them.

Files:

  • sources/gsf/src/gsf/register.py
**/*.{py,pyi,js,jsx,ts,tsx,yml,yaml,json,env,md}

📄 CodeRabbit inference engine (AGENTS.md)

Never commit secrets, tokens, or environment-specific hostnames; use environment variables and SecretStr, and resolve API keys at runtime.

Files:

  • sources/gsf/src/gsf/register.py
**/*.{py,pyi,js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never print or log secret values, including in tool output or error messages.

Files:

  • sources/gsf/src/gsf/register.py
{src/aiq_agent/knowledge/**,sources/**}

⚙️ CodeRabbit configuration file

{src/aiq_agent/knowledge/**,sources/**}: Review data-source and knowledge-layer changes for optional dependency boundaries, external API error handling,
retry/rate-limit behavior, deterministic tests, and registration consistency. New source packages should include
package metadata, plugin registration when applicable, and source-level tests.

Files:

  • sources/gsf/src/gsf/register.py
🧠 Learnings (1)
📚 Learning: 2026-08-11T06:34:44.687Z
Learnt from: AjayThorve
Repo: NVIDIA-AI-Blueprints/aiq PR: 429
File: src/aiq_agent/agents/deep_researcher/register.py:302-307
Timestamp: 2026-08-11T06:34:44.687Z
Learning: In Python logging code that handles potentially sensitive exceptions, do not add `exc_info=True` solely to restore stack traces, because standard traceback formatting includes `str(exception)` and may expose provider, customer, or credential-bearing content. When sensitive-content redaction is required, log the exception type together with `log_content_metadata(exception)` instead.

Applied to files:

  • sources/gsf/src/gsf/register.py
🔇 Additional comments (2)
sources/gsf/src/gsf/register.py (2)

28-28: LGTM!

Also applies to: 95-99, 128-132, 157-161, 169-196


211-216: 🎯 Functional Correctness

Keep the current registration. @register_function_group with FunctionGroup.add_function("text_to_pql", ...) correctly exposes gsf__text_to_pql, and sources/gsf/tests/test_register.py covers this name.

			> Likely an incorrect or invalid review comment.

Walkthrough

GSF adds prediction-based text_to_pql support. Requests support optional benchmark database scope and row limits. Responses preserve diagnostics, result data, metadata, and truncation state. The new tool is registered with authentication and error handling.

Changes

GSF text-to-PQL prediction

Layer / File(s) Summary
Prediction contract and response normalization
sources/gsf/src/gsf/models.py, sources/gsf/src/gsf/client.py, sources/gsf/tests/*
Requests support max_rows and optional database_name. Responses allow missing PQL and include diagnostics, columns, rows, truncation, and custom analysis metadata.
text_to_pql tool exposure
sources/gsf/src/gsf/register.py, sources/gsf/tests/test_register.py
The function group exposes gsf__text_to_pql with authentication, trace headers, response serialization, and structured errors.
GSF configuration and API documentation
sources/gsf/README.md
The README documents text-to-PQL, authentication lifecycle, token forwarding, routing, and optional database targeting.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant text_to_pql
  participant GSFClient
  participant GSFAPI
  Caller->>text_to_pql: Submit prediction request
  text_to_pql->>GSFClient: Forward request and authentication
  GSFClient->>GSFAPI: Send prediction query
  GSFAPI-->>GSFClient: Return PQL, diagnostics, and result data
  GSFClient-->>text_to_pql: Return normalized response
  text_to_pql-->>Caller: Serialize response or structured error
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses valid Conventional Commits syntax, clearly describes the new GSF tool, and is 50 characters without a trailing period.
Description check ✅ Passed The description includes the required overview, DCO sign-off, validation results, reviewer guidance, and related-issues section.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sources/gsf/src/gsf/register.py`:
- Around line 177-178: Update the exception handler in the GSF text-to-PQL
failure path to stop using logger.exception, which emits raw traceback and
message content. Log only the exception type together with redacted metadata
from log_content_metadata(exception), preserving the existing unexpected-failure
handling without exposing exception details.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 8f57cce6-b8b6-4ab0-848b-f10b4073f9c5

📥 Commits

Reviewing files that changed from the base of the PR and between 59c5e54 and 859af32.

📒 Files selected for processing (8)
  • sources/gsf/README.md
  • sources/gsf/src/gsf/client.py
  • sources/gsf/src/gsf/models.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Pytest and Coverage
  • GitHub Check: Script Validation
  • GitHub Check: Lint and Hooks
🧰 Additional context used
📓 Path-based instructions (7)
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Do not include secrets, credentials, private hostnames, internal-only logs, customer data, or generated local artifacts.
Add or update tests for behavior changes.

**/*: For substantial behavior, authentication, UI, or architecture changes, open a design discussion before coding rather than landing a large unreviewed change.
Keep changes scoped to this repository and avoid editing adjacent repositories; treat each sources/* package independently and prefer the smallest package-scoped change.
Keep pull requests scoped, avoid unrelated files and generated artifacts, provide validation evidence, and ensure every commit has DCO sign-off.

Files:

  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/README.md
  • sources/gsf/src/gsf/models.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/src/gsf/client.py
**/*.py

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.py: Run uv run ruff check . and uv run ruff format --check . for root Python changes.
Run uv run pytest for root project Python changes.

Files:

  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/src/gsf/models.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/src/gsf/client.py
**/*.{py,pyi}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{py,pyi}: Format and lint Python code with Ruff using line length 120, Python 3.11 targeting, rules E, F, W, I, PL, and UP, with single-line imports; do not reformat unrelated code.
Missing-secret paths must degrade gracefully by stubbing or skipping rather than crashing or leaking secrets.

Files:

  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/src/gsf/models.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/src/gsf/client.py
sources/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

sources/**/*.py: Implement new tools and data sources as NeMo Agent Toolkit functions registered with @register_function; configuration schemas must inherit from FunctionBaseConfig.
Register new data sources in data_source_registry so the UI can toggle them.

Files:

  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/src/gsf/models.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/src/gsf/client.py
**/*.{py,pyi,js,jsx,ts,tsx,yml,yaml,json,env,md}

📄 CodeRabbit inference engine (AGENTS.md)

Never commit secrets, tokens, or environment-specific hostnames; use environment variables and SecretStr, and resolve API keys at runtime.

Files:

  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/README.md
  • sources/gsf/src/gsf/models.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/src/gsf/client.py
**/*.{py,pyi,js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never print or log secret values, including in tool output or error messages.

Files:

  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/src/gsf/models.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/src/gsf/client.py
{src/aiq_agent/knowledge/**,sources/**}

⚙️ CodeRabbit configuration file

{src/aiq_agent/knowledge/**,sources/**}: Review data-source and knowledge-layer changes for optional dependency boundaries, external API error handling,
retry/rate-limit behavior, deterministic tests, and registration consistency. New source packages should include
package metadata, plugin registration when applicable, and source-level tests.

Files:

  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/README.md
  • sources/gsf/src/gsf/models.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/src/gsf/client.py
🧠 Learnings (1)
📚 Learning: 2026-08-11T06:34:44.687Z
Learnt from: AjayThorve
Repo: NVIDIA-AI-Blueprints/aiq PR: 429
File: src/aiq_agent/agents/deep_researcher/register.py:302-307
Timestamp: 2026-08-11T06:34:44.687Z
Learning: In Python logging code that handles potentially sensitive exceptions, do not add `exc_info=True` solely to restore stack traces, because standard traceback formatting includes `str(exception)` and may expose provider, customer, or credential-bearing content. When sensitive-content redaction is required, log the exception type together with `log_content_metadata(exception)` instead.

Applied to files:

  • sources/gsf/tests/test_models.py
  • sources/gsf/tests/test_register.py
  • sources/gsf/src/gsf/register.py
  • sources/gsf/tests/conftest.py
  • sources/gsf/src/gsf/models.py
  • sources/gsf/tests/test_client.py
  • sources/gsf/src/gsf/client.py
🔇 Additional comments (18)
sources/gsf/src/gsf/models.py (2)

80-87: LGTM!


110-119: LGTM!

sources/gsf/src/gsf/client.py (2)

180-193: LGTM!


568-606: LGTM!

sources/gsf/tests/conftest.py (2)

73-77: LGTM!


126-131: LGTM!

sources/gsf/tests/test_models.py (2)

81-88: LGTM!


128-131: LGTM!

sources/gsf/tests/test_client.py (3)

227-253: LGTM!


256-278: LGTM!


281-302: LGTM!

sources/gsf/src/gsf/register.py (2)

28-28: LGTM!


160-185: 📐 Maintainability & Code Quality

Keep text_to_pql in the function group registration.

@register_function_group registers the builder, and FunctionGroup.add_function registers its individual tools. Do not add @register_function to the nested function.

			> Likely an incorrect or invalid review comment.
sources/gsf/tests/test_register.py (2)

13-13: LGTM!


97-109: LGTM!

sources/gsf/README.md (3)

6-18: LGTM!


28-28: LGTM!


45-72: LGTM!

Comment thread sources/gsf/src/gsf/register.py Outdated
@soumilinandi soumilinandi changed the title feat(GSF): Add tool text_to_pql in GSF data source feat(gsf): Add tool text_to_pql in GSF data source Aug 11, 2026
Signed-off-by: Soumili Nandi <soumilin@nvidia.com>
@soumilinandi

Copy link
Copy Markdown
Contributor Author

/ok to test 2e850b6

@cdgamarose-nv cdgamarose-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@soumilinandi

Copy link
Copy Markdown
Contributor Author

/merge

1 similar comment
@soumilinandi

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 2ffe0c8 into NVIDIA-AI-Blueprints:develop Aug 11, 2026
20 of 23 checks passed
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.

2 participants