You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "renatoh (via GitHub)" <gi...@apache.org> on 2025/08/14 19:17:01 UTC
[PR] Custom embedding model (draft) [solr]
renatoh opened a new pull request, #3476:
URL: https://github.com/apache/solr/pull/3476
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model (draft) [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #3476:
URL: https://github.com/apache/solr/pull/3476#discussion_r2328958032
##########
solr/modules/llm/src/java/org/apache/solr/llm/textvectorisation/model/CustomModel.java:
##########
@@ -0,0 +1,110 @@
+package org.apache.solr.llm.textvectorisation.model;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import dev.langchain4j.data.embedding.Embedding;
+import dev.langchain4j.data.segment.TextSegment;
+import dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel;
+import dev.langchain4j.model.output.Response;
+import java.io.IOException;
+import java.time.Duration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
Review Comment:
I recommend the HttpClient in the JDK instead. Modern Java.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model (draft) [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #3476:
URL: https://github.com/apache/solr/pull/3476#issuecomment-3189665377
Hi @alessandrobenedetti
I am curious, if you think any of these customization could have the potential to be merged. It is all pretty rough at the moment and some refinement had to be done.
I have added:
- Using custom endpoint for vectorization
- Doing lazy vectorization by comparing content of new fields with the existing value
- Combining multiple fields into one vector
Thanks for your input!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model [solr]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3476:
URL: https://github.com/apache/solr/pull/3476#issuecomment-5137722408
This PR is now closed due to 60 days of inactivity after being marked as stale. Re-opening this PR is still possible, in which case it will be marked as active again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model [solr]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #3476: Custom embedding model
URL: https://github.com/apache/solr/pull/3476
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #3476:
URL: https://github.com/apache/solr/pull/3476#issuecomment-3896213731
> Is there a standard / convention API for doing an embedding over HTTP?
@dsmiley
I don't think there is, as far as I understand that is the reason why Solr uses langchain4j. This lib has integration to the different provides like huggingface, cohere,etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #3476:
URL: https://github.com/apache/solr/pull/3476#issuecomment-4162222549
@epugh Hi Eric,
That is the PR I've mention, basically It does this:
- Using custom endpoint for vector embedding
- Doing lazy vectorization by comparing content of new fields with the existing value
- Combining multiple fields into one vector
Would be good to get your feedback on that one.
Thanks
Renato
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model [solr]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3476:
URL: https://github.com/apache/solr/pull/3476#issuecomment-4585279519
This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the dev@solr.apache.org mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model (draft) [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #3476:
URL: https://github.com/apache/solr/pull/3476#discussion_r2328955633
##########
solr/modules/llm/src/java/org/apache/solr/llm/textvectorisation/model/CustomModel.java:
##########
@@ -0,0 +1,110 @@
+package org.apache.solr.llm.textvectorisation.model;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import dev.langchain4j.data.embedding.Embedding;
+import dev.langchain4j.data.segment.TextSegment;
+import dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel;
+import dev.langchain4j.model.output.Response;
+import java.io.IOException;
+import java.time.Duration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
Review Comment:
No; let's please not use Apache HttpClient
https://issues.apache.org/jira/browse/SOLR-16367
##########
solr/modules/llm/src/java/org/apache/solr/llm/textvectorisation/update/processor/TextToVectorUpdateProcessorFactory.java:
##########
@@ -70,13 +70,11 @@ public void init(final NamedList<?> args) {
public UpdateRequestProcessor getInstance(
SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) {
IndexSchema latestSchema = req.getCore().getLatestSchema();
-
- if (!latestSchema.isDynamicField(inputField) && !latestSchema.hasExplicitField(inputField)) {
+ if (!latestSchema.hasExplicitField(inputField)) {
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "undefined field: \"" + inputField + "\"");
}
-
- if (!latestSchema.isDynamicField(outputField) && !latestSchema.hasExplicitField(outputField)) {
+ if (!latestSchema.hasExplicitField(outputField)) {
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "undefined field: \"" + outputField + "\"");
}
Review Comment:
I don't know why these checks are here _at all_. `org.apache.solr.schema.IndexSchema#getField` (called immediately below) is going to throw an exception with a specific error message about the field being undefined.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Custom embedding model (draft) [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #3476:
URL: https://github.com/apache/solr/pull/3476#issuecomment-3580079436
> Is there a standard / convention API for doing an embedding over HTTP?
i don't think there is. with that approach endpoint and input-text field can be configured in the model and it expects an array of floats back.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org