-
-
Notifications
You must be signed in to change notification settings - Fork 143
Add Dynamic Retrieval option to Search Grounding feature #387
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
Add Dynamic Retrieval option to Search Grounding feature #387
Conversation
Co-Authored-By: ニケちゃん / nikechan <o3nike.teg.14@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
""" Walkthroughこの変更は、Google Geminiモデルの検索グラウンディング機能に「動的検索(Dynamic Retrieval)」オプションを追加し、しきい値を調整できるUIスライダー、設定ストアの状態管理、APIハンドラでのパラメータ受け渡し、関連する定数・ローカライズを含みます。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI
participant SettingsStore
participant API
participant AIService
User->>UI: 動的検索しきい値スライダーを調整
UI->>SettingsStore: dynamicRetrievalThreshold を更新
User->>UI: モデルと検索グラウンディングを選択し送信
UI->>API: リクエスト (dynamicRetrievalThreshold含む)
API->>AIService: モデル・検索グラウンディング・しきい値を含むオプションで呼び出し
AIService-->>API: 結果返却
API-->>UI: 結果返却
Possibly related PRs
Suggested labels
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying aituber-kit-docs with
|
| Latest commit: |
e50eb65
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d7ffbae8.aituber-kit-4s1.pages.dev |
| Branch Preview URL: | https://devin-1746731343-074859-add.aituber-kit-4s1.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (7)
website/document/zh/guide/ai/model-provider.md (1)
231-244: OpenRouterサービスのドキュメントが追加されていますが、言語の不一致がありますOpenRouterサービスのセクションが追加されていますが、240行目に日本語のテキスト「を参照してください」が含まれています。これは中国語ドキュメントなので、このテキストも中国語に翻訳するべきです。
- [OpenRouter Models](https://openrouter.ai/models)を参照してください。 + 请参考 [OpenRouter Models](https://openrouter.ai/models)。.cursor/rules/add-new-llm-provider.mdc (6)
6-6: 不要なバックスラッシュ文字を削除してください。このバックスラッシュ文字(
\)は孤立しており、特に目的が見当たりません。文書のフォーマットを整えるために削除することをお勧めします。-\
65-67: ルーティング方式の判断方法について具体的な指示を追加してください。プロジェクトがPages RouterとApp Routerのどちらを使用しているかを判断する方法について、より具体的な指示があれば開発者にとって役立ちます。例えば、プロジェクトのディレクトリ構造やpackage.jsonの依存関係から判断する方法などを追加することを検討してください。
- プロジェクトのルーティング方式(Pages Router または App Router)によって対象ファイルが異なります。 + プロジェクトのルーティング方式(Pages Router または App Router)によって対象ファイルが異なります。ルート直下に `src/pages` ディレクトリが存在し、その中にAPIエンドポイントが定義されている場合はPages Router、`app` ディレクトリ内にAPI関連のディレクトリがある場合はApp Routerを使用しています。
13-14: Dynamic Retrievalのような既存プロバイダへの機能追加についても言及することを検討してください。このドキュメントは新しいLLMプロバイダの追加に焦点を当てていますが、PR内容にあるDynamic Retrievalのような既存プロバイダへの新機能追加についても言及すると、より包括的なガイドになります。
このドキュメントは、AITuberKitに新しいLLM(Large Language Model)サービスプロバイダを追加する際の標準的な手順と、変更が必要な主要ファイルをまとめたものです。 +また、このガイドは既存のプロバイダに新しい機能(例:GeminiモデルのDynamic Retrieval機能など)を追加する場合にも参考になります。その場合は、新プロバイダの追加ではなく、既存の設定や状態管理に新しいパラメータを追加し、それに対応するUIコンポーネントとAPIエンドポイントの処理を更新することになります。
47-48: APIキー命名規則の具体例を追加するとより分かりやすくなります。APIKeysインターフェースとpersist内でのキー名の違いについて言及されていますが、具体的な例を追加するとより理解しやすくなります。
- **注意点**: 既存のコードでは、`APIKeys` インターフェースのキー名 (例: `openai`) と `persist` 内のキー名 (例: `openaiKey`) が異なる場合があります。既存の命名規則に従ってください。 + **注意点**: 既存のコードでは、`APIKeys` インターフェースのキー名 (例: `openai`, `anthropic`) と `persist` 内のキー名 (例: `openaiKey`, `anthropicKey`) が異なる場合があります。通常は、インターフェース内のキー名に「Key」を付けた形式になります。例えば、新しいプロバイダ「newProvider」を追加する場合、`APIKeys` インターフェースには `newProvider?: string;` を、`persist` 内には `newProviderKey: ""` を追加します。既存の命名規則に従ってください。
84-87: テスト部分により具体的な例を追加すると有用です。テストの追加・更新に関する説明が簡潔すぎるため、より詳細な手順や例を提供することを検討してください。
### 5. テスト - (任意) [`src/__tests__/features/chat/aiChatFactory.test.ts`](mdc:src/__tests__/features/chat/aiChatFactory.test.ts) (または関連するテストファイル): - 新しく追加したLLMサービスプロバイダに対するテストケースを追加・更新します。 + - 具体的には以下のようなテストを追加することが望ましいです: + - 新プロバイダのAPIキーと設定が正しく保存・読み込みされることを確認するテスト + - チャットファクトリが新プロバイダのクライアントを正しく初期化できることを確認するテスト + - 新プロバイダを使用したチャット応答が正しく処理されることを確認するテスト(モックを使用) + - 既存のテストケースを参考に、同様のパターンで実装してください。 + - モックデータを使用する場合は、`src/__mocks__/` ディレクトリに適切なモックファイルを追加することも検討してください。
11-14: 多言語対応のドキュメントも検討してください。このドキュメントは日本語のみで書かれていますが、国際的な貢献者のためにも英語版も提供することを検討してください。特に、オープンソースプロジェクトでは、多言語のドキュメントがより多くの貢献者を惹きつける助けになります。
英語版タイトル例:
# Steps for Adding a New LLM Service Provider注: 完全な翻訳は不要ですが、将来的に英語版の追加を検討することをお勧めします。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
⛔ Files ignored due to path filters (4)
package-lock.jsonis excluded by!**/package-lock.jsonpublic/images/ai-logos/openrouter.svgis excluded by!**/*.svgpublic/images/ai-logos/xai.svgis excluded by!**/*.svgwebsite/document/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (24)
.cursor/rules/add-new-llm-provider.mdc(1 hunks).env.example(2 hunks)locales/ja/translation.json(2 hunks)package.json(2 hunks)src/__tests__/features/chat/aiChatFactory.test.ts(1 hunks)src/components/settings/modelProvider.tsx(6 hunks)src/features/chat/aiChatFactory.ts(1 hunks)src/features/constants/aiModels.ts(3 hunks)src/features/constants/settings.ts(3 hunks)src/features/stores/settings.ts(5 hunks)src/pages/api/services/vercelAi.ts(3 hunks)website/document/en/guide/ai/common.md(1 hunks)website/document/en/guide/ai/model-provider.md(3 hunks)website/document/en/guide/environment-variables.md(1 hunks)website/document/en/guide/introduction.md(1 hunks)website/document/guide/ai/common.md(2 hunks)website/document/guide/ai/model-provider.md(3 hunks)website/document/guide/environment-variables.md(3 hunks)website/document/guide/introduction.md(1 hunks)website/document/package.json(1 hunks)website/document/zh/guide/ai/common.md(2 hunks)website/document/zh/guide/ai/model-provider.md(3 hunks)website/document/zh/guide/environment-variables.md(3 hunks)website/document/zh/guide/introduction.md(1 hunks)
✅ Files skipped from review due to trivial changes (16)
- website/document/package.json
- website/document/guide/introduction.md
- website/document/en/guide/ai/common.md
- src/features/chat/aiChatFactory.ts
- website/document/zh/guide/introduction.md
- website/document/zh/guide/ai/common.md
- website/document/guide/ai/model-provider.md
- website/document/guide/ai/common.md
- package.json
- website/document/en/guide/introduction.md
- website/document/en/guide/environment-variables.md
- src/pages/api/services/vercelAi.ts
- src/features/constants/settings.ts
- website/document/guide/environment-variables.md
- website/document/en/guide/ai/model-provider.md
- .env.example
🚧 Files skipped from review as they are similar to previous changes (3)
- locales/ja/translation.json
- src/components/settings/modelProvider.tsx
- src/features/stores/settings.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (10)
src/__tests__/features/chat/aiChatFactory.test.ts (1)
64-65: 新しいAIサービスが正しく追加されていますxAIとOpenRouterが
aiServices配列に適切に追加されており、テストが正しく機能するようになっています。この変更により、新しいAIサービスがVercel AI SDKを使用することを確認するテストカバレッジが確保されています。Also applies to: 71-71
website/document/zh/guide/environment-variables.md (3)
108-109: AIサービス一覧が正しく更新されていますxAIとOpenRouterが選択可能なAIサービスのリストに追加されており、ドキュメントが適切に更新されています。
145-146: xAI API Keyの環境変数ドキュメントが追加されていますxAIサービスのAPI Key環境変数が適切に追加されており、ユーザーが適切に設定できるようになっています。
166-167: OpenRouter API Keyの環境変数ドキュメントが追加されていますOpenRouterサービスのAPI Key環境変数が適切に追加されており、ユーザーが適切に設定できるようになっています。
src/features/constants/aiModels.ts (4)
29-37: xAIのモデル一覧が適切に追加されていますxAIサービスのための各種Grokモデルバリアントが適切にリストアップされています。すべての利用可能なGrokモデルが含まれており、ユーザーが選択できるようになっています。
118-118: xAIのデフォルトモデルが適切に設定されています
grok-3がxAIサービスのデフォルトモデルとして正しく設定されています。
125-125: OpenRouterのデフォルトモデルが適切に設定されています
anthropic/claude-3.5-sonnetがOpenRouterサービスのデフォルトモデルとして設定されています。ユーザーが独自のモデルを選択できるようにUI上で適切に表示されるか確認してください。
71-71:Details
✅ Verification successful
OpenRouterのモデル配列が空で定義されています
OpenRouterのモデル配列が空で定義されていますが、これは意図的でしょうか?OpenRouterは多くのモデルをサポートしているので、事前定義されたモデルリストがあるか、または動的に取得するロジックがあるか確認してください。
以下のスクリプトを実行して、OpenRouterのモデルがコード内の他の場所で定義または動的に取得されているかを確認できます:
🏁 Script executed:
#!/bin/bash # OpenRouterのモデルが他の場所で定義または取得されているか検索 echo "OpenRouter関連のコードを検索中..." rg -g "*.ts" -g "*.tsx" "openrouter" --type=ts --type=tsxLength of output: 253
🏁 Script executed:
#!/bin/bash echo "全リポジトリでopenrouterを検索中..." rg -n -i openrouterLength of output: 7127
OpenRouterのモデル配列は意図的に空です
src/features/constants/aiModels.tsでopenrouter: []としているのは、OpenRouter のモデル一覧をコード内で事前定義せず、ユーザーが設定画面で直接モデル識別子を入力する設計とするためです。
デフォルトで利用するモデルは同ファイル下部のdefaultModels.openrouter('anthropic/claude-3.5-sonnet')で指定されています。— もし事前にモデル一覧を取得・表示したい場合は、OpenRouter の API(https://openrouter.ai/models)から動的に取得するロジックを追加してください。
website/document/zh/guide/ai/model-provider.md (2)
15-15: サポートされているAIサービスリストが更新されていますxAIとOpenRouterが中国語ドキュメントのAIサービスリストに適切に追加されています。
Also applies to: 22-22
104-123: xAIサービスのドキュメントが適切に追加されていますxAIサービスのための詳細なセクションが適切に追加され、API Key設定、サポートされているモデル、およびAPI Keyの取得方法に関する情報が含まれています。
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Devin is currently unreachable - the session may have died. |
…dd-dynamic-retrieval-option Add Dynamic Retrieval option to Search Grounding feature
Add Dynamic Retrieval option to Search Grounding feature
This PR implements the Dynamic Retrieval option for the Search Grounding feature in Gemini models as requested in issue #386.
Changes
dynamicRetrievalModeanddynamicRetrievalThresholdvercel.tsto handle dynamic retrieval configurationDetails
Testing
Link to Devin run: https://app.devin.ai/sessions/873659d0ee2d440992fcf067ebd4d6b0
Requested by: ニケちゃん / nikechan
Summary by CodeRabbit