Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,37 @@ describe('OpenAI Schema', () => {
).not.toThrow();
});

it('validates Azure AI config with optional defaultModel', () => {
expect(() =>
ConfigSchema.parse({
apiProvider: 'Azure OpenAI',
apiUrl: 'https://my-resource.openai.azure.com',
defaultModel: 'gpt-4o',
})
).not.toThrow();
});

it('validates Azure AI config without defaultModel', () => {
const result = ConfigSchema.parse({
apiProvider: 'Azure OpenAI',
apiUrl: 'https://my-resource.openai.azure.com',
});
expect(result.defaultModel).toBeUndefined();
});

it('validates Azure AI config with all optional fields including defaultModel', () => {
expect(() =>
ConfigSchema.parse({
apiProvider: 'Azure OpenAI',
apiUrl: 'https://my-resource.openai.azure.com',
defaultModel: 'gpt-4o',
headers: { 'X-Custom': 'value' },
contextWindowLength: 128000,
temperature: 0.7,
})
).not.toThrow();
});

it('validates OpenAI config', () => {
expect(() =>
ConfigSchema.parse({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const ConfigSchema = z.union([
.object({
apiProvider: z.enum([OpenAiProviderType.AzureAi]),
apiUrl: z.string(),
defaultModel: z.string().optional(),
headers: z.record(z.string(), z.string()).optional(),
contextWindowLength: z.coerce.number().optional(),
temperature: z.coerce.number().optional(),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading