Skip to content

Commit

Permalink
Merge pull request #515 from dcSpark/bence/add-claude-models
Browse files Browse the repository at this point in the history
feat: add claude models
  • Loading branch information
nicarq authored Nov 6, 2024
2 parents e73ab8c + dd56d14 commit 050cb67
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/shinkai-desktop/src/components/chat/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const streamingSupportedModels = [
Models.Exo,
Models.Gemini,
Models.OpenRouter,
Models.Claude,
];

export const ARTIFACTS_SYSTEM_PROMPT = `
Expand Down
6 changes: 6 additions & 0 deletions apps/shinkai-desktop/src/pages/create-agent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ const modelOptions: { value: Models; label: string }[] = [
value: Models.Exo,
label: 'Exo',
},
{
value: Models.Claude,
label: 'Claude',
},
];

export const getModelObject = (
Expand All @@ -84,6 +88,8 @@ export const getModelObject = (
return { Gemini: { model_type: modelType } };
case Models.Exo:
return { Exo: { model_type: modelType } };
case Models.Claude:
return { Claude: { model_type: modelType } };
default:
return { [model]: { model_type: modelType } };
}
Expand Down
2 changes: 2 additions & 0 deletions apps/shinkai-visor/src/components/agents/add-agent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export const getModelObject = (
return { Groq: { model_type: modelType } };
case Models.OpenRouter:
return { OpenRouter: { model_type: modelType } };
case Models.Claude:
return { Claude: { model_type: modelType } };
default:
return { [model]: { model_type: modelType } };
}
Expand Down
2 changes: 2 additions & 0 deletions libs/shinkai-message-ts/src/api/jobs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ function getModelString(model: LLMProviderInterface): string {
return 'openrouter:' + model.OpenRouter.model_type;
} else if (model?.Exo?.model_type) {
return 'exo:' + model.Exo.model_type;
} else if (model?.Claude?.model_type) {
return 'claude:' + model.Claude.model_type;
} else if (Object.keys(model).length > 0) {
const customModelProvider = Object.keys(model)[0];
return `${customModelProvider}:${model[customModelProvider].model_type}`;
Expand Down
5 changes: 5 additions & 0 deletions libs/shinkai-message-ts/src/api/jobs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export type LLMProviderInterface = {
Exo?: Exo;
Groq?: Groq;
OpenRouter?: OpenRouter;
Claude?: Claude;
} & {
[model: string]: ModelType;
};
Expand Down Expand Up @@ -219,6 +220,10 @@ export interface Exo {
model_type: string;
}

export interface Claude {
model_type: string;
}

export type SerializedLLMProvider = {
id: string;
full_identity_name: string;
Expand Down
5 changes: 5 additions & 0 deletions libs/shinkai-message-ts/src/models/SchemaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export type AgentAPIModel = {
Ollama?: Ollama;
Gemini?: Gemini;
Exo?: Exo;
Claude?: Claude;
} & {
[model: string]: ModelType;
};
Expand Down Expand Up @@ -303,6 +304,10 @@ export interface Exo {
model_type: string;
}

export interface Claude {
model_type: string;
}

export interface APIAddAgentRequest {
agent: SerializedLLMProvider;
}
Expand Down
22 changes: 22 additions & 0 deletions libs/shinkai-node-state/src/lib/utils/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export enum Models {
Exo = 'exo',
Groq = 'groq',
OpenRouter = 'openrouter',
Claude = 'claude',
}

export const modelsConfig = {
Expand Down Expand Up @@ -107,4 +108,25 @@ export const modelsConfig = {
apiUrl: 'https://openrouter.ai',
modelTypes: [],
},
[Models.Claude]: {
apiUrl: 'https://api.anthropic.com',
modelTypes: [
{
name: 'Claude 3.5 Sonnet',
value: 'claude-3-5-sonnet-latest',
},
{
name: 'Claude 3 Opus',
value: 'claude-3-opus-latest',
},
{
name: 'Claude 3 Sonnet',
value: 'claude-3-sonnet-20240229',
},
{
name: 'Claude 3 Haiku',
value: 'claude-3-haiku-20240307',
},
],
},
};

0 comments on commit 050cb67

Please sign in to comment.