hunyuan and lkeap model backends of the tencentdb_ai plugin are deprecated along with the platform. You are recommended to migrate your in-use models to the tokenhub backend. This document describes the migration method.Item | hunyuan/lkeap Backend (Deprecated) | tokenhub Backend (Recommended) |
Authentication Method | SecretId / SecretKey (TC3 signature) | api_key(Bearer) |
Response Protocol | TencentCloud API format ( $.Response...) | OpenAI-compatible format ( $.choices..., $.data...) |
version / region | Required (for example, 2023-09-01, ap-guangzhou) | Not required. Pass NULL during registration. |
Model Name | The registered name is the invocation name. | model_name is only an alias within the plugin. The model identifier actually sent by the plugin to the TokenHub gateway is determined by real_model_name, which must be set to the service ID of a model enabled in the console's "Online Inference" section (for example, hy3). Otherwise, the error The model or service ID xxx does not exist is reported. |
Component Feature | hunyuan / lkeap | tokenhub | Migration Action |
Dialogue chat_completions | ✓ | ✓ | yaml
Configuration change only |
Fixed scenarios (sentiment / summarize / generate_text / generate_int / generate_double / generate_boolean) | ✓ | ✓ | yaml
Configuration change only |
NL2SQL(generate_query) | ✓ | ✓ | yaml
Configuration change only |
Text vector get_embedding | ✓ | ✓ | yaml
Change configuration + Re-embed existing data |
RAG(retrieve / rag) | ✓ | ✓ | yaml
Change configuration + Re-embed existing data |
Automatic vector column autoembedding | ✓ | ✓ | yaml
Rebuild tasks + Re-embed existing data |
Text reranking run_rerank | lkeap only | × | yaml
No migration path. Use vector search and reranking as an alternative. |
sk-) in API Key Management. The SecretId/SecretKey from the original platform are not interchangeable with the API Key, so you must create a new one.Type | Model (Service ID) | Key Specifications |
Language model | hy3, glm-5.2, deepseek-v4-flash, deepseek-v4-pro, kimi-k2.7, minimax-m3, and so on | Context 256k - 1M, see the model list for details. |
Vector model | kinfra-text-embedding-0.6b | 1024 dimensions, 32k context, lightweight and low-cost |
Vector model | kinfra-text-embedding-4b | 2560 dimensions, 32k context, high-quality search |
get_embedding cannot be called. Do not register or use these models.api_key:SELECT tencentdb_ai.update_model_attr('<model_name>', 'api_key', 'sk-********');
'$.Response.Choices[*].Message.Content' to OpenAI format '$.choices[0].message.content'. For embedding models, json_path must always be NULL (the response is parsed by get_embedding).chat_completions, sentiment, summarize, generate_text, generate_int, generate_double, generate_boolean, generate_query.-- Using the old model my-chat (originally the hunyuan backend) as an example, update the four attributes in sequence.SELECT tencentdb_ai.update_model_attr('my-chat', 'backend_type', 'tokenhub');SELECT tencentdb_ai.update_model_attr('my-chat', 'real_model_name', 'hy3'); -- Replace with the service ID you selectedSELECT tencentdb_ai.update_model_attr('my-chat', 'json_path', '$.choices[0].message.content');SELECT tencentdb_ai.update_model_attr('my-chat', 'api_key', 'sk-********');-- Verification: The model name in the business SQL remains unchanged and is directly usable.SELECT tencentdb_ai.chat_completions('my-chat', 'Hello, introduce yourself in one sentence.');
answer--------------------------------------------------------------------------------------Hello, I am Hunyuan, a large language model developed by Tencent. I can answer your questions, provide information, and assist with various tasks.(1 row)
SELECT tencentdb_ai.add_model('hy3', NULL, NULL, '$.choices[0].message.content'::jsonpath, 'tokenhub');SELECT tencentdb_ai.update_model_attr('hy3', 'api_key', 'sk-********');
get_embedding, as well as retrieve, rag, and autoembedding, which depend on it.SELECT tencentdb_ai.add_model('kinfra-text-embedding-0.6b', NULL, NULL, NULL, 'tokenhub');SELECT tencentdb_ai.update_model_attr('kinfra-text-embedding-0.6b', 'api_key', 'sk-********');
UPDATE kb_docs SET embedding = (SELECT e::vector(1024)FROM tencentdb_ai.get_embedding('kinfra-text-embedding-0.6b', ARRAY[chunk]) AS e);
UPDATE kb_docs SET embedding = NULL;ALTER TABLE kb_docs ALTER COLUMN embedding TYPE vector(2560);UPDATE kb_docs SET embedding = (SELECT e::vector(2560)FROM tencentdb_ai.get_embedding('kinfra-text-embedding-4b', ARRAY[chunk]) AS e);
REINDEX INDEX <index_name>;
-- 1. Delete the old task (the task ID can be queried through the tencentdb_ai.autoembedding_status view)SELECT tencentdb_ai.drop_incr_autoembedding_task(<old_task_id>);-- 2. Clear the old vectors (if the model registration has also been changed, complete update_model_attr first)UPDATE notes SET body_embedding = NULL;-- 3. Re-register the incremental taskSELECT tencentdb_ai.add_incr_autoembedding_task('public', 'notes', ARRAY['body']::name[], 'kinfra-text-embedding-0.6b');-- 4. Register a backfill task to re-embed existing dataSELECT tencentdb_ai.add_backfill_autoembedding_task('public', 'notes', ARRAY['body']::name[], 'kinfra-text-embedding-0.6b', NULL, true);-- 5. View the backfill progressSELECT task_kind, status, backfill_state, backfilled_rows, failed_countFROM tencentdb_ai.autoembedding_status;
task_kind | status | backfill_state | backfilled_rows | failed_count-----------+---------+----------------+-----------------+--------------incr | enabled | | | 0backfill | | done | 2 | 0(2 rows)
run_rerank supports only the lkeap backend, with no migration path available. It is recommended to use vector search with distance-based sorting as an alternative:SELECT chunk, distanceFROM tencentdb_ai.retrieve('kinfra-text-embedding-0.6b', 'your query','public', 'kb_docs', 'chunk', 'embedding', 10, 'cosine')ORDER BY distance, chunk;
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback