alessandrobenedetti commented on code in PR #2809: URL: https://github.com/apache/solr/pull/2809#discussion_r1832545720
########## solr/solr-ref-guide/modules/query-guide/pages/embedding-text.adoc: ########## @@ -0,0 +1,280 @@ += Embedding Text +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +With the *Large Language Model* (or *LLM* for short) module you can interact with Large Language Models in Solr to encode text to vectors at indexing and query time. + + +== Text Embedding Concepts + +=== From Text to Vector + +The task of sentence similarity aims to encode text to vector in a way that sentences semantically similar are encoded to vectors close in a vector space (using a vector distance metric). + + +=== Large Language Models + +Large Language Models can be fine-tuned for such task. +The resulting model is able to encode text to a numerical vector. + +For additional information you can refer to this https://sease.io/2021/12/using-bert-to-improve-search-relevance.html[blog post]. + +==== Embedding Services + +Training, fine-tuning and operating such Large Language Models is expensive. + +Many companies focus on this aspect and let users access APIs to encode the text (at the price of a license fee). + +Apache Solr uses LangChain4j (add link here) to connect to such apis. + +[IMPORTANT] +==== +At the moment a subset of the embedding models supported by LangChain4j is supported by Solr. + +*Disclaimer*: Apache Solr is *in no way* affiliated to any of these corporations or services. + +If you want to add support for additional services or improve the support for the existing ones, feel free to contribute: + +* https://github.com/apache/solr/blob/main/CONTRIBUTING.md[Contributing to Solr] +==== + +== Module + +This is provided via the `llm` xref:configuration-guide:solr-modules.adoc[Solr Module] that needs to be enabled before use. + +At the moment the only supported way to interact with Large Language Models is via embedding text. + +In the future additional components to empower Solr with LLM will be added. + +== Installation of LLM + +The llm module requires the `modules/ltr/lib/solr-llm-*.jar` JARs. + +== LLM Configuration + +Large-Language-Model is a module and therefore its plugins must be configured in `solrconfig.xml`. + +=== Minimum Requirements + +* Include the required module JARs. +Note that by default paths are relative to the Solr core, so they may need adjustments to your configuration, or an explicit specification of the `$solr.install.dir`. ++ +[source,xml] +---- +<lib dir="${solr.install.dir:../../../..}/modules/llm/lib/" regex=".*\.jar" /> +---- Review Comment: Done! -- 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-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org