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

Update duckduckgo tool option #439

Merged
merged 5 commits into from
Nov 20, 2024
Merged

Update duckduckgo tool option #439

merged 5 commits into from
Nov 20, 2024

Conversation

leehuwuj
Copy link
Collaborator

@leehuwuj leehuwuj commented Nov 20, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new vscode_settings.json file for Python development, allowing users to specify environment variables.
    • Added functionality to copy Visual Studio Code settings and configure the development environment for specific frameworks.
  • Bug Fixes

    • Deactivated the DuckDuckGo tool for TypeScript contexts to improve tool reliability.
    • Updated the toolset for the "rag" application type to replace DuckDuckGo with Wikipedia.
  • Improvements

    • Enhanced question extraction logic to return None when no content is matched, improving robustness.
    • Streamlined development container configuration by modifying the setup process.
    • Improved asset relocation functionality to handle vscode_settings.json correctly.

Copy link

changeset-bot bot commented Nov 20, 2024

🦋 Changeset detected

Latest commit: cfac420

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-llama Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

coderabbitai bot commented Nov 20, 2024

Walkthrough

The pull request introduces several modifications across different files, primarily focusing on updating tool configurations and enhancing functionality related to Visual Studio Code settings. Key changes include updating the supportedTools array in helpers/tools.ts, modifying the askSimpleQuestions function in questions/simple.ts, and refining the _extract_questions method in the NextQuestionSuggestion class. Additionally, new functions for VSCode configuration are added, and a new JSON settings file for Python development is introduced.

Changes

File Path Change Summary
helpers/tools.ts Updated supportedFrameworks for "DuckDuckGo Search" to only include ["fastapi"].
questions/simple.ts Altered askSimpleQuestions to change tool for "rag" app type from DuckDuckGo to WikipediaTool.
templates/components/services/python/suggestion.py Updated _extract_questions method to return `List[str]
.changeset/khaki-cobras-heal.md Deactivated DuckDuckGo tool for TypeScript.
.changeset/strange-icons-walk.md Replaced DuckDuckGo tool with Wikipedia tool in agentic template.
create-app.ts Replaced writeDevcontainer with configVSCode in createApp function.
helpers/copy.ts Added case in assetRelocator for vscode_settings.json to return settings.json.
helpers/vscode.ts Added copyVSCodeSettings and configVSCode functions; modified writeDevcontainer signature.
templates/vscode_settings.json Introduced new JSON file with setting "python.envFile": "".

Possibly related PRs

Suggested reviewers

  • thucpn
  • marcusschiesser

🐰 In the meadow, tools do play,
DuckDuckGo has gone away.
With Wikipedia, we now explore,
New settings for VSCode, oh what a score!
FastAPI leads the way, it's true,
In our coding garden, there's much to do! 🌼

Warning

Rate limit exceeded

@leehuwuj has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 22 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 663442f and cfac420.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
templates/components/llamaindex/typescript/streaming/suggestion.ts (1)

30-30: Track the TODO for structured predict implementation

The current regex-based parsing is fragile. Would you like me to create a GitHub issue to track the implementation of structured predict once LITS supports it?

templates/components/services/python/suggestion.py (1)

63-68: LGTM! Consider enhancing error handling with logging.

The changes improve type safety and error handling by explicitly returning None when no content is matched. The implementation is clean and aligns well with the TypeScript counterpart.

Consider adding debug logging when no content is matched to help with troubleshooting:

     def _extract_questions(cls, text: str) -> List[str] | None:
         content_match = re.search(r"```(.*?)```", text, re.DOTALL)
         content = content_match.group(1) if content_match else None
         if not content:
+            logger.debug("No questions found in the content")
             return None
         return [q.strip() for q in content.split("\n") if q.strip()]
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 49c35b8 and 212197b.

📒 Files selected for processing (4)
  • helpers/tools.ts (1 hunks)
  • questions/simple.ts (1 hunks)
  • templates/components/llamaindex/typescript/streaming/suggestion.ts (2 hunks)
  • templates/components/services/python/suggestion.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
templates/components/llamaindex/typescript/streaming/suggestion.ts (1)

Pattern templates/**: For files under the templates folder, do not report 'Missing Dependencies Detected' errors.

templates/components/services/python/suggestion.py (1)

Pattern templates/**: For files under the templates folder, do not report 'Missing Dependencies Detected' errors.

🔇 Additional comments (3)
templates/components/llamaindex/typescript/streaming/suggestion.ts (1)

Line range hint 30-42: Verify the impact of nullable return type

The change to return null instead of an empty array might require updates in consuming code to handle the null case explicitly. Please ensure that all callers of this function are updated to handle the null case appropriately.

questions/simple.ts (1)

134-134: LGTM! Please verify impact on existing RAG applications.

The change from DuckDuckGo to Wikipedia as the search tool for RAG applications looks good and aligns with the PR objectives.

Please ensure:

  1. Existing RAG applications using DuckDuckGo have been migrated or notified
  2. Documentation reflects this tool change
helpers/tools.ts (1)

68-68: ⚠️ Potential issue

Breaking Change: DuckDuckGo Search tool restricted to FastAPI only

The change removes support for NextJS and Express frameworks from the DuckDuckGo Search tool. While the TODO comment explains this is temporary due to issues with the duck-duck-scrape TypeScript library, this is a breaking change that affects existing applications.

Please:

  1. Verify the impact on existing NextJS and Express applications using this tool
  2. Document this change in the release notes
  3. Consider suggesting alternative tools (e.g., Wikipedia) for affected frameworks

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
helpers/vscode.ts (1)

62-71: Add error handling and consider framework configuration flexibility

Two suggestions for improvement:

  1. Add error handling for the async operations
  2. Consider making the framework configuration more maintainable
 export const configVSCode = async (
   root: string,
   templatesDir: string,
   framework: TemplateFramework,
 ) => {
+  try {
     await writeDevcontainer(root, templatesDir, framework);
-    if (framework === "fastapi") {
+    // Consider moving framework configurations to a separate config file
+    const frameworksWithVSCodeSettings = ["fastapi"];
+    if (frameworksWithVSCodeSettings.includes(framework)) {
       await copyVSCodeSettings(root, templatesDir);
     }
+  } catch (error) {
+    console.error("Failed to configure VS Code:", error);
+    throw error;
+  }
 };
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 212197b and 663442f.

📒 Files selected for processing (6)
  • .changeset/khaki-cobras-heal.md (1 hunks)
  • .changeset/strange-icons-walk.md (1 hunks)
  • create-app.ts (2 hunks)
  • helpers/copy.ts (1 hunks)
  • helpers/vscode.ts (2 hunks)
  • templates/vscode_settings.json (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • .changeset/khaki-cobras-heal.md
  • .changeset/strange-icons-walk.md
  • templates/vscode_settings.json
🔇 Additional comments (5)
helpers/copy.ts (1)

64-66: LGTM! Verify VSCode settings integration

The new case for handling VSCode settings file renaming is implemented correctly and follows the existing pattern. The transformation from vscode_settings.json to settings.json aligns with VSCode's expected configuration structure.

Please ensure that:

  1. The template file vscode_settings.json exists in the templates directory
  2. The copyVSCodeSettings function correctly uses this relocator
helpers/vscode.ts (2)

3-3: LGTM: Import statement is correctly structured

The new import for assetRelocator and copy is properly defined and follows TypeScript best practices.


Line range hint 29-47: LGTM: Improved function signature by removing unused parameter

The removal of the unused frontend parameter simplifies the function signature while maintaining its core functionality.

create-app.ts (2)

15-15: LGTM!

The import statement is clean and properly placed with other imports.


108-108: Verify handling of frontend configurations

The change from writeDevcontainer to configVSCode removes the frontend parameter. Please verify that frontend-specific VS Code configurations are still properly handled in the new implementation.

helpers/vscode.ts Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 663442f and cfac420.

📒 Files selected for processing (1)
  • helpers/vscode.ts (2 hunks)
🔇 Additional comments (3)
helpers/vscode.ts (3)

3-3: LGTM!

The new import statement is correctly added and necessary for the new functionality.


Line range hint 31-35: LGTM! Removed unused parameter.

The removal of the unused frontend parameter improves code clarity.


50-59: ⚠️ Potential issue

Add error handling and directory management

The function needs robust error handling and directory management:

  1. Check if .vscode directory exists
  2. Create directory if it doesn't exist
  3. Add error handling for file operations

Apply this diff to improve reliability:

 export const copyVSCodeSettings = async (
   root: string,
   templatesDir: string,
 ) => {
   const vscodeDir = path.join(root, ".vscode");
+  if (fs.existsSync(vscodeDir)) {
+    console.log("Template already has a .vscode directory. Using it.");
+    return;
+  }
+  try {
+    fs.mkdirSync(vscodeDir, { recursive: true });
     await copy("vscode_settings.json", vscodeDir, {
       cwd: templatesDir,
       rename: assetRelocator,
     });
+  } catch (error) {
+    console.error("Failed to copy VS Code settings:", error);
+    throw error;
+  }
 };

helpers/vscode.ts Show resolved Hide resolved
@marcusschiesser marcusschiesser merged commit 30fe269 into main Nov 20, 2024
46 checks passed
@marcusschiesser marcusschiesser deleted the lee/fix-stuff branch November 20, 2024 10:26
This was referenced Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants