diff --git a/README.md b/README.md index 06b90381a..89aab9c07 100644 --- a/README.md +++ b/README.md @@ -121,14 +121,14 @@ We have an `acontext-cli` to help you do a quick proof-of-concept. Download it f curl -fsSL https://install.acontext.io | sh ``` -You should have [docker](https://www.docker.com/get-started/) installed and an OpenAI API Key to start an Acontext backend on your computer: +You should have [docker](https://www.docker.com/get-started/) installed and a MiniMax API Key to start an Acontext backend on your computer: ```bash mkdir acontext_server && cd acontext_server acontext server up ``` -> Make sure your LLM has the ability to [call tools](https://platform.openai.com/docs/guides/function-calling). By default, Acontext will use `gpt-4.1`. +> Make sure your LLM has the ability to [call tools](https://platform.openai.com/docs/guides/function-calling). By default, Acontext will use MiniMax `MiniMax-M3` via `https://api.minimax.io/v1`. `acontext server up` will create/use `.env` and `config.yaml` for Acontext, and create a `db` folder to persist data. diff --git a/charts/acontext/values.yaml b/charts/acontext/values.yaml index f1bd1d527..58c9d7c84 100644 --- a/charts/acontext/values.yaml +++ b/charts/acontext/values.yaml @@ -25,9 +25,9 @@ core: env: # LLM Configuration - LLM_BASE_URL: "" # Optional: Custom LLM base URL - LLM_SIMPLE_MODEL: "gpt-4.1" # Default LLM model - LLM_SDK: "openai" # LLM SDK: "openai" or "anthropic" + LLM_BASE_URL: "https://api.minimax.io/v1" # MiniMax OpenAI-compatible base URL + LLM_SIMPLE_MODEL: "MiniMax-M3" # Default LLM model + LLM_SDK: "minimax" # LLM SDK: "openai", "anthropic", or "minimax" # S3 Configuration (AWS S3) S3_ENDPOINT: "" # AWS S3 endpoint, e.g., https://s3.amazonaws.com or https://s3.us-east-1.amazonaws.com diff --git a/docs/content/docs/(guides)/settings/core.mdx b/docs/content/docs/(guides)/settings/core.mdx index d5f37f3b5..d2b58ccc1 100644 --- a/docs/content/docs/(guides)/settings/core.mdx +++ b/docs/content/docs/(guides)/settings/core.mdx @@ -10,7 +10,7 @@ Configure your acontext core services using these essential environment variable ### LLM Configuration -API key for your LLM provider (OpenAI or Anthropic). This is the primary authentication credential for AI model access. +API key for your LLM provider (OpenAI, Anthropic, or MiniMax). This is the primary authentication credential for AI model access. @@ -18,11 +18,11 @@ Custom base URL for LLM API endpoints. Leave unset to use the provider's default -LLM provider to use. Supported values: `openai`, `anthropic` +LLM provider to use. Supported values: `openai`, `anthropic`, `minimax` -Default model identifier for LLM operations. Examples: `gpt-4`, `gpt-3.5-turbo`, `claude-3-sonnet` +Default model identifier for LLM operations. Examples: `MiniMax-M3`, `gpt-4`, `gpt-3.5-turbo`, `claude-3-sonnet` @@ -62,13 +62,12 @@ Be careful when choosing your embedding model. Changing the embedding model afte ## `.env` Examples -```bash title=".env" -# Required LLM Configuration -LLM_API_KEY=sk-your-openai-api-key-here - -# Optional LLM Settings -LLM_SDK=openai -LLM_SIMPLE_MODEL=gpt-4 +```bash title="MiniMax Setup" +# Using MiniMax-M3 through the OpenAI-compatible endpoint +LLM_API_KEY=your-minimax-api-key +LLM_BASE_URL=https://api.minimax.io/v1 +LLM_SDK=minimax +LLM_SIMPLE_MODEL=MiniMax-M3 LLM_RESPONSE_TIMEOUT=60 # Embedding Configuration diff --git a/src/client/acontext-cli/cmd/server.go b/src/client/acontext-cli/cmd/server.go index 13304da09..f2baa7632 100644 --- a/src/client/acontext-cli/cmd/server.go +++ b/src/client/acontext-cli/cmd/server.go @@ -756,9 +756,10 @@ func runServerUp(cmd *cobra.Command, args []string) error { if _, err := os.Stat(envFile); os.IsNotExist(err) { envConfig := &docker.EnvConfig{ LLMConfig: &docker.LLMConfig{ - APIKey: "your-api-key", - BaseURL: "https://api.openai.com/v1", - SDK: "openai", + APIKey: "your-minimax-api-key", + BaseURL: "https://api.minimax.io/v1", + SimpleModel: "MiniMax-M3", + SDK: "minimax", }, RootAPIBearerToken: "your-root-api-bearer-token", CoreConfigYAMLFile: "./config.yaml", diff --git a/src/client/acontext-cli/internal/docker/env.go b/src/client/acontext-cli/internal/docker/env.go index ae572fb88..08b57fc0a 100644 --- a/src/client/acontext-cli/internal/docker/env.go +++ b/src/client/acontext-cli/internal/docker/env.go @@ -12,6 +12,7 @@ func GenerateEnvFile(filePath string, config *EnvConfig) error { # LLM Configuration LLM_API_KEY={{.LLMAPIKey}} LLM_BASE_URL={{.LLMBaseURL}} +LLM_SIMPLE_MODEL={{.LLMSimpleModel}} LLM_SDK={{.LLMSDK}} # API Bearer Token (for root API access) @@ -36,12 +37,14 @@ CORE_CONFIG_YAML_FILE={{.CoreConfigYAMLFile}} vars := struct { LLMAPIKey string LLMBaseURL string + LLMSimpleModel string LLMSDK string RootAPIBearerToken string CoreConfigYAMLFile string }{ LLMAPIKey: config.LLMConfig.APIKey, LLMBaseURL: config.LLMConfig.BaseURL, + LLMSimpleModel: config.LLMConfig.SimpleModel, LLMSDK: config.LLMConfig.SDK, RootAPIBearerToken: config.RootAPIBearerToken, CoreConfigYAMLFile: config.CoreConfigYAMLFile, @@ -69,9 +72,10 @@ CORE_CONFIG_YAML_FILE={{.CoreConfigYAMLFile}} // LLMConfig contains LLM configuration type LLMConfig struct { - APIKey string - BaseURL string - SDK string + APIKey string + BaseURL string + SimpleModel string + SDK string } // EnvConfig contains all environment configuration diff --git a/src/client/acontext-cli/internal/docker/env_test.go b/src/client/acontext-cli/internal/docker/env_test.go index 79dae411a..b14689ea1 100644 --- a/src/client/acontext-cli/internal/docker/env_test.go +++ b/src/client/acontext-cli/internal/docker/env_test.go @@ -38,9 +38,10 @@ func TestGenerateEnvFile(t *testing.T) { // Create mock env config for testing envConfig := &EnvConfig{ LLMConfig: &LLMConfig{ - APIKey: "test-api-key", - BaseURL: "https://api.example.com", - SDK: "openai", + APIKey: "test-api-key", + BaseURL: "https://api.example.com", + SimpleModel: "MiniMax-M3", + SDK: "minimax", }, RootAPIBearerToken: "test-root-token", } @@ -63,12 +64,13 @@ func TestGenerateEnvFile(t *testing.T) { // Check for required environment variables assert.Contains(t, contentStr, "LLM_API_KEY=") assert.Contains(t, contentStr, "LLM_BASE_URL=") + assert.Contains(t, contentStr, "LLM_SIMPLE_MODEL=") assert.Contains(t, contentStr, "LLM_SDK=") assert.Contains(t, contentStr, "ROOT_API_BEARER_TOKEN=") // Verify config values are not empty lines := strings.Split(contentStr, "\n") - var llmAPIKey, llmBaseURL, llmSDK, rootToken string + var llmAPIKey, llmBaseURL, llmSimpleModel, llmSDK, rootToken string for _, line := range lines { if strings.HasPrefix(line, "LLM_API_KEY=") { llmAPIKey = strings.TrimPrefix(line, "LLM_API_KEY=") @@ -76,6 +78,9 @@ func TestGenerateEnvFile(t *testing.T) { if strings.HasPrefix(line, "LLM_BASE_URL=") { llmBaseURL = strings.TrimPrefix(line, "LLM_BASE_URL=") } + if strings.HasPrefix(line, "LLM_SIMPLE_MODEL=") { + llmSimpleModel = strings.TrimPrefix(line, "LLM_SIMPLE_MODEL=") + } if strings.HasPrefix(line, "LLM_SDK=") { llmSDK = strings.TrimPrefix(line, "LLM_SDK=") } @@ -85,11 +90,13 @@ func TestGenerateEnvFile(t *testing.T) { } assert.NotEmpty(t, llmAPIKey) assert.NotEmpty(t, llmBaseURL) + assert.NotEmpty(t, llmSimpleModel) assert.NotEmpty(t, llmSDK) assert.NotEmpty(t, rootToken) assert.Equal(t, "test-api-key", llmAPIKey) assert.Equal(t, "https://api.example.com", llmBaseURL) - assert.Equal(t, "openai", llmSDK) + assert.Equal(t, "MiniMax-M3", llmSimpleModel) + assert.Equal(t, "minimax", llmSDK) assert.Equal(t, "test-root-token", rootToken) } }) diff --git a/src/server/.env.example b/src/server/.env.example index c4e41ab26..6fa17cd2c 100644 --- a/src/server/.env.example +++ b/src/server/.env.example @@ -1,4 +1,4 @@ -LLM_API_KEY="YOUR OPENAI API KEY" -LLM_BASE_URL="" -LLM_SIMPLE_MODEL="gpt-4.1" -LLM_SDK="openai" +LLM_API_KEY="YOUR-MINIMAX-KEY" +LLM_BASE_URL="https://api.minimax.io/v1" +LLM_SIMPLE_MODEL="MiniMax-M3" +LLM_SDK="minimax" diff --git a/src/server/core/.env.example b/src/server/core/.env.example index 39da810cf..cb14b14b9 100644 --- a/src/server/core/.env.example +++ b/src/server/core/.env.example @@ -1 +1,4 @@ -LLM_API_KEY="YOUR-OPENAI-KEY" \ No newline at end of file +LLM_API_KEY="YOUR MINIMAX API KEY" +LLM_BASE_URL="https://api.minimax.io/v1" +LLM_SIMPLE_MODEL="MiniMax-M3" +LLM_SDK="minimax" diff --git a/src/server/core/acontext_core/llm/complete/__init__.py b/src/server/core/acontext_core/llm/complete/__init__.py index 0cf27a3c1..28e91dc1c 100644 --- a/src/server/core/acontext_core/llm/complete/__init__.py +++ b/src/server/core/acontext_core/llm/complete/__init__.py @@ -13,6 +13,7 @@ FACTORIES: Mapping[str, COMPLETE_FUNC] = { "openai": openai_complete, "anthropic": anthropic_complete, + "minimax": openai_complete, "mock": mock_complete, } @@ -61,7 +62,7 @@ async def llm_sanity_check(): def response_to_sendable_message(message: LLMResponse) -> dict: - if DEFAULT_CORE_CONFIG.llm_sdk == "openai": + if DEFAULT_CORE_CONFIG.llm_sdk in ("openai", "minimax"): return message.raw_response.choices[0].message.model_dump() elif DEFAULT_CORE_CONFIG.llm_sdk == "anthropic": dp = {"role": message.role, "content": []} diff --git a/src/server/core/acontext_core/schema/config.py b/src/server/core/acontext_core/schema/config.py index f5ec77287..c5402f673 100644 --- a/src/server/core/acontext_core/schema/config.py +++ b/src/server/core/acontext_core/schema/config.py @@ -21,7 +21,7 @@ class CoreConfig(BaseModel): llm_openai_default_header: Optional[Mapping[str, Any]] = None llm_openai_completion_kwargs: Mapping[str, Any] = {} llm_response_timeout: float = 60 - llm_sdk: Literal["openai", "anthropic", "mock"] = "openai" + llm_sdk: Literal["openai", "anthropic", "minimax", "mock"] = "openai" llm_simple_model: str = "gpt-4.1" diff --git a/src/server/core/config.yaml.example b/src/server/core/config.yaml.example index 5fbfaab46..783ee2801 100644 --- a/src/server/core/config.yaml.example +++ b/src/server/core/config.yaml.example @@ -1 +1,4 @@ -llm_api_key: YOUR-OPENAI-KEY \ No newline at end of file +llm_api_key: YOUR-MINIMAX-KEY +llm_base_url: https://api.minimax.io/v1 +llm_simple_model: MiniMax-M3 +llm_sdk: minimax