Skip to content

Commit 7d069f0

Browse files
Ninot1QuyiOmX
andcommitted
Merge pull request #744 from Sweaterdog/update-andy-model-info
Bring in the Andy 4.2 profile and README guidance from the upstream PR while converting the profile to this branch's provider-registry schema. LM Studio is registered as a local OpenAI-compatible provider/embedding provider, and the OpenAI-compatible adapter now respects an explicit null keyName for no-key local servers. Constraint: Preserve the PR merge record and contributor commits instead of squashing Constraint: Profiles must use the local provider/model schema, not the PR's legacy api/model shorthand Rejected: Keep the PR profile format unchanged | it bypasses the provider registry used by this branch Confidence: high Scope-risk: moderate Tested: node -e "for (const f of ['settings_llm_providers.example.json','settings_llm_providers.json','profiles/andy-4.2.json']) if (require('fs').existsSync(f)) JSON.parse(require('fs').readFileSync(f,'utf8'))" Tested: MINDCRAFT_LLM_PROVIDERS_PATH=settings_llm_providers.example.json node --input-type=module provider resolution smoke Tested: npx eslint src/models/_model_map.js src/models/openai_compatible.js Tested: git diff --check Not-tested: Live LM Studio Andy 4.2 request; requires local LM Studio server and model Co-authored-by: OmX <omx@oh-my-codex.dev>
2 parents 6a99ae5 + 8b7a593 commit 7d069f0

7 files changed

Lines changed: 36 additions & 36 deletions

File tree

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,8 @@ You can configure the agent's name, model, and prompts in their profile like `an
8080

8181
For more comprehensive model configuration and syntax, see [Model Specifications](#model-specifications).
8282

83-
For local models we support [ollama](https://ollama.com/) and we provide our own finetuned models for you to use.
84-
To install our models, install ollama and run the following terminal command:
85-
```bash
86-
ollama pull sweaterdog/andy-4:micro-q8_0 && ollama pull embeddinggemma
87-
```
83+
For local models, we recommend you use **LM Studio** for the Andy series of models. Ollama breaks current models, and should be avoided.
84+
Please see our [huggingface page for more info.](https://huggingface.co/collections/Mindcraft-CE)
8885

8986
## Online Servers
9087
To connect to online servers your bot will need an official Microsoft/Minecraft account. You can use your own personal one, but will need another account if you want to connect too and play with it. To connect, change these lines in `settings.js`:
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "andy_4_thinking",
2+
"name": "andy_4_2",
33
"model": {
4-
"provider": "ollama_local",
5-
"model": "sweaterdog/andy-4:micro-q8_0"
4+
"provider": "lmstudio",
5+
"model": "andy-4.2"
66
},
77
"embedding": {
8-
"provider": "",
9-
"model": ""
8+
"provider": "lmstudio",
9+
"model": "text-embedding-nomic-embed-text-v1.5"
1010
},
1111
"code_model": {
1212
"provider": "",

profiles/andy-4.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const settings = {
1010

1111
"base_profile": "assistant", // survival, assistant, creative, or god_mode
1212
"load_memory": true, // load memory from previous session
13+
1314
"init_message": "Respond with hello world and your name", // sends to all on spawn
1415
"only_chat_with": [], // users that the bots listen to and send general messages to. if empty it will chat publicly
1516

@@ -88,8 +89,7 @@ const settings = {
8889
// "profiles/replicate.json",
8990
// "profiles/llama.json",
9091
// "profiles/vllm.json",
91-
// "profiles/andy-4.json",
92-
// "profiles/andy-4-reasoning.json",
92+
// "profiles/andy-4.2.json", // Andy 4.2 via local LM Studio OpenAI-compatible server
9393
// "profiles/freeguy.json",
9494
],
9595
};

settings_llm_providers.example.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@
235235
"baseUrl": "https://api.together.xyz/v1",
236236
"keyName": "TOGETHER_API_KEY",
237237
"defaultModel": "meta-llama/Llama-3-70b-chat-hf"
238+
},
239+
"lmstudio": {
240+
"format": "openai-completions",
241+
"baseUrl": "http://127.0.0.1:1234/v1",
242+
"keyName": null,
243+
"defaultModel": "andy-4.2",
244+
"comment": "Local LM Studio OpenAI-compatible server. Start LM Studio's local server and load the Andy 4.2 model before using profiles/andy-4.2.json."
238245
}
239246
},
240247
"embeddings": {
@@ -282,6 +289,13 @@
282289
"format": "replicate",
283290
"keyName": "REPLICATE_API_KEY",
284291
"defaultModel": "mark3labs/embeddings-gte-base"
292+
},
293+
"lmstudio": {
294+
"format": "openai-embeddings",
295+
"baseUrl": "http://127.0.0.1:1234/v1",
296+
"keyName": null,
297+
"defaultModel": "text-embedding-nomic-embed-text-v1.5",
298+
"comment": "Local LM Studio embeddings endpoint for Andy 4.2 profile examples."
285299
}
286300
},
287301
"schemaVersion": 1

src/models/_model_map.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function applyProviderRegistry(profile, registry, label) {
8686
...(profile.params || {})
8787
};
8888
for (const [key, value] of Object.entries(mergedParams)) {
89-
if (value === null || value === undefined) {
89+
if ((value === null || value === undefined) && key !== 'apiKeyName' && key !== 'api_key_name') {
9090
delete mergedParams[key];
9191
}
9292
}
@@ -101,7 +101,7 @@ function applyProviderRegistry(profile, registry, label) {
101101
}
102102

103103
function normalizeProviderConfig(providerName, provider) {
104-
const keyName = provider.keyName || provider.key_name || provider.apiKeyName || provider.api_key_name;
104+
const keyName = firstDefined(provider.keyName, provider.key_name, provider.apiKeyName, provider.api_key_name);
105105
const baseUrl = provider.baseUrl || provider.base_url || provider.baseURL || provider.url;
106106
const format = provider.format || provider.apiFormat || provider.api_format || provider.protocol || provider.api;
107107
const api = provider.adapter || provider.api || apiFromFormat(format);
@@ -111,7 +111,7 @@ function normalizeProviderConfig(providerName, provider) {
111111
model: provider.model || provider.defaultModel || provider.default_model,
112112
url: baseUrl,
113113
params: {
114-
...(keyName ? { apiKeyName: keyName } : {}),
114+
...(keyName !== undefined ? { apiKeyName: keyName } : {}),
115115
...(api === 'openai-completions' || api === 'openai-compatible' ? { provider: providerName } : {}),
116116
...(api === 'anthropic-messages' ? { provider: providerName } : {}),
117117
...(api === 'replicate' ? { provider: providerName } : {}),
@@ -122,6 +122,10 @@ function normalizeProviderConfig(providerName, provider) {
122122
};
123123
}
124124

125+
function firstDefined(...values) {
126+
return values.find(value => value !== undefined);
127+
}
128+
125129
function apiFromFormat(format) {
126130
const normalized = String(format || '').toLowerCase();
127131
const aliases = {
@@ -195,4 +199,4 @@ export function createModel(profile) {
195199
}
196200
const model = new apiMap[profile.api](profile.model, profile.url, profile.params);
197201
return model;
198-
}
202+
}

src/models/openai_compatible.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ export class OpenAICompletions {
4040

4141
initClient() {
4242
this.params = this.params || {};
43-
const apiKeyName = this.params.apiKeyName || this.params.api_key_name || 'OPENAI_API_KEY';
43+
const hasExplicitApiKeyName = Object.prototype.hasOwnProperty.call(this.params, 'apiKeyName') ||
44+
Object.prototype.hasOwnProperty.call(this.params, 'api_key_name');
45+
const apiKeyName = hasExplicitApiKeyName
46+
? (this.params.apiKeyName ?? this.params.api_key_name)
47+
: 'OPENAI_API_KEY';
4448
this.provider = this.params.provider || this.params.providerName || this.params.provider_name || inferProviderName(this.url) || 'openai';
4549
this.default_model = this.params.defaultModel || this.params.default_model || this.default_model || this.model_name;
4650

0 commit comments

Comments
 (0)