Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: control LLM model selection through configuration #607

Merged
merged 40 commits into from
Dec 12, 2024

Conversation

fsatsuki
Copy link
Contributor

@fsatsuki fsatsuki commented Nov 22, 2024

Issue #, if available:
Closes #592
Closes #505

Description of changes:
When publishing chatbots, you may want to limit the models that can be used, such as when you want to restrict the use of expensive models.
This update adds the ability to limit which models can be used per custom chatbot.
All models can be used with regular chatbots.

Add ModelActivate to DynamoDB and set true/false whether the model can be used. The chatbot can only select models that are set to true.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -2,6 +2,21 @@ import { BedrockKnowledgeBase } from '../features/knowledgeBase/types';

export type BotKind = 'private' | 'mixed';

export type ModelActivate = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらもBE同様、メンテ負荷を減らすため、conversation.d.tsのModel定義から動的に生成する方法でお願いします!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

対応しました。

@@ -100,3 +101,20 @@ export const GUARDRAILS_CONTECTUAL_GROUNDING_THRESHOLD = {
MIN: 0,
STEP: 0.01,
};

export const MODEL_KEYS: Model[] = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conversation.d.tsのModelから生成検討してください!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typescriptの言語の問題で、typeの中身を変数の値として使うことは実装不可能でした。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commitで実装

Copy link
Contributor

@statefb statefb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@statefb
Copy link
Contributor

statefb commented Dec 6, 2024

@wadabee FE側ご確認いただけると助かります!

Comment on lines 2398 to 2407
<div key={key} className="flex items-center gap-2">
<Toggle
value={
activeModels[
toCamelCase(key) as keyof ActiveModels
] ?? true
}
onChange={(value) => onChangeActiveModels(key, value)}
/>
<span>{label}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここにもモデルの説明があったほうが良いかなと思いました!

L2398を className="flex items-start"に変更して、
L2407を以下のように修正すると良い感じになると思います。

<div>
  <div>{label}</div>
  <div className="text-sm text-dark-gray">{description}</div>
</div>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activeModelsOptionsこちらにdescriptionの追加をお願いしますmm

Copy link
Contributor

@wadabee wadabee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@wadabee wadabee merged commit a3f0a75 into aws-samples:v2 Dec 12, 2024
6 checks passed
wontagh pushed a commit to aroundble/bedrock-claude-chat that referenced this pull request Dec 16, 2024
…ace/react-app (aws-samples#607)

* chore(deps): bump cross-spawn in /lib/user-interface/react-app

Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](moxystudio/node-cross-spawn@v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump cross-spawn from 7.0.3 to 7.0.6

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charles Marion <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants