-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/add ai rate limit schema (#1343)
* feat: added ai rate limit plugins schemas This PR adds a schema for the AI rate limiting plugin and the models provider field * feat: added ai rate limit plugins schemas * feat(n): add logo for new AI Rate Limiting Plugin [KM-92] add logo for new AI Rate Limiting Plugins
- Loading branch information
1 parent
504eeec
commit d57ac6a
Showing
8 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+8.1 KB
...s/entities-plugins/src/assets/images/plugin-icons/ai-rate-limiting-advanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/entities/entities-plugins/src/definitions/schemas/AIRateLimitingAdvanced.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { AIRateLimitingAdvancedSchema } from '../../types/plugins/ai-rate-limiting-advanced' | ||
import { arrayCardContainerFieldSchema } from './ArrayCardContainerFields' | ||
|
||
export const aiRateLimitingAdvancedSchema: AIRateLimitingAdvancedSchema = { | ||
'config-llm_providers': { | ||
...arrayCardContainerFieldSchema, | ||
newElementButtonLabel: '+ Add Provider', | ||
items: { | ||
type: 'object', | ||
schema: { | ||
fields: [{ | ||
label: 'Window Size', | ||
model: 'window_size', | ||
help: 'Window size to apply a limit to (defined in seconds)', | ||
type: 'input', | ||
inputType: 'number', | ||
}, { | ||
label: 'Name', | ||
model: 'name', | ||
help: 'The llm providers.', | ||
type: 'select', | ||
values: [ | ||
'anthropic', | ||
'azure', | ||
'cohere', | ||
'llama2', | ||
'mistral', | ||
'openai', | ||
'requestPrompt', | ||
], | ||
}, { | ||
label: 'Limit', | ||
model: 'limit', | ||
help: 'Limit applied to the llm provider.', | ||
type: 'input', | ||
inputType: 'number', | ||
}], | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/entities/entities-plugins/src/types/plugins/ai-rate-limiting-advanced.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Field, ItemsSchema, CommonSchemaFields } from './shared' | ||
|
||
type FieldForKeyValuePairs = Field & { | ||
newElementButtonLabelClasses?: string | ||
newElementButtonLabel?: string | ||
keyInputPlaceholder?: string | ||
valueInputPlaceholder?: string | ||
} | ||
|
||
type ItemsSchemaForKeyValuePairs = Omit<ItemsSchema, 'schema'> & { | ||
schema: { | ||
fields: FieldForKeyValuePairs[] | ||
} | ||
} | ||
|
||
export interface AIRateLimitingAdvancedSchema extends CommonSchemaFields { | ||
'config-llm_providers': { | ||
type: string | ||
showRemoveButton: boolean | ||
newElementButtonLabelClasses: string | ||
itemContainerComponent: string | ||
fieldClasses: string | ||
|
||
newElementButtonLabel: string | ||
items: ItemsSchemaForKeyValuePairs | ||
} | ||
} |