Skip to content

Commit 7da2f15

Browse files
authored
feat: pass through the LLM ID (#121) (#137)
1 parent f3b3bad commit 7da2f15

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ First, install the SDK in your project
3232
npm install @anam-ai/js-sdk
3333
```
3434

35+
## Deprecation Notice
36+
37+
**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.
38+
3539
## Local development
3640

3741
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`, {
8488
name: 'Cara',
8589
avatarId: '30fa96d0-26c4-4e55-94a0-517025942e18',
8690
voiceId: '6bfbe25a-979d-40f3-a92b-5394170af54b',
87-
brainType: 'ANAM_GPT_4O_MINI_V1',
91+
llmId: '<LLM ID HERE>',
8892
systemPrompt:
8993
"[STYLE] Reply in natural speech without formatting. Add pauses using '...' and very occasionally a disfluency. [PERSONALITY] You are Cara, a helpful assistant.",
9094
},

src/modules/CoreApiRestClient.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ export class CoreApiRestClient {
4747
this.sessionToken = await this.unsafe_getSessionToken(personaConfig);
4848
}
4949

50+
// Check if brainType is being used and log deprecation warning
51+
if (personaConfig && 'brainType' in personaConfig) {
52+
console.warn(
53+
'Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.',
54+
);
55+
}
56+
5057
try {
5158
const response = await fetch(`${this.getApiUrl()}/engine/session`, {
5259
method: 'POST',
@@ -139,6 +146,14 @@ export class CoreApiRestClient {
139146
if (!this.apiKey) {
140147
throw new Error('No apiKey provided');
141148
}
149+
150+
// Check if brainType is being used and log deprecation warning
151+
if (personaConfig && 'brainType' in personaConfig) {
152+
console.warn(
153+
'Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.',
154+
);
155+
}
156+
142157
let body: { clientLabel: string; personaConfig?: PersonaConfig } = {
143158
clientLabel: 'js-sdk-api-key',
144159
};

src/types/PersonaConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface CustomPersonaConfig {
55
name: string;
66
avatarId: string;
77
voiceId: string;
8-
brainType: string;
8+
llmId?: string;
99
systemPrompt?: string;
1010
maxSessionLengthSeconds?: number;
1111
languageCode?: string;
@@ -14,5 +14,5 @@ export interface CustomPersonaConfig {
1414
export function isCustomPersonaConfig(
1515
personaConfig: PersonaConfig,
1616
): personaConfig is CustomPersonaConfig {
17-
return 'brainType' in personaConfig;
17+
return 'brainType' in personaConfig || 'llmId' in personaConfig;
1818
}

0 commit comments

Comments
 (0)