Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a5ee052
add tencentcloud inference service
boicehuang Jul 3, 2026
2d97cbb
add SSRF guard
boicehuang Jul 8, 2026
2f4d69f
add SSRF guard
boicehuang Jul 8, 2026
709043f
Merge remote-tracking branch 'origin/main' into tencentcloud_inference
boicehuang Jul 8, 2026
87a0129
add change log
boicehuang Jul 8, 2026
3ef1d18
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 8, 2026
a9bd960
Merge branch 'main' into tencentcloud_inference
jonathan-buttner Jul 8, 2026
59d89c5
[CI] Auto commit changes from spotless
Jul 8, 2026
85b6acd
fix test
boicehuang Jul 9, 2026
d6e26a2
Merge remote-tracking branch 'origin/tencentcloud_inference' into ten…
boicehuang Jul 9, 2026
b2d9a4f
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 9, 2026
dbc83a1
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 9, 2026
4f0a11a
Merge branch 'main' into tencentcloud_inference
jonathan-buttner Jul 9, 2026
941dac0
fix test
boicehuang Jul 10, 2026
ae91bc2
Merge remote-tracking branch 'origin/tencentcloud_inference' into ten…
boicehuang Jul 10, 2026
02ec491
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 10, 2026
6894320
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 13, 2026
aa989f6
Merge branch 'main' into tencentcloud_inference
jonathan-buttner Jul 13, 2026
5745bb9
[CI] Auto commit changes from spotless
Jul 13, 2026
429c48e
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 14, 2026
79645d4
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 14, 2026
e83a598
Merge branch 'main' into tencentcloud_inference
jonathan-buttner Jul 14, 2026
ab85a40
fix test
boicehuang Jul 15, 2026
b55c67f
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 15, 2026
128cc47
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 15, 2026
6853b22
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 15, 2026
b1e868a
Merge branch 'main' into tencentcloud_inference
jonathan-buttner Jul 15, 2026
729ef88
fix test
boicehuang Jul 16, 2026
174d48b
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 16, 2026
211a362
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 22, 2026
d408138
Merge branch 'main' into tencentcloud_inference
boicehuang Jul 25, 2026
002f444
[Inference] Fix TencentCloud service: NamedWriteables, TransportVersi…
boicehuang Jul 25, 2026
da126c4
[Inference] Migrate TencentCloud ServiceSettings to ObjectParser
boicehuang Jul 25, 2026
3d0056d
[Inference] Replace configurable URL with region selector in TencentC…
boicehuang Jul 25, 2026
0958572
[Inference] Clarify rerank model support and region docs in TencentCl…
boicehuang Jul 25, 2026
abed6e7
[Inference] Code review fixes: remove dead code, tighten visibility
boicehuang Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .workbuddy/memory/2026-07-25.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 2026-07-25

## PR #152829 分析与修复计划
- 本仓库即 PR #152829 (elastic/elasticsearch) 的分支 `tencentcloud_inference`:新增 Tencent Cloud AI Gateway (OpenAI 兼容) 到 Inference API,支持 text_embedding / chat_completion / rerank。
- 代码位于 `x-pack/plugin/inference/.../services/tencentcloud/`。
- PR 状态:open,mergeable_state=unstable(CI 不稳定)。评审人 jonathan-buttner(search-inference-team),10 条 line-level 评审 + CI 编译/测试失败。
- 关键待修(已建 10 个 task):
1. changelog area: Machine Learning → Inference
2. InferenceNamedWriteablesProvider 无任何 tencentcloud 注册(合并冲突丢失)→ 必须补回
3. 用 minimumCompatible(),需新增专属 TransportVersion
4. 加 TaskType.COMPLETION(供 ESQL)
5. 删除 *RequestManager,按 OpenAiService.doUnifiedCompletionInfer / ElasticInferenceService ActionCreator 重构 completion
6. ServiceSettings 改用 ObjectParser(参照 LlamaEmbeddingsServiceSettings)
7. URL 若固定则硬编码(参照 JinaAIRerankModel)
8. 澄清 rerank 支持模型范围
9. 按 OpenAi 测试范式补齐/修复测试(编译失败 TencentCloudServiceTests:284 unreported exception)
10. 本地跑 :x-pack:plugin:inference:test + spotless

## 全量修复执行结果 (2026-07-25)
- **修复完成 16 个文件,109 个测试全部通过,0 失败。**
- 已完成修复项:
1. ✅ changelog area: `Machine Learning` → `Inference` (docs/changelog/152829.yaml)
2. ✅ NamedWriteables 注册:InferenceNamedWriteablesProvider.java 新增 addTencentCloudNamedWriteables 方法,注册 5 个 settings (TencentCloudEmbeddingsServiceSettings, TencentCloudEmbeddingsTaskSettings, TencentCloudChatCompletionServiceSettings, TencentCloudRerankServiceSettings, TencentCloudRerankTaskSettings)
3. ✅ TransportVersion:server/src/main/resources/transport/definitions/referable/ml_inference_tencentcloud_added.csv + upper_bounds/9.6.csv,ID=9479000(避免与 esql_vsr_source_load_profile 的 9459000 冲突)。TencentCloudService.TENCENT_CLOUD_INFERENCE_SERVICE_ADDED 常量引用 fromName("ml_inference_tencentcloud_added")。所�� getMinimalSupportedVersion() 统一引用该常量。
4. ✅ TaskType.COMPLETION:SUPPORTED_TASK_TYPES 增加 COMPLETION,SUPPORTED_STREAMING_TASKS 增加 COMPLETION,MODEL_CREATORS 中 COMPLETION 复用 TencentCloudChatCompletionModelCreator
5. ✅ 删除 TencentCloudChatCompletionRequestManager.java;completion 路径改为 visitor 模式 (TencentCloudActionVisitor + TencentCloudActionCreator)
6. ✅ ServiceSettings → ObjectParser:TencentCloudCommonServiceSettings 新增 declareCommonFields() + CommonSettingsBuilder 接口。TencentCloudEmbeddingsServiceSettings、TencentCloudChatCompletionServiceSettings、TencentCloudRerankServiceSettings 均改用 ObjectParser 解析(参照 LlamaEmbeddingsServiceSettings 模式),保留 ValidationException 向后兼容。已推送。
7. ✅ URL → region:确认用户不能自建部署,但需支持不同地域。删除自由 `url` 字段,改为 `region` 字段(默认 "bj"),端点硬编码为 `https://{region}.aisearch.tencentelasticsearch.com/v1/<task-path>`。15 文件变更,105 测试通过。
8. ✅ rerank 模型范围:确认非固定列表(支持多个模型),模型 ID 透传给网关。更新 rerankerWindowSize() 和 MODEL_ID 配置注释说明透传策略。
9. ✅ 测试修复:TencentCloudServiceTests.expectedStreamingTasks() 增加 COMPLETION;testSupportedTaskTypes_ContainsExpectedTasks 增加 COMPLETION 校验
10. ✅ 全量验证:109 tests, 0 failures across 14 classes + spotlessApply 通过

## ObjectParser 迁移 (second commit)
- 4 文件 227 行变更,109 测试全部通过。已推送。
5 changes: 5 additions & 0 deletions docs/changelog/152829.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 152829
summary: Add Tencent Cloud inference service
area: Inference
type: feature
issues: []
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9479000
2 changes: 1 addition & 1 deletion server/src/main/resources/transport/upper_bounds/9.6.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
esql_double_range_value_holder,9478000
ml_inference_tencentcloud_added,9479000
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public void testGetServicesWithoutTaskType() throws IOException {
"text_embedding_test_service",
"voyageai",
"watsonxai",
"amazon_sagemaker"
"amazon_sagemaker",
"tencentcloud"
).toArray()
)
);
Expand Down Expand Up @@ -124,7 +125,8 @@ public void testGetServicesWithTextEmbeddingTaskType() throws IOException {
"openshift_ai",
"text_embedding_test_service",
"voyageai",
"watsonxai"
"watsonxai",
"tencentcloud"
).toArray()
)
);
Expand Down Expand Up @@ -153,7 +155,8 @@ public void testGetServicesWithRerankTaskType() throws IOException {
"watsonxai",
"hugging_face",
"amazon_sagemaker",
"elastic"
"elastic",
"tencentcloud"
).toArray()
)
);
Expand Down Expand Up @@ -213,7 +216,8 @@ public void testGetServicesWithChatCompletionTaskType() throws IOException {
"mistral",
"nvidia",
"watsonxai",
"amazonbedrock"
"amazonbedrock",
"tencentcloud"
).toArray()
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
import org.elasticsearch.xpack.inference.services.custom.response.RerankResponseParser;
import org.elasticsearch.xpack.inference.services.custom.response.SparseEmbeddingResponseParser;
import org.elasticsearch.xpack.inference.services.deepseek.DeepSeekServiceSettings;
import org.elasticsearch.xpack.inference.services.elastic.completion.ElasticInferenceServiceChatCompletionTaskSettings;
import org.elasticsearch.xpack.inference.services.elastic.completion.ElasticInferenceServiceCompletionServiceSettings;
import org.elasticsearch.xpack.inference.services.elastic.denseembeddings.ElasticInferenceServiceDenseEmbeddingsServiceSettings;
import org.elasticsearch.xpack.inference.services.elastic.rerank.ElasticInferenceServiceRerankServiceSettings;
Expand Down Expand Up @@ -137,7 +136,11 @@
import org.elasticsearch.xpack.inference.services.sagemaker.model.SageMakerModel;
import org.elasticsearch.xpack.inference.services.sagemaker.schema.SageMakerSchemas;
import org.elasticsearch.xpack.inference.services.settings.DefaultSecretSettings;
import org.elasticsearch.xpack.inference.services.settings.ImmutableEmptyTaskSettings;
import org.elasticsearch.xpack.inference.services.tencentcloud.completion.TencentCloudChatCompletionServiceSettings;
import org.elasticsearch.xpack.inference.services.tencentcloud.embeddings.TencentCloudEmbeddingsServiceSettings;
import org.elasticsearch.xpack.inference.services.tencentcloud.embeddings.TencentCloudEmbeddingsTaskSettings;
import org.elasticsearch.xpack.inference.services.tencentcloud.rerank.TencentCloudRerankServiceSettings;
import org.elasticsearch.xpack.inference.services.tencentcloud.rerank.TencentCloudRerankTaskSettings;
import org.elasticsearch.xpack.inference.services.voyageai.embeddings.VoyageAIEmbeddingsServiceSettings;
import org.elasticsearch.xpack.inference.services.voyageai.embeddings.VoyageAIEmbeddingsTaskSettings;
import org.elasticsearch.xpack.inference.services.voyageai.rerank.VoyageAIRerankServiceSettings;
Expand All @@ -162,9 +165,6 @@ public static List<NamedWriteableRegistry.Entry> getNamedWriteables() {

// Empty default task settings
namedWriteables.add(new NamedWriteableRegistry.Entry(TaskSettings.class, EmptyTaskSettings.NAME, EmptyTaskSettings::new));
namedWriteables.add(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a merge conflict resolution issue, let's add these changes back and we need to follow a similar pattern as the other services in this file to add the named writeables that are introduced in this PR.

new NamedWriteableRegistry.Entry(TaskSettings.class, ImmutableEmptyTaskSettings.NAME, ImmutableEmptyTaskSettings::new)
);

// Empty default secret settings
namedWriteables.add(new NamedWriteableRegistry.Entry(SecretSettings.class, EmptySecretSettings.NAME, EmptySecretSettings::new));
Expand Down Expand Up @@ -200,6 +200,7 @@ public static List<NamedWriteableRegistry.Entry> getNamedWriteables() {
addNvidiaNamedWriteables(namedWriteables);
addFireworksAiNamedWriteables(namedWriteables);
addDeepSeekNamedWriteables(namedWriteables);
addTencentCloudNamedWriteables(namedWriteables);

addUnifiedNamedWriteables(namedWriteables);

Expand Down Expand Up @@ -229,6 +230,40 @@ private static void addDeepSeekNamedWriteables(List<NamedWriteableRegistry.Entry
);
}

private static void addTencentCloudNamedWriteables(List<NamedWriteableRegistry.Entry> namedWriteables) {
namedWriteables.add(
new NamedWriteableRegistry.Entry(
ServiceSettings.class,
TencentCloudEmbeddingsServiceSettings.NAME,
TencentCloudEmbeddingsServiceSettings::new
)
);
namedWriteables.add(
new NamedWriteableRegistry.Entry(
TaskSettings.class,
TencentCloudEmbeddingsTaskSettings.NAME,
TencentCloudEmbeddingsTaskSettings::new
)
);
namedWriteables.add(
new NamedWriteableRegistry.Entry(
ServiceSettings.class,
TencentCloudChatCompletionServiceSettings.NAME,
TencentCloudChatCompletionServiceSettings::new
)
);
namedWriteables.add(
new NamedWriteableRegistry.Entry(
ServiceSettings.class,
TencentCloudRerankServiceSettings.NAME,
TencentCloudRerankServiceSettings::new
)
);
namedWriteables.add(
new NamedWriteableRegistry.Entry(TaskSettings.class, TencentCloudRerankTaskSettings.NAME, TencentCloudRerankTaskSettings::new)
);
}

private static void addGroqNamedWriteables(List<NamedWriteableRegistry.Entry> namedWriteables) {
namedWriteables.add(
new NamedWriteableRegistry.Entry(
Expand Down Expand Up @@ -978,13 +1013,6 @@ private static void addElasticNamedWriteables(List<NamedWriteableRegistry.Entry>
ElasticInferenceServiceCompletionServiceSettings::new
)
);
namedWriteables.add(
new NamedWriteableRegistry.Entry(
TaskSettings.class,
ElasticInferenceServiceChatCompletionTaskSettings.NAME,
ElasticInferenceServiceChatCompletionTaskSettings::new
)
);

// Rerank
namedWriteables.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
import org.elasticsearch.xpack.inference.services.sagemaker.model.SageMakerConfiguration;
import org.elasticsearch.xpack.inference.services.sagemaker.model.SageMakerModelBuilder;
import org.elasticsearch.xpack.inference.services.sagemaker.schema.SageMakerSchemas;
import org.elasticsearch.xpack.inference.services.tencentcloud.TencentCloudService;
import org.elasticsearch.xpack.inference.services.voyageai.VoyageAIService;
import org.elasticsearch.xpack.inference.vectors.EmbeddingQueryVectorBuilder;

Expand Down Expand Up @@ -655,6 +656,7 @@ public List<InferenceServiceExtension.Factory> getInferenceServiceFactories() {
context -> new JinaAIService(httpFactory.get(), serviceComponents.get(), context),
context -> new VoyageAIService(httpFactory.get(), serviceComponents.get(), context),
context -> new DeepSeekService(httpFactory.get(), serviceComponents.get(), context),
context -> new TencentCloudService(httpFactory.get(), serviceComponents.get(), context),
context -> new LlamaService(httpFactory.get(), serviceComponents.get(), context),
context -> new Ai21Service(httpFactory.get(), serviceComponents.get(), context),
context -> new OpenShiftAiService(httpFactory.get(), serviceComponents.get(), context),
Expand Down
Loading