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

[ML] Missing chunkers for AzureOpenAIService, AzureAIStudioService and HuggingFace embeddings #109875

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

davidkyle
Copy link
Member

Adds chunking for AzureOpenAIService, AzureAIStudioService and the HuggingFace text embedding service. HuggingFace ELSER is not chunked.

@davidkyle davidkyle marked this pull request as ready for review June 18, 2024 16:13
@elasticsearchmachine elasticsearchmachine added the Team:ML Meta label for the ML team label Jun 18, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

@davidkyle
Copy link
Member Author

@elasticmachine update branch

@davidkyle
Copy link
Member Author

@elasticmachine update branch

@maxhniebergall maxhniebergall self-requested a review June 18, 2024 18:06
Copy link
Member

@maxhniebergall maxhniebergall left a comment

Choose a reason for hiding this comment

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

LGTM

return List.of(new ErrorChunkedInferenceResults(error.getException()));
if (model instanceof AzureAiStudioModel baseAzureAiStudioModel) {
var actionCreator = new AzureAiStudioActionCreator(getSender(), getServiceComponents());
var batchedRequests = new EmbeddingRequestChunker(input, EMBEDDING_MAX_BATCH_SIZE, EmbeddingRequestChunker.EmbeddingType.FLOAT)
Copy link
Member

Choose a reason for hiding this comment

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

how do we know that the AzureAiStudioModel only uses FLOAT types?

Copy link
Contributor

@jonathan-buttner jonathan-buttner Jun 18, 2024

Choose a reason for hiding this comment

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

Looks like the response format is the same as openai which I believe supports float and base64. Elasticsearch only supports float and byte at the moment though.

* For HuggingFace use a conservatively small max batch size as it is
* unknown how the model is deployed
*/
static final int EMBEDDING_MAX_BATCH_SIZE = 20;
Copy link
Member

Choose a reason for hiding this comment

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

If the optimal batch size depends on the hardware, then I think we should make this user configurable. I think we can do that in a future PR if you want to get this one out now.

@davidkyle davidkyle merged commit b60d77e into elastic:main Jun 19, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:ml Machine learning >non-issue Team:ML Meta label for the ML team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants