2024-02-08 10:06:58 -05:00
|
|
|
const axios = require('axios');
|
🪨 feat: AWS Bedrock support (#3935)
* feat: Add BedrockIcon component to SVG library
* feat: EModelEndpoint.bedrock
* feat: first pass, bedrock chat. note: AgentClient is returning `agents` as conversation.endpoint
* fix: declare endpoint in initialization step
* chore: Update @librechat/agents dependency to version 1.4.5
* feat: backend content aggregation for agents/bedrock
* feat: abort agent requests
* feat: AWS Bedrock icons
* WIP: agent provider schema parsing
* chore: Update EditIcon props type
* refactor(useGenerationsByLatest): make agents and bedrock editable
* refactor: non-assistant message content, parts
* fix: Bedrock response `sender`
* fix: use endpointOption.model_parameters not endpointOption.modelOptions
* fix: types for step handler
* refactor: Update Agents.ToolCallDelta type
* refactor: Remove unnecessary assignment of parentMessageId in AskController
* refactor: remove unnecessary assignment of parentMessageId (agent request handler)
* fix(bedrock/agents): message regeneration
* refactor: dynamic form elements using react-hook-form Controllers
* fix: agent icons/labels for messages
* fix: agent actions
* fix: use of new dynamic tags causing application crash
* refactor: dynamic settings touch-ups
* refactor: update Slider component to allow custom track class name
* refactor: update DynamicSlider component styles
* refactor: use Constants value for GLOBAL_PROJECT_NAME (enum)
* feat: agent share global methods/controllers
* fix: agents query
* fix: `getResponseModel`
* fix: share prompt a11y issue
* refactor: update SharePrompt dialog theme styles
* refactor: explicit typing for SharePrompt
* feat: add agent roles/permissions
* chore: update @librechat/agents dependency to version 1.4.7 for tool_call_ids edge case
* fix(Anthropic): messages.X.content.Y.tool_use.input: Input should be a valid dictionary
* fix: handle text parts with tool_call_ids and empty text
* fix: role initialization
* refactor: don't make instructions required
* refactor: improve typing of Text part
* fix: setShowStopButton for agents route
* chore: remove params for now
* fix: add streamBuffer and streamRate to help prevent 'Overloaded' errors from Anthropic API
* refactor: remove console.log statement in ContentRender component
* chore: typing, rename Context to Delete Button
* chore(DeleteButton): logging
* refactor(Action): make accessible
* style(Action): improve a11y again
* refactor: remove use/mention of mongoose sessions
* feat: first pass, sharing agents
* feat: visual indicator for global agent, remove author when serving to non-author
* wip: params
* chore: fix typing issues
* fix(schemas): typing
* refactor: improve accessibility of ListCard component and fix console React warning
* wip: reset templates for non-legacy new convos
* Revert "wip: params"
This reverts commit f8067e91d4adf7be9e0d9e914aaae79ac4689b80.
* Revert "refactor: dynamic form elements using react-hook-form Controllers"
This reverts commit 2150c4815d8c74a978a4b697aa8f54dc11e035d7.
* fix(Parameters): types and parameter effect update to only update local state to parameters
* refactor: optimize useDebouncedInput hook for better performance
* feat: first pass, anthropic bedrock params
* chore: paramEndpoints check for endpointType too
* fix: maxTokens to use coerceNumber.optional(),
* feat: extra chat model params
* chore: reduce code repetition
* refactor: improve preset title handling in SaveAsPresetDialog component
* refactor: improve preset handling in HeaderOptions component
* chore: improve typing, replace legacy dialog for SaveAsPresetDialog
* feat: save as preset from parameters panel
* fix: multi-search in select dropdown when using Option type
* refactor: update default showDefault value to false in Dynamic components
* feat: Bedrock presets settings
* chore: config, fix agents schema, update config version
* refactor: update AWS region variable name in bedrock options endpoint to BEDROCK_AWS_DEFAULT_REGION
* refactor: update baseEndpointSchema in config.ts to include baseURL property
* refactor: update createRun function to include req parameter and set streamRate based on provider
* feat: availableRegions via config
* refactor: remove unused demo agent controller file
* WIP: title
* Update @librechat/agents to version 1.5.0
* chore: addTitle.js to handle empty responseText
* feat: support images and titles
* feat: context token updates
* Refactor BaseClient test to use expect.objectContaining
* refactor: add model select, remove header options params, move side panel params below prompts
* chore: update models list, catch title error
* feat: model service for bedrock models (env)
* chore: Remove verbose debug log in AgentClient class following stream
* feat(bedrock): track token spend; fix: token rates, value key mapping for AWS models
* refactor: handle streamRate in `handleLLMNewToken` callback
* chore: AWS Bedrock example config in `.env.example`
* refactor: Rename bedrockMeta to bedrockGeneral in settings.ts and use for AI21 and Amazon Bedrock providers
* refactor: Update `.env.example` with AWS Bedrock model IDs URL and additional notes
* feat: titleModel support for bedrock
* refactor: Update `.env.example` with additional notes for AWS Bedrock model IDs
2024-09-09 12:06:59 -04:00
|
|
|
const { EModelEndpoint, defaultModels } = require('librechat-data-provider');
|
2024-04-27 18:27:04 -04:00
|
|
|
const { logger } = require('~/config');
|
2024-02-08 10:06:58 -05:00
|
|
|
|
🪨 feat: AWS Bedrock support (#3935)
* feat: Add BedrockIcon component to SVG library
* feat: EModelEndpoint.bedrock
* feat: first pass, bedrock chat. note: AgentClient is returning `agents` as conversation.endpoint
* fix: declare endpoint in initialization step
* chore: Update @librechat/agents dependency to version 1.4.5
* feat: backend content aggregation for agents/bedrock
* feat: abort agent requests
* feat: AWS Bedrock icons
* WIP: agent provider schema parsing
* chore: Update EditIcon props type
* refactor(useGenerationsByLatest): make agents and bedrock editable
* refactor: non-assistant message content, parts
* fix: Bedrock response `sender`
* fix: use endpointOption.model_parameters not endpointOption.modelOptions
* fix: types for step handler
* refactor: Update Agents.ToolCallDelta type
* refactor: Remove unnecessary assignment of parentMessageId in AskController
* refactor: remove unnecessary assignment of parentMessageId (agent request handler)
* fix(bedrock/agents): message regeneration
* refactor: dynamic form elements using react-hook-form Controllers
* fix: agent icons/labels for messages
* fix: agent actions
* fix: use of new dynamic tags causing application crash
* refactor: dynamic settings touch-ups
* refactor: update Slider component to allow custom track class name
* refactor: update DynamicSlider component styles
* refactor: use Constants value for GLOBAL_PROJECT_NAME (enum)
* feat: agent share global methods/controllers
* fix: agents query
* fix: `getResponseModel`
* fix: share prompt a11y issue
* refactor: update SharePrompt dialog theme styles
* refactor: explicit typing for SharePrompt
* feat: add agent roles/permissions
* chore: update @librechat/agents dependency to version 1.4.7 for tool_call_ids edge case
* fix(Anthropic): messages.X.content.Y.tool_use.input: Input should be a valid dictionary
* fix: handle text parts with tool_call_ids and empty text
* fix: role initialization
* refactor: don't make instructions required
* refactor: improve typing of Text part
* fix: setShowStopButton for agents route
* chore: remove params for now
* fix: add streamBuffer and streamRate to help prevent 'Overloaded' errors from Anthropic API
* refactor: remove console.log statement in ContentRender component
* chore: typing, rename Context to Delete Button
* chore(DeleteButton): logging
* refactor(Action): make accessible
* style(Action): improve a11y again
* refactor: remove use/mention of mongoose sessions
* feat: first pass, sharing agents
* feat: visual indicator for global agent, remove author when serving to non-author
* wip: params
* chore: fix typing issues
* fix(schemas): typing
* refactor: improve accessibility of ListCard component and fix console React warning
* wip: reset templates for non-legacy new convos
* Revert "wip: params"
This reverts commit f8067e91d4adf7be9e0d9e914aaae79ac4689b80.
* Revert "refactor: dynamic form elements using react-hook-form Controllers"
This reverts commit 2150c4815d8c74a978a4b697aa8f54dc11e035d7.
* fix(Parameters): types and parameter effect update to only update local state to parameters
* refactor: optimize useDebouncedInput hook for better performance
* feat: first pass, anthropic bedrock params
* chore: paramEndpoints check for endpointType too
* fix: maxTokens to use coerceNumber.optional(),
* feat: extra chat model params
* chore: reduce code repetition
* refactor: improve preset title handling in SaveAsPresetDialog component
* refactor: improve preset handling in HeaderOptions component
* chore: improve typing, replace legacy dialog for SaveAsPresetDialog
* feat: save as preset from parameters panel
* fix: multi-search in select dropdown when using Option type
* refactor: update default showDefault value to false in Dynamic components
* feat: Bedrock presets settings
* chore: config, fix agents schema, update config version
* refactor: update AWS region variable name in bedrock options endpoint to BEDROCK_AWS_DEFAULT_REGION
* refactor: update baseEndpointSchema in config.ts to include baseURL property
* refactor: update createRun function to include req parameter and set streamRate based on provider
* feat: availableRegions via config
* refactor: remove unused demo agent controller file
* WIP: title
* Update @librechat/agents to version 1.5.0
* chore: addTitle.js to handle empty responseText
* feat: support images and titles
* feat: context token updates
* Refactor BaseClient test to use expect.objectContaining
* refactor: add model select, remove header options params, move side panel params below prompts
* chore: update models list, catch title error
* feat: model service for bedrock models (env)
* chore: Remove verbose debug log in AgentClient class following stream
* feat(bedrock): track token spend; fix: token rates, value key mapping for AWS models
* refactor: handle streamRate in `handleLLMNewToken` callback
* chore: AWS Bedrock example config in `.env.example`
* refactor: Rename bedrockMeta to bedrockGeneral in settings.ts and use for AI21 and Amazon Bedrock providers
* refactor: Update `.env.example` with AWS Bedrock model IDs URL and additional notes
* feat: titleModel support for bedrock
* refactor: Update `.env.example` with additional notes for AWS Bedrock model IDs
2024-09-09 12:06:59 -04:00
|
|
|
const {
|
|
|
|
fetchModels,
|
|
|
|
splitAndTrim,
|
|
|
|
getOpenAIModels,
|
|
|
|
getGoogleModels,
|
|
|
|
getBedrockModels,
|
|
|
|
getAnthropicModels,
|
|
|
|
} = require('./ModelService');
|
|
|
|
|
2024-02-08 10:06:58 -05:00
|
|
|
jest.mock('~/utils', () => {
|
|
|
|
const originalUtils = jest.requireActual('~/utils');
|
|
|
|
return {
|
|
|
|
...originalUtils,
|
|
|
|
processModelData: jest.fn((...args) => {
|
|
|
|
return originalUtils.processModelData(...args);
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
jest.mock('axios');
|
|
|
|
jest.mock('~/cache/getLogStores', () =>
|
|
|
|
jest.fn().mockImplementation(() => ({
|
|
|
|
get: jest.fn().mockResolvedValue(undefined),
|
|
|
|
set: jest.fn().mockResolvedValue(true),
|
|
|
|
})),
|
|
|
|
);
|
|
|
|
jest.mock('~/config', () => ({
|
|
|
|
logger: {
|
|
|
|
error: jest.fn(),
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
jest.mock('./Config/EndpointService', () => ({
|
|
|
|
config: {
|
|
|
|
openAIApiKey: 'mockedApiKey',
|
|
|
|
userProvidedOpenAI: false,
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
|
|
|
|
axios.get.mockResolvedValue({
|
|
|
|
data: {
|
|
|
|
data: [{ id: 'model-1' }, { id: 'model-2' }],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('fetchModels', () => {
|
|
|
|
it('fetches models successfully from the API', async () => {
|
|
|
|
const models = await fetchModels({
|
|
|
|
user: 'user123',
|
|
|
|
apiKey: 'testApiKey',
|
|
|
|
baseURL: 'https://api.test.com',
|
|
|
|
name: 'TestAPI',
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(models).toEqual(['model-1', 'model-2']);
|
|
|
|
expect(axios.get).toHaveBeenCalledWith(
|
|
|
|
expect.stringContaining('https://api.test.com/models'),
|
|
|
|
expect.any(Object),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('adds the user ID to the models query when option and ID are passed', async () => {
|
|
|
|
const models = await fetchModels({
|
|
|
|
user: 'user123',
|
|
|
|
apiKey: 'testApiKey',
|
|
|
|
baseURL: 'https://api.test.com',
|
|
|
|
userIdQuery: true,
|
|
|
|
name: 'TestAPI',
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(models).toEqual(['model-1', 'model-2']);
|
|
|
|
expect(axios.get).toHaveBeenCalledWith(
|
|
|
|
expect.stringContaining('https://api.test.com/models?user=user123'),
|
|
|
|
expect.any(Object),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
jest.clearAllMocks();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('fetchModels with createTokenConfig true', () => {
|
|
|
|
const data = {
|
|
|
|
data: [
|
|
|
|
{
|
|
|
|
id: 'model-1',
|
|
|
|
pricing: {
|
|
|
|
prompt: '0.002',
|
|
|
|
completion: '0.001',
|
|
|
|
},
|
|
|
|
context_length: 1024,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'model-2',
|
|
|
|
pricing: {
|
|
|
|
prompt: '0.003',
|
|
|
|
completion: '0.0015',
|
|
|
|
},
|
|
|
|
context_length: 2048,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
// Clears the mock's history before each test
|
|
|
|
const _utils = require('~/utils');
|
|
|
|
axios.get.mockResolvedValue({ data });
|
|
|
|
});
|
|
|
|
|
|
|
|
it('creates and stores token configuration if createTokenConfig is true', async () => {
|
|
|
|
await fetchModels({
|
|
|
|
user: 'user123',
|
|
|
|
apiKey: 'testApiKey',
|
|
|
|
baseURL: 'https://api.test.com',
|
|
|
|
createTokenConfig: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const { processModelData } = require('~/utils');
|
|
|
|
expect(processModelData).toHaveBeenCalled();
|
|
|
|
expect(processModelData).toHaveBeenCalledWith(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('getOpenAIModels', () => {
|
|
|
|
let originalEnv;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
originalEnv = { ...process.env };
|
|
|
|
axios.get.mockRejectedValue(new Error('Network error'));
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
process.env = originalEnv;
|
|
|
|
axios.get.mockReset();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns default models when no environment configurations are provided (and fetch fails)', async () => {
|
|
|
|
const models = await getOpenAIModels({ user: 'user456' });
|
|
|
|
expect(models).toContain('gpt-4');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns `AZURE_OPENAI_MODELS` with `azure` flag (and fetch fails)', async () => {
|
|
|
|
process.env.AZURE_OPENAI_MODELS = 'azure-model,azure-model-2';
|
|
|
|
const models = await getOpenAIModels({ azure: true });
|
|
|
|
expect(models).toEqual(expect.arrayContaining(['azure-model', 'azure-model-2']));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns `PLUGIN_MODELS` with `plugins` flag (and fetch fails)', async () => {
|
|
|
|
process.env.PLUGIN_MODELS = 'plugins-model,plugins-model-2';
|
|
|
|
const models = await getOpenAIModels({ plugins: true });
|
|
|
|
expect(models).toEqual(expect.arrayContaining(['plugins-model', 'plugins-model-2']));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns `OPENAI_MODELS` with no flags (and fetch fails)', async () => {
|
|
|
|
process.env.OPENAI_MODELS = 'openai-model,openai-model-2';
|
|
|
|
const models = await getOpenAIModels({});
|
|
|
|
expect(models).toEqual(expect.arrayContaining(['openai-model', 'openai-model-2']));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('utilizes proxy configuration when PROXY is set', async () => {
|
|
|
|
axios.get.mockResolvedValue({
|
|
|
|
data: {
|
|
|
|
data: [],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
process.env.PROXY = 'http://localhost:8888';
|
|
|
|
await getOpenAIModels({ user: 'user456' });
|
|
|
|
|
|
|
|
expect(axios.get).toHaveBeenCalledWith(
|
|
|
|
expect.any(String),
|
|
|
|
expect.objectContaining({
|
|
|
|
httpsAgent: expect.anything(),
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('getOpenAIModels with mocked config', () => {
|
|
|
|
it('uses alternative behavior when userProvidedOpenAI is true', async () => {
|
|
|
|
jest.mock('./Config/EndpointService', () => ({
|
|
|
|
config: {
|
|
|
|
openAIApiKey: 'mockedApiKey',
|
|
|
|
userProvidedOpenAI: true,
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
jest.mock('librechat-data-provider', () => {
|
|
|
|
const original = jest.requireActual('librechat-data-provider');
|
|
|
|
return {
|
|
|
|
...original,
|
|
|
|
defaultModels: {
|
|
|
|
[original.EModelEndpoint.openAI]: ['some-default-model'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
jest.resetModules();
|
|
|
|
const { getOpenAIModels } = require('./ModelService');
|
|
|
|
|
|
|
|
const models = await getOpenAIModels({ user: 'user456' });
|
|
|
|
expect(models).toContain('some-default-model');
|
|
|
|
});
|
|
|
|
});
|
✨ feat: Assistants API, General File Support, Side Panel, File Explorer (#1696)
* feat: assistant name/icon in Landing & Header
* feat: assistname in textarea placeholder, and use `Assistant` as default name
* feat: display non-image files in user messages
* fix: only render files if files.length is > 0
* refactor(config -> file-config): move file related configuration values to separate module, add excel types
* chore: spreadsheet file rendering
* fix(Landing): dark mode style for Assistant Name
* refactor: move progress incrementing to own hook, start smaller, cap near limit \(1\)
* refactor(useContentHandler): add empty Text part if last part was completed tool or image
* chore: add accordion trigger border styling for dark mode
* feat: Assistant Builder model selection
* chore: use Spinner when Assistant is mutating
* fix(get/assistants): return correct response object `AssistantListResponse`
* refactor(Spinner): pass size as prop
* refactor: make assistant crud mutations optimistic, add types for options
* chore: remove assistants route and view
* chore: move assistant builder components to separate directory
* feat(ContextButton): delete Assistant via context button/dialog, add localization
* refactor: conditionally show use and context menu buttons, add localization for create assistant
* feat: save side panel states to localStorage
* style(SidePanel): improve avatar menu and assistant select styling for dark mode
* refactor: make NavToggle reusable for either side (left or right), add SidePanel Toggle with ability to close it completely
* fix: resize handle and navToggle behavior
* fix(/avatar/:assistant_id): await `deleteFile` and assign unique name to uploaded image
* WIP: file UI components from PR #576
* refactor(OpenAIMinimalIcon): pass className
* feat: formatDate helper fn
* feat: DataTableColumnHeader
* feat: add row selection, formatted row values, number of rows selected
* WIP: add files to Side panel temporarily
* feat: `LB_QueueAsyncCall`: Leaky Bucket queue for external APIs, use in `processDeleteRequest`
* fix(TFile): correct `source` type with `FileSources`
* fix(useFileHandling): use `continue` instead of return when iterating multiple files, add file type to extendedFile
* chore: add generic setter type
* refactor(processDeleteRequest): settle promises to prevent rejections from processing deletions, log errors
* feat: `useFileDeletion` to reuse file deletion logic
* refactor(useFileDeletion): make `setFiles` an optional param and use object as param
* feat: useDeleteFilesFromTable
* feat: use real `files` data and add deletion action to data table
* fix(Table): make headers sticky
* feat: add dynamic filtering for columns; only show to user Host or OpenAI storage type
* style(DropdownMenu): replace `slate` with `gray`
* style(DataTable): apply dark mode themes and other misc styling
* style(Columns): add color to OpenAI Storage option
* refactor(FileContainer): make file preview reusable
* refactor(Images): make image preview reusable
* refactor(FilePreview): make file prop optional for FileIcon and FilePreview, fix relative style
* feat(Columns): add file/image previews, set a minimum size to show for file size in bytes
* WIP: File Panel with real files and formatted
* feat: open files dialog from panel
* style: file data table mobile and general column styling fixes
* refactor(api/files): return files sorted by the most recently updated
* refactor: provide fileMap through context to prevent re-selecting files to map in different areas; remove unused imports commented out in PanelColumns
* refactor(ExtendFile): make File type optional, add `attached` to prevent attached files from being deleted on remove, make Message.files a partial TFile type
* feat: attach files through file panel
* refactor(useFileHandling): move files to the start of cache list when uploaded
* refactor(useDeleteFilesMutation): delete files from cache when successfully deleted from server
* fix(FileRow): handle possible edge case of duplication due to attaching recently uploaded file
* style(SidePanel): make resize grip border transparent, remove unnecessary styling on close sidepanel button
* feat: action utilities and tests
* refactor(actions): add `ValidationResult` type and change wording for no server URL found
* refactor(actions): check for empty server URL
* fix(data-provider): revert tsconfig to fix type issue resolution
* feat(client): first pass of actions input for assistants
* refactor(FunctionSignature): change method to output object instead of string
* refactor(models/Assistant): add actions field to schema, use searchParams object for methods, and add `getAssistant`
* feat: post actions input first pass
- create new Action document
- add actions to Assistant DB document
- create /action/:assistant_id POST route
- pass more props down from PanelSwitcher, derive assistant_id from switcher
- move privacy policy to ActionInput
- reset data on input change/validation
- add `useUpdateAction`
- conform FunctionSignature type to FunctionTool
- add action, assistant doc, update hook related types
* refactor: optimize assistant/actions relationship
- past domain in metadata as hostname and not a URL
- include domain in tool name
- add `getActions` for actions retrieval by user
- add `getAssistants` for assistant docs retrieval by user
- add `assistant_id` to Action schema
- move actions to own module as a subroute to `api/assistants`
- add `useGetActionsQuery` and `useGetAssistantDocsQuery` hooks
- fix Action type def
* feat: show assistant actions in assistant builder
* feat: switch to actions on action click, editing action styling
* fix: add Assistant state for builder panel to allow immediate selection of newly created assistants as well as retaining the current assistant when switching to a different panel within the builder
* refactor(SidePanel/NavToggle): offset less from right when SidePanel is completely collapsed
* chore: rename `processActions` -> `processRequiredActions`
* chore: rename Assistant API Action to RequiredAction
* refactor(actions): avoid nesting actual API params under generic `requestBody` to optimize LLM token usage
* fix(handleTools): avoid calling `validTool` if not defined, add optional param to skip the loading of specs, which throws an error in the context of assistants
* WIP: working first pass of toolCalls generated from openapi specs
* WIP: first pass ToolCall styling
* feat: programmatic iv encryption/decryption helpers
* fix: correct ActionAuth types/enums, and define type for AuthForm
* feat: encryption/decryption helpers for Action AuthMetadata
* refactor(getActions): remove sensitive fields from query response
* refactor(POST/actions): encrypt and remove sensitive fields from mutation response
* fix(ActionService): change ESM import to CJS
* feat: frontend auth handling for actions + optimistic update on action update/creation
* refactor(actions): use the correct variables and types for setAuth method
* refactor: POST /:assistant_id action can now handle updating an existing action, add `saved_auth_fields` to determine when user explicitly saves new auth creds. only send auth metadata if user explicitly saved fields
* refactor(createActionTool): catch errors and send back meaningful error message, add flag to `getActions` to determine whether to retrieve sensitive values or not
* refactor(ToolService): add `action` property to ToolCall PartMetadata to determine if the tool call was an action, fix parsing function name issue with actionDelimiter
* fix(ActionRequest): use URL class to correctly join endpoint parts for `execute` call
* feat: delete assistant actions
* refactor: conditionally show Available actions
* refactor: show `retrieval` and `code_interpreter` as Capabilities, swap `Switch` for `Checkbox`
* chore: remove shadow-stroke from messages
* WIP: first pass of Assistants Knowledge attachments
* refactor: remove AssistantsProvider in favor of FormProvider, fix selectedAssistant re-render bug, map Assistant file_ids to files via fileMap, initialize Knowledge component with mapped files if any exist
* fix: prevent deleting files on assistant file upload
* chore: remove console.log
* refactor(useUploadFileMutation): update files and assistants cache on upload
* chore: disable oauth option as not supported yet
* feat: cancel assistant runs
* refactor: initialize OpenAI client with helper function, resolve all related circular dependencies
* fix(DALL-E): initialization
* fix(process): openai client initialization
* fix: select an existing Assistant when the active one is deleted
* chore: allow attaching files for assistant endpoint, send back relevant OpenAI error message when uploading, deconstruct openAI initialization correctly, add `message_file` to formData when a file is attached to the message but not the assistant
* fix: add assistant_id on newConvo
* fix(initializeClient): import fix
* chore: swap setAssistant for setOption in useEffect
* fix(DALL-E): add processFileURL to loadTools call
* chore: add customConfig to debug logs
* feat: delete threads on convo delete
* chore: replace Assistants icon
* chore: remove console.dir() in `abortRun`
* feat(AssistantService): accumulate text values from run in openai.responseText
* feat: titling for assistants endpoint
* chore: move panel file components to appropriate directory, add file checks for attaching files, change icon for Attach Files
* refactor: add localizations to tools, plugins, add condition for adding/remove user plugins so tool selections don't affect this value
* chore: disable `import from url` action for now
* chore: remove textMimeTypes from default fileConfig for now
* fix: catch tool errors and send as outputs with error messages
* fix: React warning about button as descendant of button
* style: retrieval and cancelled icon
* WIP: pass isSubmitting to Parts, use InProgressCall to display cancelled tool calls correctly, show domain/function name
* fix(meilisearch): fix `postSaveHook` issue where indexing expects a mongo document, and join all text content parts for meili indexing
* ci: fix dall-e tests
* ci: fix client tests
* fix: button types in actions panel
* fix: plugin auth form persisting across tool selections
* fix(ci): update AppService spec with `loadAndFormatTools`
* fix(clearConvos): add id check earlier on
* refactor(AssistantAvatar): set previewURL dynamically when emtadata.avatar changes
* feat(assistants): addTitle cache setting
* fix(useSSE): resolve rebase conflicts
* fix: delete mutation
* style(SidePanel): make grip visible on active and hover, invisible otherwise
* ci: add data-provider tests to workflow, also update eslint/tsconfig to recognize specs, and add `text/csv` to fileConfig
* fix: handle edge case where auth object is undefined, and log errors
* refactor(actions): resolve schemas, add tests for resolving refs, import specs from separate file for tests
* chore: remove comment
* fix(ActionsInput): re-render bug when initializing states with action fields
* fix(patch/assistant): filter undefined tools
* chore: add logging for errors in assistants routes
* fix(updateAssistant): map actions to functions to avoid overwriting
* fix(actions): properly handle GET paths
* fix(convos): unhandled delete thread exception
* refactor(AssistantService): pass both thread_id and conversationId when sending intermediate assistant messages, remove `mapMessagesToSteps` from AssistantService
* refactor(useSSE): replace all messages with runMessages and pass latestMessageId to abortRun; fix(checkMessageGaps): include tool calls when syncing messages
* refactor(assistants/chat): invoke `createOnTextProgress` after thread creation
* chore: add typing
* style: sidepanel styling
* style: action tool call domain styling
* feat(assistants): default models, limit retrieval to certain models, add env variables to to env.example
* feat: assistants api key in EndpointService
* refactor: set assistant model to conversation on assistant switch
* refactor: set assistant model to conversation on assistant select from panel
* fix(retrieveAndProcessFile): catch attempt to download file with `assistant` purpose which is not allowed; add logging
* feat: retrieval styling, handling, and logging
* chore: rename ASSISTANTS_REVERSE_PROXY to ASSISTANTS_BASE_URL
* feat: FileContext for file metadata
* feat: context file mgmt and filtering
* style(Select): hover/rounded changes
* refactor: explicit conversation switch, endpoint dependent, through `useSelectAssistant`, which does not create new chat if current endpoint is assistant endpoint
* fix(AssistantAvatar): make empty previewURL if no avatar present
* refactor: side panel mobile styling
* style: merge tool and action section, optimize mobile styling for action/tool buttons
* fix: localStorage issues
* fix(useSelectAssistant): invoke react query hook directly in select hook as Map was not being updated in time
* style: light mode fixes
* fix: prevent sidepanel nav styling from shifting layout up
* refactor: change default layout (collapsed by default)
* style: mobile optimization of DataTable
* style: datatable
* feat: client-side hide right-side panel
* chore(useNewConvo): add partial typing for preset
* fix(useSelectAssistant): pass correct model name by using template as preset
* WIP: assistant presets
* refactor(ToolService): add native solution for `TavilySearchResults` and log tool output errors
* refactor: organize imports and use native TavilySearchResults
* fix(TavilySearchResults): stringify result
* fix(ToolCall): show tool call outputs when not an action
* chore: rename Prompt Prefix to custom instructions (in user facing text only)
* refactor(EditPresetDialog): Optimize setting title by debouncing, reset preset on dialog close to avoid state mixture
* feat: add `presetOverride` to overwrite active conversation settings when saving a Preset (relevant for client side updates only)
* feat: Assistant preset settings (client-side)
* fix(Switcher): only set assistant_id and model if current endpoint is Assistants
* feat: use `useDebouncedInput` for updating conversation settings, starting with EditPresetDialog title setting and Assistant instructions setting
* feat(Assistants): add instructions field to settings
* feat(chat/assistants): pass conversation settings to run body
* wip: begin localization and only allow actions if the assistant is created
* refactor(AssistantsPanel): knowledge localization, allow tools on creation
* feat: experimental: allow 'priming' values before assistant is created, that would normally require an assistant_id to be defined
* chore: trim console logs and make more meaningful
* chore: toast messages
* fix(ci): date test
* feat: create file when uploading Assistant Avatar
* feat: file upload rate limiting from custom config with dynamic file route initialization
* refactor: use file upload limiters on post routes only
* refactor(fileConfig): add endpoints field for endpoint specific fileconfigs, add mergeConfig function, add tests
* refactor: fileConfig route, dynamic multer instances used on all '/' and '/images' POST routes, data service and query hook
* feat: supportedMimeTypesSchema, test for array of regex
* feat: configurable file config limits
* chore: clarify assistants file knowledge prereq.
* chore(useTextarea): default to localized 'Assistant' if assistant name is empty
* feat: configurable file limits and toggle file upload per endpoint
* fix(useUploadFileMutation): prevent updating assistant.files cache if file upload is a message_file attachment
* fix(AssistantSelect): set last selected assistant only when timeout successfully runs
* refactor(queries): disable assistant queries if assistants endpoint is not enabled
* chore(Switcher): add localization
* chore: pluralize `assistant` for `EModelEndpoint key and value
* feat: show/hide assistant UI components based on endpoint availability; librechat.yaml config for disabling builder section and setting polling/timeout intervals
* fix(compactEndpointSchemas): use EModelEndpoint for schema access
* feat(runAssistant): use configured values from `librechat.yaml` for `pollIntervalMs` and `timeout`
* fix: naming issue
* wip: revert landing
* 🎉 happy birthday LibreChat (#1768)
* happy birthday LibreChat
* Refactor endpoint condition in Landing component
* Update birthday message in Eng.tsx
* fix(/config): avoid nesting ternaries
* refactor(/config): check birthday
---------
Co-authored-by: Danny Avila <messagedaniel@protonmail.com>
* fix: landing
* fix: landing
* fix(useMessageHelpers): hardcoded check to use EModelEndpoint instead
* fix(ci): convo test revert to main
* fix(assistants/chat): fix issue where assistant_id was being saved as model for convo
* chore: added logging, promises racing to prevent longer timeouts, explicit setting of maxRetries and timeouts, robust catching of invalid abortRun params
* refactor: use recoil state for `showStopButton` and only show for assistants endpoint after syncing conversation data
* refactor: optimize abortRun strategy using localStorage, refactor `abortConversation` to use async/await and await the result, refactor how the abortKey cache is set for runs
* fix(checkMessageGaps): assign `assistant_id` to synced messages if defined; prevents UI from showing blank assistant for cancelled messages
* refactor: re-order sequence of chat route, only allow aborting messages after run is created, cancel abortRun if there was a cancelling error (likely due already cancelled in chat route), and add extra logging
* chore(typedefs): add httpAgent type to OpenAIClient
* refactor: use custom implementation of retrieving run with axios to allow for timing out run query
* fix(waitForRun): handle timed out run retrieval query
* refactor: update preset conditions:
- presets will retain settings when a different endpoint is selected; for existing convos, either when modular or is assistant switch
- no longer use `navigateToConvo` on preset select
* fix: temporary calculator hack as expects string input when invoked
* fix: cancel abortRun only when cancelling error is a result of the run already being cancelled
* chore: remove use of `fileMaxSizeMB` and total counterpart (redundant)
* docs: custom config documentation update
* docs: assistants api setup and dotenv, new custom config fields
* refactor(Switcher): make Assistant switcher sticky in SidePanel
* chore(useSSE): remove console log of data and message index
* refactor(AssistantPanel): button styling and add secondary select button to bottom of panel
* refactor(OpenAIClient): allow passing conversationId to RunManager through titleConvo and initializeLLM to properly record title context tokens used in cases where conversationId was not defined by the client
* feat(assistants): token tracking for assistant runs
* chore(spendTokens): improve logging
* feat: support/exclude specific assistant Ids
* chore: add update `librechat.example.yaml`, optimize `AppService` handling, new tests for `AppService`, optimize missing/outdate config logging
* chore: mount docker logs to root of project
* chore: condense axios errors
* chore: bump vite
* chore: vite hot reload fix using latest version
* chore(getOpenAIModels): sort instruct models to the end of models list
* fix(assistants): user provided key
* fix(assistants): user provided key, invalidate more queries on revoke
---------
Co-authored-by: Marco Beretta <81851188+Berry-13@users.noreply.github.com>
2024-02-13 20:42:27 -05:00
|
|
|
|
|
|
|
describe('getOpenAIModels sorting behavior', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
axios.get.mockResolvedValue({
|
|
|
|
data: {
|
|
|
|
data: [
|
|
|
|
{ id: 'gpt-3.5-turbo-instruct-0914' },
|
|
|
|
{ id: 'gpt-3.5-turbo-instruct' },
|
|
|
|
{ id: 'gpt-3.5-turbo' },
|
|
|
|
{ id: 'gpt-4-0314' },
|
|
|
|
{ id: 'gpt-4-turbo-preview' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('ensures instruct models are listed last', async () => {
|
|
|
|
const models = await getOpenAIModels({ user: 'user456' });
|
|
|
|
|
|
|
|
// Check if the last model is an "instruct" model
|
|
|
|
expect(models[models.length - 1]).toMatch(/instruct/);
|
|
|
|
|
|
|
|
// Check if the "instruct" models are placed at the end
|
|
|
|
const instructIndexes = models
|
|
|
|
.map((model, index) => (model.includes('instruct') ? index : -1))
|
|
|
|
.filter((index) => index !== -1);
|
|
|
|
const nonInstructIndexes = models
|
|
|
|
.map((model, index) => (!model.includes('instruct') ? index : -1))
|
|
|
|
.filter((index) => index !== -1);
|
|
|
|
|
|
|
|
expect(Math.max(...nonInstructIndexes)).toBeLessThan(Math.min(...instructIndexes));
|
|
|
|
|
|
|
|
const expectedOrder = [
|
|
|
|
'gpt-3.5-turbo',
|
|
|
|
'gpt-4-0314',
|
|
|
|
'gpt-4-turbo-preview',
|
|
|
|
'gpt-3.5-turbo-instruct-0914',
|
|
|
|
'gpt-3.5-turbo-instruct',
|
|
|
|
];
|
|
|
|
expect(models).toEqual(expectedOrder);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
jest.clearAllMocks();
|
|
|
|
});
|
|
|
|
});
|
2024-04-27 18:27:04 -04:00
|
|
|
|
|
|
|
describe('fetchModels with Ollama specific logic', () => {
|
|
|
|
const mockOllamaData = {
|
|
|
|
data: {
|
|
|
|
models: [{ name: 'Ollama-Base' }, { name: 'Ollama-Advanced' }],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
axios.get.mockResolvedValue(mockOllamaData);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
jest.clearAllMocks();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should fetch Ollama models when name starts with "ollama"', async () => {
|
|
|
|
const models = await fetchModels({
|
|
|
|
user: 'user789',
|
|
|
|
apiKey: 'testApiKey',
|
|
|
|
baseURL: 'https://api.ollama.test.com',
|
|
|
|
name: 'OllamaAPI',
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(models).toEqual(['Ollama-Base', 'Ollama-Advanced']);
|
2024-10-15 19:37:41 -04:00
|
|
|
expect(axios.get).toHaveBeenCalledWith('https://api.ollama.test.com/api/tags', {
|
|
|
|
timeout: 5000,
|
|
|
|
});
|
2024-04-27 18:27:04 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should handle errors gracefully when fetching Ollama models fails', async () => {
|
|
|
|
axios.get.mockRejectedValue(new Error('Network error'));
|
|
|
|
const models = await fetchModels({
|
|
|
|
user: 'user789',
|
|
|
|
apiKey: 'testApiKey',
|
|
|
|
baseURL: 'https://api.ollama.test.com',
|
|
|
|
name: 'OllamaAPI',
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(models).toEqual([]);
|
|
|
|
expect(logger.error).toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return an empty array if no baseURL is provided', async () => {
|
|
|
|
const models = await fetchModels({
|
|
|
|
user: 'user789',
|
|
|
|
apiKey: 'testApiKey',
|
|
|
|
name: 'OllamaAPI',
|
|
|
|
});
|
|
|
|
expect(models).toEqual([]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not fetch Ollama models if the name does not start with "ollama"', async () => {
|
|
|
|
// Mock axios to return a different set of models for non-Ollama API calls
|
|
|
|
axios.get.mockResolvedValue({
|
|
|
|
data: {
|
|
|
|
data: [{ id: 'model-1' }, { id: 'model-2' }],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const models = await fetchModels({
|
|
|
|
user: 'user789',
|
|
|
|
apiKey: 'testApiKey',
|
|
|
|
baseURL: 'https://api.test.com',
|
|
|
|
name: 'TestAPI',
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(models).toEqual(['model-1', 'model-2']);
|
|
|
|
expect(axios.get).toHaveBeenCalledWith(
|
|
|
|
'https://api.test.com/models', // Ensure the correct API endpoint is called
|
|
|
|
expect.any(Object), // Ensuring some object (headers, etc.) is passed
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
🪨 feat: AWS Bedrock support (#3935)
* feat: Add BedrockIcon component to SVG library
* feat: EModelEndpoint.bedrock
* feat: first pass, bedrock chat. note: AgentClient is returning `agents` as conversation.endpoint
* fix: declare endpoint in initialization step
* chore: Update @librechat/agents dependency to version 1.4.5
* feat: backend content aggregation for agents/bedrock
* feat: abort agent requests
* feat: AWS Bedrock icons
* WIP: agent provider schema parsing
* chore: Update EditIcon props type
* refactor(useGenerationsByLatest): make agents and bedrock editable
* refactor: non-assistant message content, parts
* fix: Bedrock response `sender`
* fix: use endpointOption.model_parameters not endpointOption.modelOptions
* fix: types for step handler
* refactor: Update Agents.ToolCallDelta type
* refactor: Remove unnecessary assignment of parentMessageId in AskController
* refactor: remove unnecessary assignment of parentMessageId (agent request handler)
* fix(bedrock/agents): message regeneration
* refactor: dynamic form elements using react-hook-form Controllers
* fix: agent icons/labels for messages
* fix: agent actions
* fix: use of new dynamic tags causing application crash
* refactor: dynamic settings touch-ups
* refactor: update Slider component to allow custom track class name
* refactor: update DynamicSlider component styles
* refactor: use Constants value for GLOBAL_PROJECT_NAME (enum)
* feat: agent share global methods/controllers
* fix: agents query
* fix: `getResponseModel`
* fix: share prompt a11y issue
* refactor: update SharePrompt dialog theme styles
* refactor: explicit typing for SharePrompt
* feat: add agent roles/permissions
* chore: update @librechat/agents dependency to version 1.4.7 for tool_call_ids edge case
* fix(Anthropic): messages.X.content.Y.tool_use.input: Input should be a valid dictionary
* fix: handle text parts with tool_call_ids and empty text
* fix: role initialization
* refactor: don't make instructions required
* refactor: improve typing of Text part
* fix: setShowStopButton for agents route
* chore: remove params for now
* fix: add streamBuffer and streamRate to help prevent 'Overloaded' errors from Anthropic API
* refactor: remove console.log statement in ContentRender component
* chore: typing, rename Context to Delete Button
* chore(DeleteButton): logging
* refactor(Action): make accessible
* style(Action): improve a11y again
* refactor: remove use/mention of mongoose sessions
* feat: first pass, sharing agents
* feat: visual indicator for global agent, remove author when serving to non-author
* wip: params
* chore: fix typing issues
* fix(schemas): typing
* refactor: improve accessibility of ListCard component and fix console React warning
* wip: reset templates for non-legacy new convos
* Revert "wip: params"
This reverts commit f8067e91d4adf7be9e0d9e914aaae79ac4689b80.
* Revert "refactor: dynamic form elements using react-hook-form Controllers"
This reverts commit 2150c4815d8c74a978a4b697aa8f54dc11e035d7.
* fix(Parameters): types and parameter effect update to only update local state to parameters
* refactor: optimize useDebouncedInput hook for better performance
* feat: first pass, anthropic bedrock params
* chore: paramEndpoints check for endpointType too
* fix: maxTokens to use coerceNumber.optional(),
* feat: extra chat model params
* chore: reduce code repetition
* refactor: improve preset title handling in SaveAsPresetDialog component
* refactor: improve preset handling in HeaderOptions component
* chore: improve typing, replace legacy dialog for SaveAsPresetDialog
* feat: save as preset from parameters panel
* fix: multi-search in select dropdown when using Option type
* refactor: update default showDefault value to false in Dynamic components
* feat: Bedrock presets settings
* chore: config, fix agents schema, update config version
* refactor: update AWS region variable name in bedrock options endpoint to BEDROCK_AWS_DEFAULT_REGION
* refactor: update baseEndpointSchema in config.ts to include baseURL property
* refactor: update createRun function to include req parameter and set streamRate based on provider
* feat: availableRegions via config
* refactor: remove unused demo agent controller file
* WIP: title
* Update @librechat/agents to version 1.5.0
* chore: addTitle.js to handle empty responseText
* feat: support images and titles
* feat: context token updates
* Refactor BaseClient test to use expect.objectContaining
* refactor: add model select, remove header options params, move side panel params below prompts
* chore: update models list, catch title error
* feat: model service for bedrock models (env)
* chore: Remove verbose debug log in AgentClient class following stream
* feat(bedrock): track token spend; fix: token rates, value key mapping for AWS models
* refactor: handle streamRate in `handleLLMNewToken` callback
* chore: AWS Bedrock example config in `.env.example`
* refactor: Rename bedrockMeta to bedrockGeneral in settings.ts and use for AI21 and Amazon Bedrock providers
* refactor: Update `.env.example` with AWS Bedrock model IDs URL and additional notes
* feat: titleModel support for bedrock
* refactor: Update `.env.example` with additional notes for AWS Bedrock model IDs
2024-09-09 12:06:59 -04:00
|
|
|
|
|
|
|
describe('splitAndTrim', () => {
|
|
|
|
it('should split a string by commas and trim each value', () => {
|
|
|
|
const input = ' model1, model2 , model3,model4 ';
|
|
|
|
const expected = ['model1', 'model2', 'model3', 'model4'];
|
|
|
|
expect(splitAndTrim(input)).toEqual(expected);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return an empty array for empty input', () => {
|
|
|
|
expect(splitAndTrim('')).toEqual([]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return an empty array for null input', () => {
|
|
|
|
expect(splitAndTrim(null)).toEqual([]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return an empty array for undefined input', () => {
|
|
|
|
expect(splitAndTrim(undefined)).toEqual([]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should filter out empty values after trimming', () => {
|
|
|
|
const input = 'model1,, ,model2,';
|
|
|
|
const expected = ['model1', 'model2'];
|
|
|
|
expect(splitAndTrim(input)).toEqual(expected);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('getAnthropicModels', () => {
|
|
|
|
it('returns default models when ANTHROPIC_MODELS is not set', () => {
|
|
|
|
delete process.env.ANTHROPIC_MODELS;
|
|
|
|
const models = getAnthropicModels();
|
|
|
|
expect(models).toEqual(defaultModels[EModelEndpoint.anthropic]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns models from ANTHROPIC_MODELS when set', () => {
|
|
|
|
process.env.ANTHROPIC_MODELS = 'claude-1, claude-2 ';
|
|
|
|
const models = getAnthropicModels();
|
|
|
|
expect(models).toEqual(['claude-1', 'claude-2']);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('getGoogleModels', () => {
|
|
|
|
it('returns default models when GOOGLE_MODELS is not set', () => {
|
|
|
|
delete process.env.GOOGLE_MODELS;
|
|
|
|
const models = getGoogleModels();
|
|
|
|
expect(models).toEqual(defaultModels[EModelEndpoint.google]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns models from GOOGLE_MODELS when set', () => {
|
|
|
|
process.env.GOOGLE_MODELS = 'gemini-pro, bard ';
|
|
|
|
const models = getGoogleModels();
|
|
|
|
expect(models).toEqual(['gemini-pro', 'bard']);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('getBedrockModels', () => {
|
|
|
|
it('returns default models when BEDROCK_AWS_MODELS is not set', () => {
|
|
|
|
delete process.env.BEDROCK_AWS_MODELS;
|
|
|
|
const models = getBedrockModels();
|
|
|
|
expect(models).toEqual(defaultModels[EModelEndpoint.bedrock]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns models from BEDROCK_AWS_MODELS when set', () => {
|
|
|
|
process.env.BEDROCK_AWS_MODELS = 'anthropic.claude-v2, ai21.j2-ultra ';
|
|
|
|
const models = getBedrockModels();
|
|
|
|
expect(models).toEqual(['anthropic.claude-v2', 'ai21.j2-ultra']);
|
|
|
|
});
|
|
|
|
});
|