Download the PHP package soderlind/loupe-semantic-search without Composer

On this page you can find all versions of the php package soderlind/loupe-semantic-search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package loupe-semantic-search

Loupe Semantic Search

Adds semantic retrieval and hybrid search to Loupe Search.

Loupe finds words. This add-on also finds meaning: a search for "cheap flights" can match a post about "budget air travel". It does that in two ways:

Requirements

Embeddings are created by your provider. Embedding all content, and each new search query, costs provider calls. Query vectors are cached, and the add-on has a per-visitor rate limit and a daily cap.

Setup

  1. Install and activate Loupe Search, the AI plugin and this plugin.
  2. Connect a provider under Settings → Connectors.
  3. Go to Settings → Loupe Search → Semantic search, choose an embedding model and save.
  4. Embedding of all posts Loupe indexes starts in the background. Follow progress on the same page or with wp loupe-semantic status.

Until content is embedded, searches return keyword results as before.

How it works

The AI plugin does the heavy lifting: it chunks each post (title and content), embeds the chunks with the connected provider, stores the vectors and keeps them current when posts change. This plugin registers an embedding consumer for the post types Loupe indexes, and applies Loupe's rules (post status, exclusions, the loupe_search_is_indexable filter) to what is embedded.

At search time the query is embedded (cached for 30 minutes), compared with stored vectors by cosine similarity, and fused with Loupe's keyword ranking:

If anything goes wrong (no model, provider slow or down, limit reached) the keyword results are returned unchanged.

Details:

Scale

Vectors live in the AI plugin's database table, which has no vector index, so every search scans all vectors of the model. That is fine up to roughly 20,000 chunks (a few thousand posts). For larger sites, plug in a vector database with the loupe_semantic_vector_store filter.

Abilities

Both require a logged-in user (read). Use loupe_semantic_ability_permission to change that.

loupe-semantic/retrieve

Input: query (required), limit (1 to 20, default 5), post_type (string or list).

stale is true when the post changed after it was embedded; text is then an excerpt.

loupe-semantic/search

Same input and output as loupe-search/search (hits, total_hits, page, total_pages), hybrid ranked, public post types only.

WP-CLI

The AI plugin's wp ai embeddings sync commands also work with the consumer loupe-semantic-search, for example wp ai embeddings sync run to process the queue now.

Filters

Filter Default Purpose
loupe_semantic_vector_store built-in scan Replace the vector search backend (Vector_Store instance).
loupe_semantic_candidates 50 Semantic matches fused with keyword hits.
loupe_semantic_query_timeout 1.5 Seconds to wait for a query embedding.
loupe_semantic_query_cache_ttl 1800 Seconds a query vector is cached.
loupe_semantic_rate_limit setting Query embeddings per minute per IP.
loupe_semantic_daily_cap setting Query embeddings per day for the site.
loupe_semantic_client_ip REMOTE_ADDR Client IP for the rate limit (e.g. behind a proxy).
loupe_semantic_ability_permission current_user_can( 'read' ) Who may run the abilities.
loupe_semantic_stale_excerpt_length 1000 Length of a stale passage excerpt.

Known limitations

Development

The code structure, request flows and invariants are described in docs/architecture.md.

License

GPL-2.0-or-later


All versions of loupe-semantic-search with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package soderlind/loupe-semantic-search contains the following files

Loading the files please wait ...