-
Notifications
You must be signed in to change notification settings - Fork 8
feat: 支持 Azure OpenAI 和百炼模型的嵌入与重排序功能 #98
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
Merged
Merged
Changes from all commits
Commits
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
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
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
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,32 @@ | ||
| package usecase | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/chaitin/ModelKit/v2/consts" | ||
| "github.com/chaitin/ModelKit/v2/domain" | ||
| ) | ||
|
|
||
| func TestBuildOpenAIChatConfig_Azure(t *testing.T) { | ||
| md := &domain.ModelMetadata{ | ||
| Provider: consts.ModelProviderAzureOpenAI, | ||
| ModelName: "gpt-4.1-mini", | ||
| BaseURL: "https://example.openai.azure.com", | ||
| APIKey: "test-key", | ||
| } | ||
|
|
||
| cfg := buildOpenAIChatConfig(md) | ||
|
|
||
| if !cfg.ByAzure { | ||
| t.Error("Expected ByAzure to be true") | ||
| } | ||
|
|
||
| if cfg.AzureModelMapperFunc == nil { | ||
| t.Error("Expected AzureModelMapperFunc to be set") | ||
| } else { | ||
| mapped := cfg.AzureModelMapperFunc("gpt-4.1-mini") | ||
| if mapped != "gpt-4.1-mini" { | ||
| t.Errorf("Expected mapped model to be 'gpt-4.1-mini', got '%s'", mapped) | ||
| } | ||
| } | ||
| } |
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.
Warning
#,疑似无效/易导致拼接或请求异常新增的 BaiLian rerank 模型 BaseURL 使用了
.../text-rerank#。URL fragment(# 后内容)不会被发送到服务端,且如果后续代码对 BaseURL 进行 path/query 拼接,可能造成不可预期行为。前端也同样硬编码了该#(见 ModelModal.tsx),进一步放大风险。建议: 确认该
#是否有特殊语义;若无,建议移除,统一为可直接请求的服务端地址,并避免前后端分别硬编码不同/奇怪的 BaseURL。