Skip to content

Commit eab26ec

Browse files
fix(microsoft-foundry): write canonical image model config (#121370)
Co-authored-by: Peter Steinberger <[email protected]>
1 parent 914f73a commit eab26ec

3 files changed

Lines changed: 14 additions & 19 deletions

File tree

‎docs/plugins/reference/microsoft-foundry.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ name in the request `model` field:
7474
{
7575
agents: {
7676
defaults: {
77-
imageGenerationModel: {
78-
primary: "microsoft-foundry/<deployment-name>",
79-
timeoutMs: 600000,
77+
mediaModels: {
78+
image: {
79+
primary: "microsoft-foundry/<deployment-name>",
80+
timeoutMs: 600000,
81+
},
8082
},
8183
},
8284
},

‎extensions/microsoft-foundry/index.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,10 @@ describe("microsoft-foundry plugin", () => {
932932
authMethod: "entra-id",
933933
});
934934

935-
expect(result.configPatch?.agents?.defaults?.imageGenerationModel).toEqual({
935+
expect(result.configPatch?.agents?.defaults?.mediaModels?.image).toEqual({
936936
primary: "microsoft-foundry/mai-image-prod",
937937
});
938+
expect(result.configPatch?.agents?.defaults).not.toHaveProperty("imageGenerationModel");
938939
expect(result.defaultModel).toBeUndefined();
939940
expect(requireFoundryProviderPatch(result).models[0]?.name).toBe("MAI-Image-2.5");
940941
});
@@ -986,7 +987,7 @@ describe("microsoft-foundry plugin", () => {
986987
modelNameHint: "MAI-Image-2.5",
987988
api: "openai-completions",
988989
});
989-
expect(result.configPatch?.agents?.defaults?.imageGenerationModel).toEqual({
990+
expect(result.configPatch?.agents?.defaults?.mediaModels?.image).toEqual({
990991
primary: "microsoft-foundry/prod-image",
991992
});
992993
expect(result.defaultModel).toBeUndefined();
@@ -1150,7 +1151,7 @@ describe("microsoft-foundry plugin", () => {
11501151
],
11511152
});
11521153

1153-
expect(result.configPatch?.agents?.defaults?.imageGenerationModel).toEqual({
1154+
expect(result.configPatch?.agents?.defaults?.mediaModels?.image).toEqual({
11541155
primary: "microsoft-foundry/custom-image-prod",
11551156
});
11561157
expect(result.defaultModel).toBeUndefined();

‎extensions/microsoft-foundry/shared.ts‎

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,6 @@ type FoundryConfigShape = {
129129
};
130130
};
131131

132-
type FoundryImageDefaultPatch = {
133-
agents?: {
134-
defaults?: {
135-
imageGenerationModel?: {
136-
primary: string;
137-
};
138-
};
139-
};
140-
};
141-
142132
function normalizeFoundryModelName(value?: string | null): string | undefined {
143133
const trimmed = normalizeLowercaseStringOrEmpty(value);
144134
return trimmed || undefined;
@@ -614,15 +604,17 @@ function buildFoundryImageDefaultPatch(params: {
614604
modelId: string;
615605
modelNameHint?: string | null;
616606
deployments?: FoundryDeploymentConfigInput[];
617-
}): FoundryImageDefaultPatch {
607+
}) {
618608
if (!isSelectedMaiImageDeployment(params)) {
619609
return {};
620610
}
621611
return {
622612
agents: {
623613
defaults: {
624-
imageGenerationModel: {
625-
primary: `${PROVIDER_ID}/${params.modelId}`,
614+
mediaModels: {
615+
image: {
616+
primary: `${PROVIDER_ID}/${params.modelId}`,
617+
},
626618
},
627619
},
628620
},

0 commit comments

Comments
 (0)