Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Tutorial of ml_Inference processor with Cohere Rerank model seems wrong #3545

Open
ylwu-amzn opened this issue Feb 13, 2025 · 4 comments · May be fixed by #3556
Open

[Doc] Tutorial of ml_Inference processor with Cohere Rerank model seems wrong #3545

ylwu-amzn opened this issue Feb 13, 2025 · 4 comments · May be fixed by #3556

Comments

@ylwu-amzn
Copy link
Collaborator

The ML inference processor looks not correct in https://github.com/opensearch-project/ml-commons/blob/main/docs/tutorials/ml_inference/rerank/ml_Inference_with_Cohere_Rerank_model.md#1-create-reranking-pipeline

        "input_map": {
          "documents": "fact_description",
          "query": "_request.ext.query_context.query_text",
          "top_n": "_request.ext.query_context.top_n"
        },
        "output_map": {
          "relevance_score": "results[*].relevance_score",
          "description": "results[*].document.text"
        },

The input/output map should be array of objects like

        "input_map": [
           {
             "documents": "fact_description",
             "query": "_request.ext.query_context.query_text",
             "top_n": "_request.ext.query_context.top_n"
           }
         ],
        "output_map": [
           {
             "relevance_score": "results[*].relevance_score",
             "description": "results[*].document.text"
           }
        ],
@brianf-aws
Copy link
Contributor

Ill look into this. I wonder what I missed usually I test and then paste but will retry it from the top to figure out if its correct.

@brianf-aws brianf-aws linked a pull request Feb 14, 2025 that will close this issue
5 tasks
@brianf-aws
Copy link
Contributor

brianf-aws commented Feb 14, 2025

Just checked, you are correct it yields this error on creation of the pipeline

{
  "error": {
    "root_cause": [
      {
        "type": "parse_exception",
        "reason": "[input_map] property isn't a list, but of type [java.util.HashMap]",
        "processor_type": "ml_inference",
        "property_name": "input_map"
      }
    ],
    "type": "parse_exception",
    "reason": "[input_map] property isn't a list, but of type [java.util.HashMap]",
    "processor_type": "ml_inference",
    "property_name": "input_map"
  },
  "status": 400
}

Created this PR #3556 to resolve this. Thanks for pointing it out I'm trying to remember how I came up with this tutorial my hunch is that I had used OS-Flow because of how well defined the parameters are

@ylwu-amzn
Copy link
Collaborator Author

ylwu-amzn commented Feb 14, 2025

Thanks @brianf-aws , suggest redo test to check if any other issues. This is not urgent

@brianf-aws
Copy link
Contributor

Sure, makes sense. I redid the OS setup will do the managed service side eventually

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 a pull request may close this issue.

2 participants