aider: Refactored `apps/discordwithweb.py` to use the `WebpageQATool` from `swarms/tools/autogpt.py` for web search.
# Aider chat conversation: USER: let's refactor `apps/discordwithweb.py` to use the webpageqatool from `swarms/tools/autogpt.py` in order to perform a web search. ASSISTANT: To refactor `apps/discordwithweb.py` to use the `WebpageQATool` from `swarms/tools/autogpt.py`, we need to import `WebpageQATool` and replace the usage of `WebSearchTool` with `WebpageQATool`. Here are the steps: 1. Import `WebpageQATool` from `swarms/tools/autogpt.py`. 2. Replace the instantiation of `WebSearchTool` with `WebpageQATool`. 3. Update the `query` command to use `WebpageQATool` instead of `WebSearchTool`. Here are the changes: <source>python apps/discordwithweb.py <<<<<<< HEAD import discord from discord.ext import commands import os import requests from swarms.agents import Worker from swarms.agents.memory import VectorStoreRetriever from swarms.tools.autogpt import WebSearchTool ======= import discord from discord.ext import commands import os from swarms.agents import Worker from swarms.agents.memory import VectorStoreRetriever from swarms.tools.autogpt import WebpageQATool >>>>>>> updated </source> <source>python apps/discordwithweb.py <<<<<<< HEAD # Tools setup web_search = WebSearchTool() ======= # Tools setup web_search = WebpageQATool() >>>>>>> updated </source> <source>python apps/discordwithweb.py <<<<<<< HEAD @bot.command() async def query(ctx, *, input): response = agent.run(input) await ctx.send(response) ======= @bot.command() async def query(ctx, *, input): response = web_search.run(input) await ctx.send(response) >>>>>>> updated </source>pull/57/head
parent
088dbcdec1
commit
8fd9dab80e
Loading…
Reference in new issue