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

[BUG] need fix #2655 for RAGTool to handle pure json response #470

Open
layavadi opened this issue Nov 25, 2024 · 5 comments
Open

[BUG] need fix #2655 for RAGTool to handle pure json response #470

layavadi opened this issue Nov 25, 2024 · 5 comments
Assignees
Labels
bug Something isn't working untriaged

Comments

@layavadi
Copy link

layavadi commented Nov 25, 2024

What is the bug?

When connecting to OpenAI model for chat response getting following error while processing the response
TransportError(500, '{"error":{"reason":"System Error","details":"Cannot invoke \"org.opensearch.ml.common.output.Output.toXContent(org.opensearch.core.xcontent.XContentBuilder, org.opensearch.core.xcontent.ToXContent$Params)\" because \"this.output\" is null","type":"NullPointerException"},"status":500}', None)
This is because issue found in opensearch-project/ml-commons#2654

How can one reproduce the bug?

Same as opensearch-project/ml-commons#2654 where we use the RAGTool to connect openAI using connector with
"actions": [
{
"action_type": "predict",
"method": "POST",
"url": "https://${parameters.endpoint}/openai/deployments/${parameters.model}/chat/completions?api-version=${parameters.api_version}",
"headers": {
"api-key": "${credential.openAI_key}",
"Content-type": "application/json"
},
"request_body": "{ "model": "${parameters.model}", "messages": [ { "role":"user" , "content": " ${parameters.prompt} " } ] }"
}

and execute

body = {
"parameters": {
"question": query
}
}
response_str = ""
combined_response = ""
try:
response = client.http.post(f'/_plugins/_ml/agents/{agent_id}/_execute', body=body)

What is the expected behavior?

It is expected to fetch the response from OpenAI model .

What is your host/environment?

Docker image of OS running on MacOS

Do you have any screenshots?

Getting error while calling the client.http/post

TransportError(500, '{"error":{"reason":"System Error","details":"Cannot invoke \"org.opensearch.ml.common.output.Output.toXContent(org.opensearch.core.xcontent.XContentBuilder, org.opensearch.core.xcontent.ToXContent$Params)\" because \"this.output\" is null","type":"NullPointerException"},"status":500}', None)

Do you have any additional context?

This issue similar to opensearch-project/ml-commons#2654

And needs same fix Earlier for MLTool

https://github.com/opensearch-project/ml-commons/blob/f9cbf15edcf885fa3f64dbb39a467c29604bbc5c/ml-algorithms/src/main/java/org/opensearch/ml/engine/tools/MLModelTool.java#L72

in RAGTool

return mlModelOutputs.get(0).getMlModelTensors().get(0).getDataAsMap().get("response");

@layavadi layavadi added bug Something isn't working untriaged labels Nov 25, 2024
@dblock dblock transferred this issue from opensearch-project/.github Nov 25, 2024
@pyek-bot
Copy link

Hi, Thanks for reporting the bug! Would you like to try and fix it? @layavadi

@layavadi
Copy link
Author

layavadi commented Nov 26, 2024 via email

@pyek-bot
Copy link

Hi @layavadi, no rush - please take your time. I only wanted to understand if you were working on it so we don't duplicate effort and can assign this issue to you. Next time you start working on an issue, please comment on the issue and one of the maintainers will assign the task to you!

Thank you for your contribution! Appreciate it!

@mingshl Can you assign this to @layavadi please?

@dhrubo-os dhrubo-os transferred this issue from opensearch-project/ml-commons Dec 3, 2024
@dhrubo-os dhrubo-os moved this to In Progress in ml-commons projects Dec 3, 2024
@mingshl
Copy link
Contributor

mingshl commented Dec 3, 2024

Hi @layavadi are you going to raise PR for this fix? we should follow similar fix to MLModelTool.

https://github.com/opensearch-project/ml-commons/pull/2655/files#diff-025c5b7117288bef7c3896a2596cf6575464c37390ed27c1663a1e73048547fdR70-R81

We moved the issue to skill repo because RAGTool lives in skills repo.

If you have a PR, I will be happy to help review. please let me know. Thanks!

@layavadi
Copy link
Author

layavadi commented Dec 4, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
Status: In Progress
Development

No branches or pull requests

4 participants