diff --git a/README.md b/README.md index 5906af1..b5f69fd 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ First, install the SDK in your project npm install @anam-ai/js-sdk ``` +## Deprecation Notice + +**Important**: The `brainType` field in `PersonaConfig` is deprecated and will be removed in a future version. Please use `llmId` instead. If you are currently using `brainType`, you will see a deprecation warning in the console. Both fields are supported during the transition period. + ## Local development The quickest way to start testing the SDK is to use your API key directly with our SDK and the example persona config shown below. @@ -84,7 +88,7 @@ const response = await fetch(`https://api.anam.ai/v1/auth/session-token`, { name: 'Cara', avatarId: '30fa96d0-26c4-4e55-94a0-517025942e18', voiceId: '6bfbe25a-979d-40f3-a92b-5394170af54b', - brainType: 'ANAM_GPT_4O_MINI_V1', + llmId: '', systemPrompt: "[STYLE] Reply in natural speech without formatting. Add pauses using '...' and very occasionally a disfluency. [PERSONALITY] You are Cara, a helpful assistant.", }, diff --git a/src/modules/CoreApiRestClient.ts b/src/modules/CoreApiRestClient.ts index 33844f8..59bc82c 100644 --- a/src/modules/CoreApiRestClient.ts +++ b/src/modules/CoreApiRestClient.ts @@ -47,6 +47,13 @@ export class CoreApiRestClient { this.sessionToken = await this.unsafe_getSessionToken(personaConfig); } + // Check if brainType is being used and log deprecation warning + if (personaConfig && 'brainType' in personaConfig) { + console.warn( + 'Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.', + ); + } + try { const response = await fetch(`${this.getApiUrl()}/engine/session`, { method: 'POST', @@ -139,6 +146,14 @@ export class CoreApiRestClient { if (!this.apiKey) { throw new Error('No apiKey provided'); } + + // Check if brainType is being used and log deprecation warning + if (personaConfig && 'brainType' in personaConfig) { + console.warn( + 'Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.', + ); + } + let body: { clientLabel: string; personaConfig?: PersonaConfig } = { clientLabel: 'js-sdk-api-key', }; diff --git a/src/types/PersonaConfig.ts b/src/types/PersonaConfig.ts index c022863..ca49f23 100644 --- a/src/types/PersonaConfig.ts +++ b/src/types/PersonaConfig.ts @@ -5,7 +5,7 @@ export interface CustomPersonaConfig { name: string; avatarId: string; voiceId: string; - brainType: string; + llmId?: string; systemPrompt?: string; maxSessionLengthSeconds?: number; languageCode?: string; @@ -14,5 +14,5 @@ export interface CustomPersonaConfig { export function isCustomPersonaConfig( personaConfig: PersonaConfig, ): personaConfig is CustomPersonaConfig { - return 'brainType' in personaConfig; + return 'brainType' in personaConfig || 'llmId' in personaConfig; }