Italy
Account created on 24 April 2007, almost 18 years ago
#

Merge Requests

More

Recent comments

🇮🇹Italy lussoluca Italy

No answer from the actual maintainer since October 24, 2025.
I'm proposing to be the new maintainer for the Panther module ( https://www.drupal.org/project/panther ).

🇮🇹Italy lussoluca Italy

lussoluca changed the visibility of the branch 3496732-add-support-for to hidden.

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

Thanks, James, for your questions; I'll try to answer them below.

What do they mean by "re-rank" in this context.

This article explains in depth what I mean by re-ranking: https://www.pinecone.io/learn/series/rag/rerankers/
It is a two-step process to enhance the result of a vector-based search. Some vector databases (like Pinecone) implement a re-ranking feature, but always in the second step, after you've retrieved an initial set of documents by using some kind of search.

Could you help explain the context by giving a specific real-world use-case?

I'm implementing a site where the client needs to find the best image between thousands. We saw that using a re-ranking algorithm on the retrieved results improved the quality of the result (we're using Cohere for that).

How would this be used by the AI module specifically, how would Search API / ai Search or Assistants make use of this or is it intended for other things?

Why use "operation type" as the abstraction here.

I've implemented it as an operation type because (as for embedding or chat) you can use different algorithms from a different provider to perform a re-rank. You can use a generic LLM for that; take a look, for example, how LLPhant implements re-ranking: https://github.com/theodo-group/LLPhant/blob/main/src/Query/SemanticSear...
As you wrote later, probably it makes sense to also expose this feature as a Search API postprocess_query processor plugin. However, I do not want to limit it to Search API only, as I may have retrieved the set of documents to re-rank from a different source.

Is there anything else cohere can do?

Yes, it can also be used to compute embeddings. I plan to add this feature to the ai_provider_cohere module.

Where would this fit within the UI of the things we currently do?

I think that re-ranking is not something the final users may be aware of. It can be limited to the processor configuration page from Search API.

Also I think it might need to be AI_Reranking as reranking is a common thing for search that doesn't use AI a lot of the time right? It just uses a variety of algorithms.

I agree with you, I'll update the MR.

🇮🇹Italy lussoluca Italy

Hi,
Yes, one use case could be to enhance a semantic search response; you can look at this page from Cohere: https://cohere.com/rerank

An example can be like:

$client = $backend->getTypesenseClient();

 $response = $client->searchDocuments('images', [
    'q' => $query,
    'query_by' => 'embedding',
    'exclude_fields' => 'embedding',
    'prefix' => FALSE,
    'vector_query' => 'embedding:([], distance_threshold:0.70, k:'.$num_results.')',
]);
$hits = $response['hits'];

$default_provider = $this->aiProviderManager->getDefaultProviderForOperationType('rerank');
if ($default_provider != NULL) {
  try {
    $provider = $this
       ->aiProviderManager
        ->createInstance($default_provider['provider_id']);

    $response_reranked = $provider->rerank(
       new ReRankInput(
         model: $default_provider['model_id'],
         query: $query,
         top_n: $num_results,
         texts: array_map(
           static fn($hit) => $hit['document']['chunk'],
           $hits
         ),
         documents: $hits,
       ),
       $default_provider['model_id'],
     );

   $hits = $response_reranked->results;
}
🇮🇹Italy lussoluca Italy

There are some certificates issues with the download of the model from https://models.typesense.org/public/all-MiniLM-L12-v2/model.onnx.
Maybe something related to your network or the docker image you're using to run Typesense.

Unfortunately is something out of the control of the Drupal module...

🇮🇹Italy lussoluca Italy

Can you also post the logs for the Typesense server? Usually, Typesense writes the logs to the standard output

🇮🇹Italy lussoluca Italy

The Typesense server itself downloads the model. Can you please post the Typesense logs here?

🇮🇹Italy lussoluca Italy

The first example of an AI provider that supports re-ranking: https://www.drupal.org/project/ai_provider_cohere

🇮🇹Italy lussoluca Italy

Instead or re-implement a plugin architecture for AI providers, let's use the ones provided by AI module.

🇮🇹Italy lussoluca Italy

> It would be good to get this in before retry? are they tied together?

Yes, I think they should be worked together

> I've worked on a equivalent for doctrine_ping_connection & doctrine_close_connection

Cool, thanks!

🇮🇹Italy lussoluca Italy

> It seems it will dedupe for a short range of time, but not over say, an hour.

By default, the lock is set to last 5 minutes (300 seconds), but you can configure it when you apply the stamp to the envelope:

new LockStamp(\hash('sha256', \serialize($message)), 3600)

We need to write extensive documentation about how it works.

🇮🇹Italy lussoluca Italy

I cannot create an MR because the project repo is empty (no branches available).

Anyway, the code is here: https://git.drupalcode.org/issue/panther-3480502/-/tree/3480502?ref_type...

🇮🇹Italy lussoluca Italy

lussoluca changed the visibility of the branch main to hidden.

🇮🇹Italy lussoluca Italy

Yes, of course, we can do that in a separate project.

Something like sm_deduplicate ?

🇮🇹Italy lussoluca Italy

Thanks,
I'll release a new 2.x version asap

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

I've created a new MR (https://git.drupalcode.org/project/sm/-/merge_requests/23) with code from Implement retry and failed Active and 📌 Provide a Drupal SQL transport Active because failure and retry only apply to async transports

🇮🇹Italy lussoluca Italy

lussoluca changed the visibility of the branch 3403929-3390775 to hidden.

🇮🇹Italy lussoluca Italy

Let me know if you still have issues

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

At the moment, an integration with Views is not on the plan.

I think Typesense shines in combination with instantsearch.js to build client-site JavaScript-only frontends. Take a look at the "Search" tab in the index configuration.

Maybe we can create an issue to build the integration but it's not I will work on in the next future, sorry.

🇮🇹Italy lussoluca Italy

We absolutely must have better error messages!

Let's continue on this issue: Better messages for errors Active

🇮🇹Italy lussoluca Italy

Hi, have you added some fields to the index? Do the fields use the "Typesense: " data type? Do you have any errors when saving the schema?

🇮🇹Italy lussoluca Italy

Can you please try again with the latest version?

🇮🇹Italy lussoluca Italy

While working on Expand documentation (was "Doubts about the installation") Needs work , I've made the code more robust for this kind of issue.

🇮🇹Italy lussoluca Italy

I've just tried using Typesense Cloud, and it worked as expected.

I suppose there are some issues with documentation/UX that we can improve on.

Have you set the type of the fields as Typesense: ... ?

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

This has been fixed in the latest 1.0.x version

🇮🇹Italy lussoluca Italy

The first version has been implemented.
I will open specific issues for improvement.

Production build 0.71.5 2024