Skip to content

Commit 0fd011e

Browse files
committed
refactor!: Rename model and providerid to name.
1 parent 686c1f3 commit 0fd011e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

packages/sdk/server-ai/__tests__/LDAIClientImpl.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ it('returns config with interpolated messagess', async () => {
1515
const client = new LDAIClientImpl(mockLdClient);
1616
const key = 'test-flag';
1717
const defaultValue: LDAIDefaults = {
18-
model: { id: 'test', parameters: { name: 'test-model' } },
18+
model: { name: 'test', parameters: { name: 'test-model' } },
1919
messages: [],
2020
enabled: true,
2121
};
2222

2323
const mockVariation = {
2424
model: {
25-
id: 'example-model',
25+
name: 'example-model',
2626
parameters: { name: 'imagination', temperature: 0.7, maxTokens: 4096 },
2727
},
2828
provider: {
29-
id: 'example-provider',
29+
name: 'example-provider',
3030
},
3131
messages: [
3232
{ role: 'system', content: 'Hello {{name}}' },
@@ -45,11 +45,11 @@ it('returns config with interpolated messagess', async () => {
4545

4646
expect(result).toEqual({
4747
model: {
48-
id: 'example-model',
48+
name: 'example-model',
4949
parameters: { name: 'imagination', temperature: 0.7, maxTokens: 4096 },
5050
},
5151
provider: {
52-
id: 'example-provider',
52+
name: 'example-provider',
5353
},
5454
messages: [
5555
{ role: 'system', content: 'Hello John' },
@@ -64,7 +64,7 @@ it('includes context in variables for messages interpolation', async () => {
6464
const client = new LDAIClientImpl(mockLdClient);
6565
const key = 'test-flag';
6666
const defaultValue: LDAIDefaults = {
67-
model: { id: 'test', parameters: { name: 'test-model' } },
67+
model: { name: 'test', parameters: { name: 'test-model' } },
6868
messages: [],
6969
};
7070

@@ -84,12 +84,12 @@ it('handles missing metadata in variation', async () => {
8484
const client = new LDAIClientImpl(mockLdClient);
8585
const key = 'test-flag';
8686
const defaultValue: LDAIDefaults = {
87-
model: { id: 'test', parameters: { name: 'test-model' } },
87+
model: { name: 'test', parameters: { name: 'test-model' } },
8888
messages: [],
8989
};
9090

9191
const mockVariation = {
92-
model: { id: 'example-provider', parameters: { name: 'imagination' } },
92+
model: { name: 'example-provider', parameters: { name: 'imagination' } },
9393
messages: [{ role: 'system', content: 'Hello' }],
9494
};
9595

@@ -98,7 +98,7 @@ it('handles missing metadata in variation', async () => {
9898
const result = await client.config(key, testContext, defaultValue);
9999

100100
expect(result).toEqual({
101-
model: { id: 'example-provider', parameters: { name: 'imagination' } },
101+
model: { name: 'example-provider', parameters: { name: 'imagination' } },
102102
messages: [{ role: 'system', content: 'Hello' }],
103103
tracker: expect.any(Object),
104104
enabled: false,
@@ -109,8 +109,8 @@ it('passes the default value to the underlying client', async () => {
109109
const client = new LDAIClientImpl(mockLdClient);
110110
const key = 'non-existent-flag';
111111
const defaultValue: LDAIDefaults = {
112-
model: { id: 'default-model', parameters: { name: 'default' } },
113-
provider: { id: 'default-provider' },
112+
model: { name: 'default-model', parameters: { name: 'default' } },
113+
provider: { name: 'default-provider' },
114114
messages: [{ role: 'system', content: 'Default messages' }],
115115
enabled: true,
116116
};

packages/sdk/server-ai/src/api/config/LDAIConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface LDModelConfig {
77
/**
88
* The ID of the model.
99
*/
10-
id: string;
10+
name: string;
1111

1212
/**
1313
* Model specific parameters.
@@ -24,7 +24,7 @@ export interface LDProviderConfig {
2424
/**
2525
* The ID of the provider.
2626
*/
27-
id: string;
27+
name: string;
2828
}
2929

3030
/**

0 commit comments

Comments
 (0)