-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[Inference API] Add Tencent Cloud AI Service to Inference API #152829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
boicehuang
wants to merge
36
commits into
elastic:main
Choose a base branch
from
boicehuang:tencentcloud_inference
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 2d97cbb
add SSRF guard
boicehuang 2f4d69f
add SSRF guard
boicehuang 709043f
Merge remote-tracking branch 'origin/main' into tencentcloud_inference
boicehuang 87a0129
add change log
boicehuang 3ef1d18
Merge branch 'main' into tencentcloud_inference
boicehuang a9bd960
Merge branch 'main' into tencentcloud_inference
jonathan-buttner 59d89c5
[CI] Auto commit changes from spotless
85b6acd
fix test
boicehuang d6e26a2
Merge remote-tracking branch 'origin/tencentcloud_inference' into ten…
boicehuang b2d9a4f
Merge branch 'main' into tencentcloud_inference
boicehuang dbc83a1
Merge branch 'main' into tencentcloud_inference
boicehuang 4f0a11a
Merge branch 'main' into tencentcloud_inference
jonathan-buttner 941dac0
fix test
boicehuang ae91bc2
Merge remote-tracking branch 'origin/tencentcloud_inference' into ten…
boicehuang 02ec491
Merge branch 'main' into tencentcloud_inference
boicehuang 6894320
Merge branch 'main' into tencentcloud_inference
boicehuang aa989f6
Merge branch 'main' into tencentcloud_inference
jonathan-buttner 5745bb9
[CI] Auto commit changes from spotless
429c48e
Merge branch 'main' into tencentcloud_inference
boicehuang 79645d4
Merge branch 'main' into tencentcloud_inference
boicehuang e83a598
Merge branch 'main' into tencentcloud_inference
jonathan-buttner ab85a40
fix test
boicehuang b55c67f
Merge branch 'main' into tencentcloud_inference
boicehuang 128cc47
Merge branch 'main' into tencentcloud_inference
boicehuang 6853b22
Merge branch 'main' into tencentcloud_inference
boicehuang b1e868a
Merge branch 'main' into tencentcloud_inference
jonathan-buttner 729ef88
fix test
boicehuang 174d48b
Merge branch 'main' into tencentcloud_inference
boicehuang 211a362
Merge branch 'main' into tencentcloud_inference
boicehuang d408138
Merge branch 'main' into tencentcloud_inference
boicehuang 002f444
[Inference] Fix TencentCloud service: NamedWriteables, TransportVersi…
boicehuang da126c4
[Inference] Migrate TencentCloud ServiceSettings to ObjectParser
boicehuang 3d0056d
[Inference] Replace configurable URL with region selector in TencentC…
boicehuang 0958572
[Inference] Clarify rerank model support and region docs in TencentCl…
boicehuang abed6e7
[Inference] Code review fixes: remove dead code, tighten visibility
boicehuang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 测试全部通过。已推送。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: [] |
1 change: 1 addition & 0 deletions
1
...er/src/main/resources/transport/definitions/referable/ml_inference_tencentcloud_added.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9479000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| esql_double_range_value_holder,9478000 | ||
| ml_inference_tencentcloud_added,9479000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.