Skip to content
Open
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 @@ -24,7 +24,11 @@ class Organization extends BaseModel {

static IMS_ORG_ID_REGEX = /[a-z0-9]{24}@AdobeOrg/i;

// add your custom methods or overrides here
static LLM_BACKEND_AZURE = 'azure';

static LLM_BACKEND_BEDROCK = 'bedrock';

static LLM_BACKENDS = ['azure', 'bedrock'];
}

export default Organization;
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ const schema = new SchemaBuilder(Organization, OrganizationCollection)
type: 'string',
validate: (value) => !value || Organization.IMS_ORG_ID_REGEX.test(value),
})
.addAttribute('llmBackend', {
type: Organization.LLM_BACKENDS,
default: Organization.LLM_BACKEND_AZURE,
validate: (value) => !value || Organization.LLM_BACKENDS.includes(value),
})
.addAttribute('fulfillableItems', {
type: 'any',
validate: (value) => !value || isNonEmptyObject(value),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const organizations = [
organizationId: '4854e75e-894b-4a74-92bf-d674abad1423',
imsOrgId: '1234567890ABCDEF12345678@AdobeOrg',
name: '0-1234Name',
llmBackend: 'azure',
config:
{
slack:
Expand Down Expand Up @@ -45,6 +46,7 @@ const organizations = [
organizationId: '757ceb98-05c8-4e07-bb23-bc722115b2b0',
imsOrgId: '1234567891ABCDEF12345678@AdobeOrg',
name: '1-1234Name',
llmBackend: 'azure',
config:
{
slack:
Expand Down Expand Up @@ -75,6 +77,7 @@ const organizations = [
organizationId: '5d42bdf8-b65d-4de8-b849-a4f28ebc93cd',
imsOrgId: '1234567892ABCDEF12345678@AdobeOrg',
name: '2-1234Name',
llmBackend: 'azure',
config:
{
slack:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,35 @@ describe('OrganizationModel', () => {
expect(instance.getFulfillableItems()).to.deep.equal(['item3', 'item4']);
});
});

describe('llmBackend', () => {
it('defaults to azure', () => {
expect(instance.getLlmBackend()).to.equal('azure');
});

it('sets llmBackend to bedrock', () => {
instance.setLlmBackend('bedrock');
expect(instance.getLlmBackend()).to.equal('bedrock');
});

it('sets llmBackend back to azure', () => {
instance.setLlmBackend('bedrock');
instance.setLlmBackend('azure');
expect(instance.getLlmBackend()).to.equal('azure');
});
});

describe('LLM_BACKENDS constants', () => {
it('defines LLM_BACKEND_AZURE', () => {
expect(Organization.LLM_BACKEND_AZURE).to.equal('azure');
});

it('defines LLM_BACKEND_BEDROCK', () => {
expect(Organization.LLM_BACKEND_BEDROCK).to.equal('bedrock');
});

it('defines LLM_BACKENDS list', () => {
expect(Organization.LLM_BACKENDS).to.deep.equal(['azure', 'bedrock']);
});
});
});
Loading