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

Yikes #57

Closed
wants to merge 9 commits into from
Closed

Yikes #57

wants to merge 9 commits into from

Conversation

twilwa
Copy link

@twilwa twilwa commented Oct 7, 2023

look this over, all the code was written by gpt and i'm not a zillion percent sure it instantiated the vectorstore and other tools correctly and my local swarms is still installing lol

twilwa added 9 commits October 6, 2023 17:18
…ain language model and the `WebSearchTool` from the `swarms/tools/autogpt.py` worker class, and imported the actual agent class instead of the abstract one.

# Aider chat conversation:

USER: hey, we need to refactor `apps/discordwithweb.py`

ASSISTANT: Sure, I'd be happy to help with that. Could you please provide more details about the specific changes you'd like to make to the `apps/discordwithweb.py` file?

USER: yes - we need to refactor it to use the worker as the main llm, and use the `WebSearchTool` that's part of the class in the `swarms/tools/autogpt.py` worker class. also, the agent class that's being imported from swarms is an abstract class used for tyhpe validation only, we need to import the actual agent class.

ASSISTANT: To refactor the `apps/discordwithweb.py` file to use the worker as the main language model and use the `WebSearchTool` from the `swarms/tools/autogpt.py` file, we need to make the following changes:

1. Import the `WebSearchTool` from `swarms/tools/autogpt.py`.
2. Import the actual `Agent` class instead of the abstract one.
3. Replace the current `llm` with the worker.
4. Replace the current `WebSearchTool` with the one imported from `swarms/tools/autogpt.py`.

Here are the proposed changes:

<source>python
apps/discordwithweb.py
<<<<<<< HEAD
import discord
from discord.ext import commands

import os
import openai
import requests

from swarms.agents import Agent
from swarms.agents.memory import VectorStoreRetriever
from swarms.tools.base import BaseTool
=======
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
>>>>>>> updated
</source>

<source>python
apps/discordwithweb.py
<<<<<<< HEAD
# OpenAI API setup
openai.api_key = os.getenv("OPENAI_API_KEY")

# Memory setup
vectorstore_client = VectorStoreClient()
retriever = VectorStoreRetriever(vectorstore_client)

# Tools setup
web_search = WebSearchTool()
memory = MemoryTool(retriever)
tools = [web_search, memory]

# Create the agent
agent = Agent(
  name="DiscordAssistant",
  llm=openai,
  memory=retriever,
  tools=tools
)
=======
# Worker setup
worker = Worker()

# Memory setup
vectorstore_client = VectorStoreClient()
retriever = VectorStoreRetriever(vectorstore_client)

# Tools setup
web_search = WebSearchTool()
memory = MemoryTool(retriever)
tools = [web_search, memory]

# Create the agent
agent = Agent(
  name="DiscordAssistant",
  llm=worker,
  memory=retriever,
  tools=tools
)
>>>>>>> updated
</source>

Please confirm these changes.
… 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>
@twilwa twilwa closed this Oct 10, 2023
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.

1 participant