Skip to content

Conversation

@ylwu-amzn
Copy link
Collaborator

@ylwu-amzn ylwu-amzn commented Jul 31, 2025

Description

Found the tool input parsing not correct when build tutorial for Agentic RAG.

Want to use this input template "input": "{\"index\": \"${parameters.index}\", \"query\": ${parameters.query} }", for SearchIndexTool, but it will not substitute LLM generated input {"question": "Seattle 2025 population"}.

    {
      "type": "SearchIndexTool",
      "name": "retrieve_population_data",
      "description": "This tool provides recent tech news.",
      "parameters": {
        "input": "{\"index\": \"${parameters.index}\", \"query\": ${parameters.query} }",
        "index": "test_population_data",
        "query": {
          "query": {
            "neural": {
              "population_description_embedding": {
                "query_text": "${parameters.question}",
                "model_id": "<embedding_model_id>"
              }
            }
          },
          "size": 2,
          "_source": "population_description"
        }
      },

The SearchIndexTool input will always be {"question": "Seattle 2025 population"}, but we expect such input

{
  "index": "test_population_data",
  "query": {
    "query": {
      "neural": {
        "population_description_embedding": {
          "query_text": "Seattle 2025 population",
          "model_id": "<embedding_model_id>"
        }
      }
    },
    "size": 2,
    "_source": "population_description"
  }
}

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@pyek-bot
Copy link
Collaborator

pyek-bot commented Aug 1, 2025

@ylwu-amzn can we separate the PRs for the fix and the blog? that way we can get the fix reviewed and merged first and get the tutorial merged slightly later

@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env August 1, 2025 05:46 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env August 1, 2025 05:46 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env August 1, 2025 05:46 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env August 1, 2025 05:46 — with GitHub Actions Inactive
@codecov
Copy link

codecov bot commented Aug 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.66%. Comparing base (38ea2fc) to head (9655175).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4023      +/-   ##
============================================
+ Coverage     80.64%   80.66%   +0.02%     
- Complexity     8023     8027       +4     
============================================
  Files           695      695              
  Lines         35058    35064       +6     
  Branches       3942     3943       +1     
============================================
+ Hits          28271    28283      +12     
+ Misses         5052     5044       -8     
- Partials       1735     1737       +2     
Flag Coverage Δ
ml-commons 80.66% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env August 1, 2025 06:49 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os temporarily deployed to ml-commons-cicd-env August 1, 2025 06:49 — with GitHub Actions Inactive
@dhrubo-os
Copy link
Collaborator

Can we add test?

@dhrubo-os
Copy link
Collaborator

Tests are failing.

AgentUtilsTest > testConstructToolParams_ToolInputSubstitution FAILED
    org.junit.ComparisonFailure at AgentUtilsTest.java:1718
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by ai.djl.pytorch.jni.LibUtils in an unnamed module (file:/C:/Users/runneradmin/.gradle/caches/modules-2/files-2.1/ai.djl.pytorch/pytorch-engine/0.31.1/d1e4da825e942284635983d4aa7bca310b80c8eb/pytorch-engine-0.31.1.jar)
  1. Let's take update from main
  2. Can we resolve the conflict too.

@rithin-pullela-aws
Copy link
Contributor

Can a maintainer add backport 3.1 label to this?

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env August 2, 2025 03:31 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env August 2, 2025 03:31 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env August 2, 2025 03:31 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env August 2, 2025 03:31 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env August 2, 2025 04:41 — with GitHub Actions Inactive
@ylwu-amzn ylwu-amzn temporarily deployed to ml-commons-cicd-env August 2, 2025 04:41 — with GitHub Actions Inactive
@Zhangxunmt Zhangxunmt merged commit 443a405 into opensearch-project:main Aug 2, 2025
13 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 3.1 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-3.1 3.1
# Navigate to the new working tree
cd .worktrees/backport-3.1
# Create a new branch
git switch --create backport/backport-4023-to-3.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 443a4057f518f13ebec57f80314859234d302527
# Push it to GitHub
git push --set-upstream origin backport/backport-4023-to-3.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-3.1

Then, create a pull request where the base branch is 3.1 and the compare/head branch is backport/backport-4023-to-3.1.

ylwu-amzn added a commit to ylwu-amzn/ml-commons that referenced this pull request Aug 2, 2025
…roject#4023)

* enhance tool input parsing and add agentic rag tutorial

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* remove tutorial; add unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
ylwu-amzn added a commit to ylwu-amzn/ml-commons that referenced this pull request Aug 3, 2025
…roject#4023)

* enhance tool input parsing and add agentic rag tutorial

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* remove tutorial; add unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix unit test

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
mingshl pushed a commit that referenced this pull request Aug 3, 2025
* enhance tool input parsing and add agentic rag tutorial



* remove tutorial; add unit test



* fix unit test



---------

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants