mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-03 22:32:42 +00:00
🪨 fix: Preserve Bedrock Guardrail Config (#13381)
This commit is contained in:
parent
94c73123ee
commit
786dae41bd
2 changed files with 36 additions and 0 deletions
|
|
@ -29,6 +29,34 @@ describe('excludedKeys', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('bedrockEndpointSchema', () => {
|
||||
it('preserves guardrailConfig from configSchema parsing', () => {
|
||||
const guardrailConfig = {
|
||||
guardrailIdentifier: '${BEDROCK_GUARDRAIL_ID}',
|
||||
guardrailVersion: '${BEDROCK_GUARDRAIL_VERSION}',
|
||||
trace: 'enabled_full',
|
||||
streamProcessingMode: 'sync',
|
||||
};
|
||||
|
||||
const result = configSchema.safeParse({
|
||||
version: '1.0',
|
||||
endpoints: {
|
||||
bedrock: {
|
||||
streamRate: 25,
|
||||
availableRegions: ['us-west-2'],
|
||||
guardrailConfig,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
if (!result.success) {
|
||||
return;
|
||||
}
|
||||
expect(result.data.endpoints?.bedrock?.guardrailConfig).toEqual(guardrailConfig);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveEndpointType', () => {
|
||||
describe('non-agents endpoints', () => {
|
||||
it('returns the config type for a custom endpoint', () => {
|
||||
|
|
|
|||
|
|
@ -403,10 +403,18 @@ export const baseEndpointSchema = z.object({
|
|||
|
||||
export type TBaseEndpoint = z.infer<typeof baseEndpointSchema>;
|
||||
|
||||
export const bedrockGuardrailConfigSchema = z.object({
|
||||
guardrailIdentifier: z.string(),
|
||||
guardrailVersion: z.string(),
|
||||
trace: z.enum(['enabled', 'disabled', 'enabled_full']).optional(),
|
||||
streamProcessingMode: z.enum(['sync', 'async']).optional(),
|
||||
});
|
||||
|
||||
export const bedrockEndpointSchema = baseEndpointSchema.merge(
|
||||
z.object({
|
||||
availableRegions: z.array(z.string()).optional(),
|
||||
models: z.array(z.string()).optional(),
|
||||
guardrailConfig: bedrockGuardrailConfigSchema.optional(),
|
||||
inferenceProfiles: z.record(z.string(), z.string()).optional(),
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue