Results should include 'id'

Created on 6 February 2025, 3 months ago

Most of the issue is described here:
https://www.drupal.org/project/ai/issues/3504817 🐛 AI Search: Undefined array key "id" Active (closing that one in favor of this one).

Issue is that when used as a RAG (chunked mode - as rendered) - ai_search expects 'id' to be present in the returned matches.

Problem/Motivation

    // Normalize the results to match what other VDB Providers return.
    $results = [];
    foreach ($matches as $match) {
      $results[] = $match['metadata'] + ['distance' => $match['score']];
    }
    return $results;

this later is used in ai_search:

    // Obtain results.
    foreach ($real_results as $match) {
      $id = $get_chunked ? $match['drupal_entity_id'] . ':' . $match['id'] : $match['drupal_entity_id'];

Will provide a small patch shortly.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain Nikro Benalmadena, Malaga

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024