Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
v2.3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpreetbedi committed Feb 4, 2024
1 parent fe1eafd commit d86ffdd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 31 deletions.
39 changes: 10 additions & 29 deletions ai/knowledge_base.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,24 @@
from phi.embedder.openai import OpenAIEmbedder
from phi.knowledge.combined import CombinedKnowledgeBase
from phi.knowledge.pdf import PDFUrlKnowledgeBase, PDFKnowledgeBase
from phi.knowledge.website import WebsiteKnowledgeBase
from phi.vectordb.pgvector import PgVector
from phi.vectordb.pgvector import PgVector2

from db.session import db_url

url_pdf_knowledge_base = PDFUrlKnowledgeBase(
urls=["https://www.family-action.org.uk/content/uploads/2019/07/meals-more-recipes.pdf"],
# Store this knowledge base in ai.url_pdf_documents
vector_db=PgVector(
schema="ai",
db_url=db_url,
collection="url_pdf_documents",
),
# 2 references are added to the prompt
num_documents=2,
)

local_pdf_knowledge_base = PDFKnowledgeBase(
path="data/pdfs",
# Store this knowledge base in ai.local_pdf_documents
vector_db=PgVector(
schema="ai",
db_url=db_url,
collection="local_pdf_documents",
),
# 3 references are added to the prompt
num_documents=3,
)

pdf_knowledge_base = CombinedKnowledgeBase(
sources=[
url_pdf_knowledge_base,
local_pdf_knowledge_base,
PDFUrlKnowledgeBase(
urls=["https://www.family-action.org.uk/content/uploads/2019/07/meals-more-recipes.pdf"]
),
PDFKnowledgeBase(path="data/pdfs"),
],
# Store this knowledge base in ai.pdf_documents
vector_db=PgVector(
vector_db=PgVector2(
schema="ai",
db_url=db_url,
collection="pdf_documents",
embedder=OpenAIEmbedder(model="text-embedding-3-small"),
),
# 2 references are added to the prompt
num_documents=2,
Expand All @@ -50,10 +30,11 @@
# Number of links to follow from the seed URLs
max_links=15,
# Store this knowledge base in ai.website_documents
vector_db=PgVector(
vector_db=PgVector2(
schema="ai",
db_url=db_url,
collection="website_documents",
embedder=OpenAIEmbedder(model="text-embedding-3-small"),
),
# 3 references are added to the prompt
num_documents=3,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
# Linting and Formatting
"ruff",
# phidata
"phidata==2.3.13",
"phidata==2.3.14",
]

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ openai==1.11.0
packaging==23.2
pandas==2.2.0
pgvector==0.2.4
phidata==2.3.13
phidata==2.3.14
pillow==10.2.0
protobuf==4.25.2
psycopg[binary]==3.1.17
Expand Down

0 comments on commit d86ffdd

Please sign in to comment.