Skip to content

Commit

Permalink
feat!: Remove WebsiteKnowledgeBase
Browse files Browse the repository at this point in the history
Using a phidata knowledge base without pgvector isn't too useful. Once I learn more about databases I may re-add support with pgvector.
  • Loading branch information
slashtechno committed Jun 3, 2024
1 parent c82d43a commit 94882a1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
4 changes: 0 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ REDACT_EMAIL_ADDRESSES=true
NO_TOOLS=true
# API key for Exa (https://exa.ai), a search engine for LLMs
EXA_API_KEY=""
# URL(s) that should be scraped for information
# Multiple URLs can be passed by separating them with commas ("https://example.com,https://example.com")
SCRAPABLE_URL=""

# Show what tools are being called
SHOW_TOOL_CALLS = false
# Use phidata's debug mode
Expand Down
12 changes: 6 additions & 6 deletions llmail/utils/cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def set_argparse():
help="Exa API key for searching with Exa (disables DuckDuckGo)",
default=os.getenv("EXA_API_KEY") if os.getenv("EXA_API_KEY") else None,
)
ai.add_argument(
"--scrapable-url",
help="URL(s) that can be scraped for information",
default=(os.getenv("SCRAPABLE_URL").split(",") if os.getenv("SCRAPABLE_URL") else None),
action="append",
)
# ai.add_argument(
# "--scrapable-url",
# help="URL(s) that can be scraped for information",
# default=(os.getenv("SCRAPABLE_URL").split(",") if os.getenv("SCRAPABLE_URL") else None),
# action="append",
# )
ai.add_argument(
"--no-tools",
help="Do not use any tools via function calling",
Expand Down
24 changes: 13 additions & 11 deletions llmail/utils/responding.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from phi.llm.ollama import Ollama
from phi.tools.exa import ExaTools
from phi.tools.website import WebsiteTools
from phi.knowledge.website import WebsiteKnowledgeBase
from phi.knowledge.combined import CombinedKnowledgeBase
# from phi.knowledge.website import WebsiteKnowledgeBase
# from phi.knowledge.combined import CombinedKnowledgeBase
import ollama

# Uses utils/__init__.py to import from utils/logging.py and utils/cli_args.py respectively
Expand Down Expand Up @@ -164,11 +164,13 @@ def fetch_and_process_emails(
else:
ValueError("Invalid email thread")
# Select tools
website_knowledge_base = WebsiteKnowledgeBase(
urls=args.scrapable_url if args.scrapable_url else []
)
# website_knowledge_base = WebsiteKnowledgeBase(
# urls=args.scrapable_url if args.scrapable_url else []
# )
tools = [
WebsiteTools(knowledge_base=website_knowledge_base),
# Giving WebsiteTools the knowledge base seems to allow it to add URLs to the knowledge base
# WebsiteTools(knowledge_base=website_knowledge_base),
WebsiteTools(),
DuckDuckGo(search=True, news=True),
]
if args.exa_api_key is not None:
Expand Down Expand Up @@ -211,11 +213,11 @@ def fetch_and_process_emails(
tool_call_limit=10,
debug_mode=args.phidata_debug,
prevent_hallucinations=True,
knowledge_base=CombinedKnowledgeBase(
sources=[
website_knowledge_base,
]
),
# knowledge_base=CombinedKnowledgeBase(
# sources=[
# website_knowledge_base,
# ]
# ),
)
send_reply(
thread=tracking.get_thread_history(client, email_thread),
Expand Down

0 comments on commit 94882a1

Please sign in to comment.