Change how users select `tokenizer chat model` on AI Search / Search API server

Created on 5 September 2024, 7 months ago

Problem/Motivation

The Tokenizer chat model select input on the AI Search Server configuration page can show models not supported by the current implementation of the Drupal\ai\Utility\Tokenizer class.

Steps to reproduce

1. Enable an AI provider that is not OpenAI, like Ollama with any models like llama3.1, qwen2, or gemma2.
2. Configure an AI Search server (with Milvus, which is only option right now)
3. The `Tokenizer chat model` select input will show those options
4. Configure an AI Search index
5. Index, you'll get the next error:

InvalidArgumentException: Unknown model name: llama3.1:latest in Yethee\Tiktoken\EncoderProvider->getForModel() (line 123 of /var/www/html/vendor/yethee/tiktoken/src/EncoderProvider.php).

Proposed resolution

A couple of suggestions:

  1. Instead of showing enabled models (many of which may not be supported by the current Yethee\Tiktoken\EncoderProvider), show only the current supported models.
  2. Provide also a simple character splitting option, besides the specialized token splitting one.
  3. Provide a good helper text to help guide users of the module decide between the available options.
  4. Provide a good default value, maybe gpt-4 -> cl100k_base

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.0

Component

AI Search

Created by

🇲🇽Mexico jackbravo

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

Comments & Activities

Production build 0.71.5 2024