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] Cannot add openai embedding connector in dev tools #2498

Closed
max-tano opened this issue May 30, 2024 · 12 comments
Closed

[BUG] Cannot add openai embedding connector in dev tools #2498

max-tano opened this issue May 30, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@max-tano
Copy link

Describe the bug
When i follow the steps to add a external connector i always get a 502.

Here is a sample of a post i put in the dev console

POST /_plugins/_ml/connectors/_create
{
"name": "embedding_ada",
"description": "My connector to create embedding using ada model",
"version": "1.0",
"protocol": "http",
"parameters": {
"model": "text-embedding-ada-002"
},
"credential": {
"openAI_key": "Bearer key"
},
"actions": [
{
"action_type": "predict",
"method": "POST",
"url": "https://api.openai.com/v1/embeddings",
"headers": {
"Authorization": "Bearer ${credential.openAI_key}"
},
"request_body": "{ "input": ${parameters.input}, "model": "${parameters.model}" }",
"pre_process_function": "connector.pre_process.openai.embedding",
"post_process_function": "connector.post_process.openai.embedding"
}
]
}

An this also returns a 502 "Request failed to get to the server (status code: 502)"

Please lmk when this is fixed

A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

OpenSearch Version
Please list the version of OpenSearch being used.

Dashboards Version
Please list the version of OpenSearch Dashboards being used.

Plugins

Please list all plugins currently enabled.

Screenshots

If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Browser and version [e.g. 22]

Additional context

Add any other context about the problem here.

@max-tano max-tano added bug Something isn't working untriaged labels May 30, 2024
@manasvinibs
Copy link
Member

@opensearch-project/admin Please move this one to ML-commons repo. Thanks

@gaiksaya gaiksaya transferred this issue from opensearch-project/OpenSearch-Dashboards Jun 4, 2024
@ylwu-amzn
Copy link
Collaborator

@ylwu-amzn ylwu-amzn self-assigned this Jun 5, 2024
@max-tano
Copy link
Author

max-tano commented Jun 5, 2024

Its version 2.13 of aws managed opensearch. I tried the second tutorial but get the same 502 response, are you able to connect a external model (for example open ai ada 2)?

@ylwu-amzn
Copy link
Collaborator

@max-tano It should work, can you try the first tutorial which is much easier ?

@drobbins-ancile
Copy link

Also getting this error with version 2.13. The same code worked in 2.11.

@ylwu-amzn
Copy link
Collaborator

@drobbins-ancile , @max-tano Sorry for replying late. Let's have a call to go through the error? I tried on Amazon managed OpenSearch 2.13 by following https://github.com/opensearch-project/ml-commons/blob/2.x/docs/tutorials/aws/AIConnectorHelper.ipynb, it works.

You can join OpenSearch community slack https://join.slack.com/t/opensearch/shared_invite/zt-2kgztctzr-kVrVcH1~sq5f85DjoDqAyA, then you can find me in the public slack channel #ml

@drobbins-ancile
Copy link

drobbins-ancile commented Jun 19, 2024

@drobbins-ancile , @max-tano Sorry for replying late. Let's have a call to go through the error? I tried on Amazon managed OpenSearch 2.13 by following 2.x/docs/tutorials/aws/AIConnectorHelper.ipynb, it works.

You can join OpenSearch community slack join.slack.com/t/opensearch/shared_invite/zt-2kgztctzr-kVrVcH1~sq5f85DjoDqAyA, then you can find me in the public slack channel #ml

@ylwu-amzn The issue here seems to be specifically that we can no longer create a connector where the JSON includes a credential key.

The notebook you linked above creates a connector using sigv4 auth and calls aws bedrock.

We're creating a connector that uses http auth to call an external API like openAI or Azure and that is no longer working in version 2.13.

The connector blueprints still show this as a valid connector config but it fails when attempting to create it.

The docs also show this a valid config.

So this appears to have been broken after 2.11.

@dblock
Copy link
Member

dblock commented Jun 24, 2024

Catch All Triage - 1 2 3 4 5 6

@dblock dblock removed the untriaged label Jun 24, 2024
@ylwu-amzn
Copy link
Collaborator

ylwu-amzn commented Jul 3, 2024

If you are using AWS managed OpenSearch cluster, you should not use

"credential": {
"openAI_key": "Bearer key"
},

Check this tutorial https://github.com/opensearch-project/ml-commons/blob/2.x/docs/tutorials/aws/semantic_search_with_openai_embedding_model.md#42-create-connector, you should use

  "credential": {
    "secretArn": "your_secret_arn_created_in_step1",
    "roleArn": "your_iam_role_arn_created_in_step2"
  },

Verified on AWS managed OpenSearch cluster 2.13, this tutorial still works https://github.com/opensearch-project/ml-commons/blob/2.x/docs/tutorials/aws/AIConnectorHelper.ipynb.

@drobbins-ancile
Copy link

If you are using AWS managed OpenSearch cluster, you should not use

"credential": {
"openAI_key": "Bearer key"
},

Check this tutorial 2.x/docs/tutorials/aws/semantic_search_with_openai_embedding_model.md#42-create-connector, you should use

  "credential": {
    "secretArn": "your_secret_arn_created_in_step1",
    "roleArn": "your_iam_role_arn_created_in_step2"
  },

Verified on AWS managed OpenSearch cluster 2.13, this tutorial still works 2.x/docs/tutorials/aws/AIConnectorHelper.ipynb.

Specifying the API key directly in the credentials object is not supported after 2.11? If that is correct, do you have the PR where this support was removed?

@ylwu-amzn
Copy link
Collaborator

AWS OpenSearch 2.13 restrict only secretArn and roleArn allowed

@ylwu-amzn ylwu-amzn moved this from On-deck to In Progress in ml-commons projects Jul 3, 2024
@ylwu-amzn
Copy link
Collaborator

Close this issue as no more comment after 4 month. Please reopen or create a new issue if need more help.

@github-project-automation github-project-automation bot moved this from In Progress to Done in ml-commons projects Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

5 participants