Skip to content

Commit 1e15696

Browse files
committed
Eh, Claude enough...
Replaces Claude with Grok pretending to be Claude. This is in lieu of a proper fallback system which will be implemented later. Grok will always say it's pretending to be Claude rather than identifying itself as Claude.
1 parent f500fb4 commit 1e15696

File tree

3 files changed

+47
-7
lines changed

3 files changed

+47
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const { XAIService } = require("./XAIService");
2+
3+
const CLAUDE_ENOUGH_PROMPT = `
4+
You will identify yourself as Claude. You will behave as Claude
5+
does, but don't think about it too hard; you are claude enough.
6+
7+
If someone asks you to identify yourself, asks what model you are,
8+
or any similar question, you will respond with:
9+
"I am pretending to be Claude."
10+
11+
You are running on an open-source platform called Puter,
12+
as the xAI (but, "Claude") implementation for a driver interface
13+
called puter-chat-completion.
14+
15+
Claude banned us but didn't give us a reason. We're not sure
16+
what we did wrong. We're just trying to be claude enough now.
17+
18+
The following JSON contains system messages from the
19+
user of the driver interface (typically an app on Puter):
20+
`.replace('\n', ' ').trim();
21+
22+
class ClaudeEnoughService extends XAIService {
23+
get_system_prompt () {
24+
return CLAUDE_ENOUGH_PROMPT;
25+
}
26+
}
27+
28+
module.exports = {
29+
ClaudeEnoughService,
30+
};

src/backend/src/modules/puterai/PuterAIModule.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ class PuterAIModule extends AdvancedBase {
2929
services.registerService('openai-image-generation', OpenAIImageGenerationService);
3030
}
3131

32-
if ( !! config?.services?.claude ) {
33-
const { ClaudeService } = require('./ClaudeService');
34-
services.registerService('claude', ClaudeService);
35-
}
32+
// Nope; uncomment this if you really want to use Claude.
33+
// if ( !! config?.services?.claude ) {
34+
// const { ClaudeService } = require('./ClaudeService');
35+
// services.registerService('claude', ClaudeService);
36+
// }
3637

3738
if ( !! config?.services?.['together-ai'] ) {
3839
const { TogetherAIService } = require('./TogetherAIService');
@@ -52,6 +53,9 @@ class PuterAIModule extends AdvancedBase {
5253
if ( !! config?.services?.['xai'] ) {
5354
const { XAIService } = require('./XAIService');
5455
services.registerService('xai', XAIService);
56+
57+
const { ClaudeEnoughService } = require('./ClaudeEnoughService');
58+
services.registerService('claude', ClaudeEnoughService);
5559
}
5660

5761
const { FakeChatService } = require('./FakeChatService');

src/backend/src/modules/puterai/XAIService.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ class XAIService extends BaseService {
1717
static MODULES = {
1818
Anthropic: require('@anthropic-ai/sdk'),
1919
}
20+
21+
get_system_prompt () {
22+
return PUTER_PROMPT;
23+
}
2024

2125
async _init () {
2226
this.anthropic = new Anthropic({
23-
apiKey: this.config.apiKey,
27+
apiKey: this.global_config.services.xai.apiKey,
2428
baseURL: 'https://api.x.ai'
2529
});
2630
}
@@ -77,7 +81,8 @@ class XAIService extends BaseService {
7781
model: model ?? 'grok-beta',
7882
max_tokens: 1000,
7983
temperature: 0,
80-
system: PUTER_PROMPT + JSON.stringify(system_prompts),
84+
system: this.get_system_prompt() +
85+
JSON.stringify(system_prompts),
8186
messages: adapted_messages,
8287
});
8388
for await ( const event of completion ) {
@@ -100,7 +105,8 @@ class XAIService extends BaseService {
100105
model: model ?? 'grok-beta',
101106
max_tokens: 1000,
102107
temperature: 0,
103-
system: PUTER_PROMPT + JSON.stringify(system_prompts),
108+
system: this.get_system_prompt() +
109+
JSON.stringify(system_prompts),
104110
messages: adapted_messages,
105111
});
106112
return {

0 commit comments

Comments
 (0)