mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-09-13 18:37:25 +00:00
🐛 fix: Route Bedrock document types through the provider
Bedrock's Converse path natively accepts DOC, DOCX, XLS, XLSX and more, but the system defaults marked only PDF for provider delivery, so unified mode replaced native document blocks with text extraction and lost non-text content and layout. Those types now default to the provider path on bedrock; other endpoints and explicit config are unaffected.
This commit is contained in:
parent
d6a70e6396
commit
012499e7f4
2 changed files with 34 additions and 1 deletions
|
|
@ -168,6 +168,27 @@ describe('resolveDefaultLLMDeliveryPath', () => {
|
|||
).toBe('provider');
|
||||
});
|
||||
|
||||
it('routes Bedrock document types through the provider on bedrock', () => {
|
||||
const docx = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
||||
expect(resolveDefaultLLMDeliveryPath(docx, undefined, undefined, 'bedrock')).toBe('provider');
|
||||
expect(
|
||||
resolveDefaultLLMDeliveryPath('application/msword', undefined, undefined, 'bedrock'),
|
||||
).toBe('provider');
|
||||
});
|
||||
|
||||
it('keeps Bedrock document types on text for other endpoints', () => {
|
||||
const docx = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
||||
expect(resolveDefaultLLMDeliveryPath(docx, undefined, undefined, 'openAI')).toBe('text');
|
||||
expect(resolveDefaultLLMDeliveryPath(docx)).toBe('text');
|
||||
});
|
||||
|
||||
it('lets explicit config override the Bedrock document default', () => {
|
||||
const docx = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
||||
expect(resolveDefaultLLMDeliveryPath(docx, { fallback: 'text' }, undefined, 'bedrock')).toBe(
|
||||
'text',
|
||||
);
|
||||
});
|
||||
|
||||
it('should export SYSTEM_LLM_DELIVERY_DEFAULTS with correct shape', () => {
|
||||
expect(SYSTEM_LLM_DELIVERY_DEFAULTS.fallback).toBe('text');
|
||||
expect(SYSTEM_LLM_DELIVERY_DEFAULTS.overrides).toEqual({
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { TDefaultLLMDeliveryPath, TDefaultLLMDeliveryPathConfig } from './file-config';
|
||||
import { isDocumentSupportedProvider, isMediaSupportedProvider } from './schemas';
|
||||
import { EModelEndpoint, isDocumentSupportedProvider, isMediaSupportedProvider } from './schemas';
|
||||
import { isBedrockDocumentType } from './file-config';
|
||||
|
||||
/** Audio and video reach the model only through the media encoders, which support a
|
||||
* narrower provider set than documents. Images use the broadly supported vision
|
||||
|
|
@ -73,5 +74,16 @@ export function resolveDefaultLLMDeliveryPath(
|
|||
return 'text';
|
||||
}
|
||||
|
||||
/** Bedrock's Converse document path natively accepts more than PDF, so on that
|
||||
* endpoint its document types belong on the provider path rather than being
|
||||
* extracted, which would drop non-text content and layout. */
|
||||
if (
|
||||
systemDefault !== 'provider' &&
|
||||
endpoint === EModelEndpoint.bedrock &&
|
||||
isBedrockDocumentType(mimeType)
|
||||
) {
|
||||
return 'provider';
|
||||
}
|
||||
|
||||
return systemDefault;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue