-
Notifications
You must be signed in to change notification settings - Fork 141
feat: add MiniMax as alternative LLM provider for Bot #1560
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
octo-patch
wants to merge
1
commit into
beam-cloud:main
Choose a base branch
from
octo-patch:feature/add-minimax-provider
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| package bot | ||
|
|
||
| import ( | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestBotConfigBaseUrl(t *testing.T) { | ||
| t.Run("default base url is empty", func(t *testing.T) { | ||
| config := BotConfig{ | ||
| Model: "gpt-4o", | ||
| ApiKey: "test-key", | ||
| } | ||
| if config.BaseUrl != "" { | ||
| t.Errorf("expected empty BaseUrl, got %q", config.BaseUrl) | ||
| } | ||
| }) | ||
|
|
||
| t.Run("base url can be set for MiniMax", func(t *testing.T) { | ||
| config := BotConfig{ | ||
| Model: "MiniMax-M2.7", | ||
| ApiKey: "test-key", | ||
| BaseUrl: "https://api.minimax.io/v1", | ||
| } | ||
| if config.BaseUrl != "https://api.minimax.io/v1" { | ||
| t.Errorf("expected MiniMax base URL, got %q", config.BaseUrl) | ||
| } | ||
| }) | ||
|
|
||
| t.Run("base url is optional for OpenAI models", func(t *testing.T) { | ||
| config := BotConfig{ | ||
| Model: "gpt-4o", | ||
| ApiKey: "test-key", | ||
| } | ||
| if config.BaseUrl != "" { | ||
| t.Errorf("expected empty BaseUrl for OpenAI model, got %q", config.BaseUrl) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| func TestBotConfigJSON(t *testing.T) { | ||
| t.Run("base url is omitted when empty", func(t *testing.T) { | ||
| config := BotConfig{ | ||
| Model: "gpt-4o", | ||
| ApiKey: "test-key", | ||
| } | ||
| // BaseUrl should be zero-value and omitted in JSON | ||
| if config.BaseUrl != "" { | ||
| t.Errorf("expected empty BaseUrl, got %q", config.BaseUrl) | ||
| } | ||
| }) | ||
|
|
||
| t.Run("base url is included when set", func(t *testing.T) { | ||
| config := BotConfig{ | ||
| Model: "MiniMax-M2.5", | ||
| ApiKey: "test-key", | ||
| BaseUrl: "https://api.minimax.io/v1", | ||
| } | ||
| if config.BaseUrl == "" { | ||
| t.Error("expected non-empty BaseUrl") | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| func TestBotConfigMiniMaxModels(t *testing.T) { | ||
| miniMaxModels := []string{ | ||
| "MiniMax-M2.7", | ||
| "MiniMax-M2.5", | ||
| "MiniMax-M2.5-highspeed", | ||
| } | ||
|
|
||
| for _, model := range miniMaxModels { | ||
| t.Run("config accepts "+model, func(t *testing.T) { | ||
| config := BotConfig{ | ||
| Model: model, | ||
| ApiKey: "test-minimax-key", | ||
| BaseUrl: "https://api.minimax.io/v1", | ||
| } | ||
| if config.Model != model { | ||
| t.Errorf("expected model %q, got %q", model, config.Model) | ||
| } | ||
| if config.BaseUrl != "https://api.minimax.io/v1" { | ||
| t.Errorf("expected MiniMax base URL, got %q", config.BaseUrl) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestBotConfigFormatLocations(t *testing.T) { | ||
| config := BotConfig{ | ||
| Locations: map[string]BotLocationConfig{}, | ||
| } | ||
| result := config.FormatLocations() | ||
| if result != "There are no known locations." { | ||
| t.Errorf("expected no locations message, got %q", result) | ||
| } | ||
| } | ||
|
|
||
| func TestBotConfigFormatTransitions(t *testing.T) { | ||
| config := BotConfig{ | ||
| Transitions: map[string]BotTransitionConfig{}, | ||
| } | ||
| result := config.FormatTransitions() | ||
| if result != "There are no known transitions that can be performed." { | ||
| t.Errorf("expected no transitions message, got %q", result) | ||
| } | ||
| } | ||
|
|
||
| func TestParseContainerId(t *testing.T) { | ||
| t.Run("valid container id", func(t *testing.T) { | ||
| containerId := "bot-transition-ef3f780c-6fe1-4f38-a201-96d32e825bb3-5886f9-41f80f43" | ||
| container, err := parseContainerId(containerId) | ||
| if err != nil { | ||
| t.Fatalf("unexpected error: %v", err) | ||
| } | ||
| if container.StubId != "ef3f780c-6fe1-4f38-a201-96d32e825bb3" { | ||
| t.Errorf("unexpected stub id: %s", container.StubId) | ||
| } | ||
| if container.SessionId != "5886f9" { | ||
| t.Errorf("unexpected session id: %s", container.SessionId) | ||
| } | ||
| }) | ||
|
|
||
| t.Run("invalid container id", func(t *testing.T) { | ||
| _, err := parseContainerId("invalid-id") | ||
| if err == nil { | ||
| t.Error("expected error for invalid container id") | ||
| } | ||
| }) | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
P2: The new “OpenAI-compatible API” support is blocked by the existing model allowlist: non-allowlisted models still raise ValueError before base_url is applied, so custom providers cannot be used despite the added documentation.
Prompt for AI agents