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

Add duckduckgo-search #405

Merged
merged 5 commits into from
Apr 22, 2024
Merged

Add duckduckgo-search #405

merged 5 commits into from
Apr 22, 2024

Conversation

sudoskys
Copy link
Member

@sudoskys sudoskys commented Apr 22, 2024

Summary by CodeRabbit

  • New Features
    • Added search functionality using DuckDuckGo API.
    • Updated voice functionality to use Google Text-to-Speech.
    • Added markdown formatting for environment and login command responses across multiple platforms.
  • Enhancements
    • Updated login documentation to include new parameters.
    • Improved logging for unpaired assistant messages.
  • Bug Fixes
    • Adjusted task continuation logic to enhance chat flow.
  • Documentation
    • Documented lack of support for triggering by reply on Line platform.
  • Refactor
    • Removed redundant JSON imports in various modules.
  • Chores
    • Updated project dependencies and version in pyproject.toml.

ℹ️ refactor: remove unnecessary imports in multiple files

✨ refactor: cleanup unused imports in various files

🔧 refactor: remove unused imports from multiple files
…port

- Added gTTS for Google Text-to-Speech functionality
- Integrated DuckDuckGo search engine for search functionality
Copy link
Contributor

coderabbitai bot commented Apr 22, 2024

Walkthrough

The recent updates primarily enhance functionality across various components of the llmkira project. Key changes include the addition of a new search function using DuckDuckGo, the switch from Edge TTS to Google's gTTS for text-to-speech, and improvements in message formatting with markdown across different messaging platforms. The login process and task execution conditions have also been refined, alongside general updates to dependencies and serialization methods.

Changes

File(s) Change Summary
README.md Updated login requirements and added Line as a platform.
app/middleware/llm_task.py Added warning log and mock message in pair_check.
app/receiver/function.py Modified chat continuation logic in task execution.
app/sender/.../__init__.py Unified removal of json import and adoption of dict2markdown for message formatting across Discord, Kook, Slack, and Telegram platforms.
app/sender/util_func.py Introduced dict2markdown function.
llmkira/extra/plugins/search/... Enhanced search functionality with DuckDuckGo integration and updated default behaviors in search functions.
llmkira/extra/voice/__init__.py Switched from Edge TTS to Google's gTTS for text-to-speech conversion.
llmkira/logic/__init__.py Enhanced LLMLogic with new serialization methods and added type imports.
pyproject.toml Updated project version and dependencies, including the switch from edge-tts to gTTS.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 4beda09 and 06bc971.
Files ignored due to path filters (1)
  • pdm.lock is excluded by !**/*.lock
Files selected for processing (13)
  • README.md (2 hunks)
  • app/middleware/llm_task.py (1 hunks)
  • app/receiver/function.py (1 hunks)
  • app/sender/discord/init.py (3 hunks)
  • app/sender/kook/init.py (3 hunks)
  • app/sender/slack/init.py (4 hunks)
  • app/sender/telegram/init.py (4 hunks)
  • app/sender/util_func.py (1 hunks)
  • llmkira/extra/plugins/search/init.py (3 hunks)
  • llmkira/extra/plugins/search/engine.py (2 hunks)
  • llmkira/extra/voice/init.py (3 hunks)
  • llmkira/logic/init.py (4 hunks)
  • pyproject.toml (3 hunks)
Additional Context Used
LanguageTool (67)
README.md (67)

Near line 40: Possible spelling mistake found.
Context: ...️ > Python>=3.9 This project uses the ToolCall feature. It integrates a message queui...


Near line 42: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ng plugin mechanisms and authentication prior to plugin execution. The bot adheres to t...


Near line 45: Possible spelling mistake found.
Context: ...in execution. The bot adheres to the Openai Format Schema. Please adapt using [ga...


Near line 46: Possible spelling mistake found.
Context: ...ps://github.com/Portkey-AI/gateway) or [one-api](https://github.com/songquanpeng/one-ap...


Near line 48: Possible typo: you repeated a whitespace
Context: ...quanpeng/one-api) independently. | Demo | Vision With Voice ...


Near line 48: Possible typo: you repeated a whitespace
Context: ... | Vision With Voice | Code Interpreter ...


Near line 48: Possible typo: you repeated a whitespace
Context: ... | Code Interpreter | |-------------------------------------...


Near line 81: Loose punctuation mark.
Context: ...s ### 🍔 Login Modes - Login via url: Use `/login $<something like h...


Near line 84: Loose punctuation mark.
Context: ...components/credential.py#L20). - Login: Use `/login https:///v1$<...


Near line 84: The currency mark is usually put at the beginning of the number.
Context: ...ents/credential.py#L20). - Login: Use `/login https:///v1$$$<tool model such a...


Near line 88: Possible typo: you repeated a whitespace
Context: ... Plugin Can Do More | Sticker Converter | Timer Function(built-in) | |---...


Near line 88: It appears that a white space is missing.
Context: ...erter | Timer Function(built-in) | |--------------------...


Near line 88: Possible typo: you repeated a whitespace
Context: ... | Timer Function(built-in) | |-------------------------------------...


Near line 94: Possible typo: you repeated a whitespace
Context: ...atform | Support | File System | Remarks | |----------|---------|-------------|--...


Near line 96: Possible typo: you repeated a whitespace
Context: ...------------------------| | Telegram | ✅ | ✅ | ...


Near line 96: Possible typo: you repeated a whitespace
Context: ...--------------| | Telegram | ✅ | ✅ | ...


Near line 96: Possible typo: you repeated a whitespace
Context: ...--| | Telegram | ✅ | ✅ | | | Discord | ✅ | ✅ | ...


Near line 97: Possible typo: you repeated a whitespace
Context: ... | | Discord | ✅ | ✅ | ...


Near line 97: Possible typo: you repeated a whitespace
Context: ... | | Discord | ✅ | ✅ | ...


Near line 97: Possible typo: you repeated a whitespace
Context: ... | | Discord | ✅ | ✅ | ...


Near line 97: Possible typo: you repeated a whitespace
Context: ... | | Discord | ✅ | ✅ | | | Kook | ✅ | ✅ | D...


Near line 98: Possible typo: you repeated a whitespace
Context: ... | | Kook | ✅ | ✅ | Does not suppo...


Near line 98: Possible typo: you repeated a whitespace
Context: ... | | Kook | ✅ | ✅ | Does not support `trigge...


Near line 98: Possible typo: you repeated a whitespace
Context: ... | | Kook | ✅ | ✅ | Does not support triggering by reply...


Near line 99: Possible typo: you repeated a whitespace
Context: ... support triggering by reply | | Slack | ✅ | ✅ | Does not suppo...


Near line 99: Possible typo: you repeated a whitespace
Context: ...t triggering by reply | | Slack | ✅ | ✅ | Does not support `trigge...


Near line 99: Possible typo: you repeated a whitespace
Context: ...ing by reply| | Slack | ✅ | ✅ | Does not supporttriggering by reply`...


Near line 100: Possible typo: you repeated a whitespace
Context: ...t support triggering by reply | | Line | ❌ | | ...


Near line 100: Possible typo: you repeated a whitespace
Context: ...t triggering by reply | | Line | ❌ | | ...


Near line 100: Possible typo: you repeated a whitespace
Context: ...ering by reply` | | Line | ❌ | | ...


Near line 100: Possible typo: you repeated a whitespace
Context: ...` | | Line | ❌ | | | | QQ | ❌ | | ...


Near line 101: Possible spelling mistake found.
Context: ... | | QQ | ❌ | | ...


Near line 101: Possible typo: you repeated a whitespace
Context: ... | | QQ | ❌ | | ...


Near line 101: Possible typo: you repeated a whitespace
Context: ... | | QQ | ❌ | | ...


Near line 101: Possible typo: you repeated a whitespace
Context: ... | | QQ | ❌ | | ...


Near line 101: Possible typo: you repeated a whitespace
Context: ... | | QQ | ❌ | | | | Wechat | ❌ | | ...


Near line 102: The official name of this popular chat service is spelled with a capital “C”.
Context: ... | | Wechat | ❌ | | ...


Near line 102: Possible typo: you repeated a whitespace
Context: ... | | Wechat | ❌ | | ...


Near line 102: Possible typo: you repeated a whitespace
Context: ... | | Wechat | ❌ | | ...


Near line 102: Possible typo: you repeated a whitespace
Context: ... | | Wechat | ❌ | | ...


Near line 102: Possible typo: you repeated a whitespace
Context: ... | | Wechat | ❌ | | | | Twitter | ❌ | | ...


Near line 103: Possible typo: you repeated a whitespace
Context: ... | | Twitter | ❌ | | ...


Near line 103: Possible typo: you repeated a whitespace
Context: ... | | Twitter | ❌ | | ...


Near line 103: Possible typo: you repeated a whitespace
Context: ... | | Twitter | ❌ | | ...


Near line 103: Possible typo: you repeated a whitespace
Context: ... | | Twitter | ❌ | | | | Matrix | ❌ | | ...


Near line 104: Possible typo: you repeated a whitespace
Context: ... | | Matrix | ❌ | | ...


Near line 104: Possible typo: you repeated a whitespace
Context: ... | | Matrix | ❌ | | ...


Near line 104: Possible typo: you repeated a whitespace
Context: ... | | Matrix | ❌ | | ...


Near line 104: Possible typo: you repeated a whitespace
Context: ... | | Matrix | ❌ | | | | IRC | ❌ | | ...


Near line 105: Possible typo: you repeated a whitespace
Context: ... | | IRC | ❌ | | ...


Near line 105: Possible typo: you repeated a whitespace
Context: ... | | IRC | ❌ | | ...


Near line 105: Possible typo: you repeated a whitespace
Context: ... | | IRC | ❌ | | ...


Near line 105: Possible typo: you repeated a whitespace
Context: ... | | IRC | ❌ | | | | ... | | | C...


Near line 106: Possible typo: you repeated a whitespace
Context: ... | | ... | | | Create Issue/P...


Near line 106: Possible typo: you repeated a whitespace
Context: ... | | ... | | | Create Issue/PR ...


Near line 106: Possible typo: you repeated a whitespace
Context: ... | | ... | | | Create Issue/PR ...


Near line 106: Possible typo: you repeated a whitespace
Context: ... | | Create Issue/PR | ## 📦 Quick Start Refer to the [🧀 D...


Near line 154: Unpaired symbol: ‘]’ seems to be missing
Context: ... attacked.** ### 🥣 Docker Build Hub: [sudoskys/llmbot](https://hub.docker.com/...


Near line 154: Possible spelling mistake found.
Context: ...attacked.** ### 🥣 Docker Build Hub: [sudoskys/llmbot](https://hub.docker.com/reposito...


Near line 154: Possible spelling mistake found.
Context: ...** ### 🥣 Docker Build Hub: [sudoskys/llmbot](https://hub.docker.com/repository/dock...


Near line 173: Possible spelling mistake found.
Context: ...image using docker-compose pull. Use docker exec -it llmbot /bin/bash to view Shell in Docker, ent...


Near line 196: Possible spelling mistake found.
Context: ...entation. ### Hooks Hooks control the EventMessage in sender and receiver. For example, we...


Near line 197: This sentence does not start with an uppercase letter.
Context: ...e have voice_hook in built-in hooks. you can enable it by setting `VOICE_REPLY_M...


Near line 207: This sentence does not start with an uppercase letter.
Context: ...= # not must ``` use /env VOICE_REPLY_ME=NONE to disable t...


Near line 209: This sentence does not start with an uppercase letter.
Context: ...CE_REPLY_ME=NONEto disable this env. check the source code inllmkira/extra/voice...


Near line 210: Possible spelling mistake found.
Context: ...ble this env. check the source code in llmkira/extra/voice_hook.py, learn to write yo...


Near line 218: Possible spelling mistake found.
Context: ...m) ## 📜 Notice > This project, named OpenAiBot, signifying "Open Artificial Intelligen...

Additional comments not posted (21)
pyproject.toml (2)

3-3: Version update to "1.0.4" is appropriate for introducing new features.


63-71: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [53-68]

Dependency updates are correctly reflected in the file.

llmkira/logic/__init__.py (2)

21-22: Addition of boolean properties to classes enhances clarity and usability.

Also applies to: 36-37


89-131: Addition of serialization and deserialization methods to LLMLogic class is well-implemented.

llmkira/extra/voice/__init__.py (1)

102-110: Modification to use Google's gTTS for text-to-speech conversion is correctly implemented.

llmkira/extra/plugins/search/__init__.py (2)

26-34: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [20-31]

Integration of search_in_duckduckgo as a fallback in search_on_serper is correctly implemented.


165-173: Update to function_response to include additional information is well-implemented.

app/sender/util_func.py (1)

228-232: Addition of dict2markdown function to convert dictionary to markdown format is correctly implemented.

README.md (2)

84-84: Update to the login process to require an additional parameter for the tool model is correctly documented.


100-100: Addition of Line as a platform with no support for triggering by reply is correctly documented.

app/middleware/llm_task.py (1)

105-105: Ensure the new warning log is integrated with the system's logging configuration.

app/receiver/function.py (2)

276-279: Ensure the condition string is correctly formatted and encapsulates all necessary details for the LLM to make an informed decision.


276-279: Consider adding error handling for the LLM call to handle potential failures gracefully.

app/sender/slack/__init__.py (2)

239-250: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [242-256]

Ensure that dict2markdown correctly handles all edge cases, such as empty or complex data structures.


239-250: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [242-256]

Consider adding error handling for the dict2markdown function to manage any potential formatting failures.

app/sender/kook/__init__.py (2)

399-399: Ensure that dict2markdown correctly handles all edge cases, such as empty or complex data structures.


399-399: Consider adding error handling for the dict2markdown function to manage any potential formatting failures.

app/sender/telegram/__init__.py (2)

239-252: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [243-260]

Ensure that dict2markdown correctly handles all edge cases, such as empty or complex data structures.


239-252: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [243-260]

Consider adding error handling for the dict2markdown function to manage any potential formatting failures.

app/sender/discord/__init__.py (2)

38-38: The addition of dict2markdown to the import list is noted.


394-394: Using dict2markdown for formatting environment variables enhances readability. Ensure it handles edge cases like special characters or very large data sets.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@sudoskys sudoskys added the New Features New feature or request label Apr 22, 2024
@sudoskys sudoskys merged commit 32389d4 into main Apr 22, 2024
Copy link
Contributor

@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

llmkira/extra/plugins/search/engine.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Features New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant