Spaces:
Sleeping
Sleeping
fixed up the embed_arxiv_paper tool
Browse files
innovation_pathfinder_ai/structured_tools/structured_tools.py
CHANGED
@@ -28,8 +28,11 @@ from innovation_pathfinder_ai.database.db_handler import (
|
|
28 |
from innovation_pathfinder_ai.vector_store.chroma_vector_store import (
|
29 |
add_pdf_to_vector_store
|
30 |
)
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
@tool
|
35 |
def arxiv_search(query: str) -> str:
|
@@ -129,8 +132,11 @@ def embed_arvix_paper(paper_id:str) -> None:
|
|
129 |
|
130 |
pdf_file_name = f"{number_without_period}.pdf"
|
131 |
|
|
|
|
|
|
|
132 |
# Download the PDF to a specified directory with a custom filename.
|
133 |
-
paper.download_pdf(dirpath=
|
134 |
|
135 |
client = chromadb.PersistentClient(
|
136 |
# path=persist_directory,
|
@@ -143,8 +149,10 @@ def embed_arvix_paper(paper_id:str) -> None:
|
|
143 |
model_name="all-MiniLM-L6-v2",
|
144 |
)
|
145 |
|
|
|
|
|
146 |
add_pdf_to_vector_store(
|
147 |
collection_name=collection_name,
|
148 |
-
pdf_file_location=
|
149 |
)
|
150 |
|
|
|
28 |
from innovation_pathfinder_ai.vector_store.chroma_vector_store import (
|
29 |
add_pdf_to_vector_store
|
30 |
)
|
31 |
+
from innovation_pathfinder_ai.utils.utils import (
|
32 |
+
create_wikipedia_urls_from_text, create_folder_if_not_exists,
|
33 |
+
)
|
34 |
+
import os
|
35 |
+
# from innovation_pathfinder_ai.utils import create_wikipedia_urls_from_text
|
36 |
|
37 |
@tool
|
38 |
def arxiv_search(query: str) -> str:
|
|
|
132 |
|
133 |
pdf_file_name = f"{number_without_period}.pdf"
|
134 |
|
135 |
+
pdf_directory = "./downloaded_papers"
|
136 |
+
create_folder_if_not_exists(pdf_directory)
|
137 |
+
|
138 |
# Download the PDF to a specified directory with a custom filename.
|
139 |
+
paper.download_pdf(dirpath=pdf_directory, filename=f"{number_without_period}.pdf")
|
140 |
|
141 |
client = chromadb.PersistentClient(
|
142 |
# path=persist_directory,
|
|
|
149 |
model_name="all-MiniLM-L6-v2",
|
150 |
)
|
151 |
|
152 |
+
full_path = os.path.join(pdf_directory, pdf_file_name)
|
153 |
+
|
154 |
add_pdf_to_vector_store(
|
155 |
collection_name=collection_name,
|
156 |
+
pdf_file_location=full_path,
|
157 |
)
|
158 |
|