3333from paperqa .types import Doc , DocDetails , DocKey , PQASession , Text
3434from paperqa .utils import (
3535 citation_to_docname ,
36- get_loop ,
3736 maybe_is_html ,
3837 maybe_is_pdf ,
3938 maybe_is_text ,
@@ -91,35 +90,6 @@ def _get_unique_name(self, docname: str) -> str:
9190 docname += suffix
9291 return docname
9392
94- def add_file (
95- self ,
96- file : BinaryIO ,
97- citation : str | None = None ,
98- docname : str | None = None ,
99- dockey : DocKey | None = None ,
100- settings : MaybeSettings = None ,
101- llm_model : LLMModel | None = None ,
102- embedding_model : EmbeddingModel | None = None ,
103- ) -> str | None :
104- warnings .warn (
105- "The synchronous `add_file` method is being deprecated in favor of the"
106- " asynchronous `aadd_file` method, this deprecation will conclude in"
107- " version 6." ,
108- category = DeprecationWarning ,
109- stacklevel = 2 ,
110- )
111- return get_loop ().run_until_complete (
112- self .aadd_file (
113- file ,
114- citation = citation ,
115- docname = docname ,
116- dockey = dockey ,
117- settings = settings ,
118- llm_model = llm_model ,
119- embedding_model = embedding_model ,
120- )
121- )
122-
12393 async def aadd_file (
12494 self ,
12595 file : BinaryIO ,
@@ -159,35 +129,6 @@ async def aadd_file(
159129 ** kwargs ,
160130 )
161131
162- def add_url (
163- self ,
164- url : str ,
165- citation : str | None = None ,
166- docname : str | None = None ,
167- dockey : DocKey | None = None ,
168- settings : MaybeSettings = None ,
169- llm_model : LLMModel | None = None ,
170- embedding_model : EmbeddingModel | None = None ,
171- ) -> str | None :
172- warnings .warn (
173- "The synchronous `add_url` method is being deprecated in favor of the"
174- " asynchronous `aadd_url` method, this deprecation will conclude in"
175- " version 6." ,
176- category = DeprecationWarning ,
177- stacklevel = 2 ,
178- )
179- return get_loop ().run_until_complete (
180- self .aadd_url (
181- url ,
182- citation = citation ,
183- docname = docname ,
184- dockey = dockey ,
185- settings = settings ,
186- llm_model = llm_model ,
187- embedding_model = embedding_model ,
188- )
189- )
190-
191132 async def aadd_url (
192133 self ,
193134 url : str ,
@@ -212,43 +153,6 @@ async def aadd_url(
212153 embedding_model = embedding_model ,
213154 )
214155
215- def add (
216- self ,
217- path : str | os .PathLike ,
218- citation : str | None = None ,
219- docname : str | None = None ,
220- dockey : DocKey | None = None ,
221- title : str | None = None ,
222- doi : str | None = None ,
223- authors : list [str ] | None = None ,
224- settings : MaybeSettings = None ,
225- llm_model : LLMModel | None = None ,
226- embedding_model : EmbeddingModel | None = None ,
227- ** kwargs ,
228- ) -> str | None :
229- warnings .warn (
230- "The synchronous `add` method is being deprecated in favor of the"
231- " asynchronous `aadd` method, this deprecation will conclude in"
232- " version 6." ,
233- category = DeprecationWarning ,
234- stacklevel = 2 ,
235- )
236- return get_loop ().run_until_complete (
237- self .aadd (
238- path ,
239- citation = citation ,
240- docname = docname ,
241- dockey = dockey ,
242- title = title ,
243- doi = doi ,
244- authors = authors ,
245- settings = settings ,
246- llm_model = llm_model ,
247- embedding_model = embedding_model ,
248- ** kwargs ,
249- )
250- )
251-
252156 async def aadd ( # noqa: PLR0912
253157 self ,
254158 path : str | os .PathLike ,
@@ -429,26 +333,6 @@ async def aadd( # noqa: PLR0912
429333 return doc .docname
430334 return None
431335
432- def add_texts (
433- self ,
434- texts : list [Text ],
435- doc : Doc ,
436- settings : MaybeSettings = None ,
437- embedding_model : EmbeddingModel | None = None ,
438- ) -> bool :
439- warnings .warn (
440- "The synchronous `add_texts` method is being deprecated in favor of the"
441- " asynchronous `aadd_texts` method, this deprecation will conclude in"
442- " version 6." ,
443- category = DeprecationWarning ,
444- stacklevel = 2 ,
445- )
446- return get_loop ().run_until_complete (
447- self .aadd_texts (
448- texts , doc , settings = settings , embedding_model = embedding_model
449- )
450- )
451-
452336 async def aadd_texts (
453337 self ,
454338 texts : list [Text ],
@@ -601,39 +485,9 @@ async def retrieve_texts(
601485 matches = [m for m in matches if m .doc .dockey not in self .deleted_dockeys ]
602486 return matches [:k ]
603487
604- def get_evidence (
605- self ,
606- query : PQASession | str ,
607- exclude_text_filter : set [str ] | None = None ,
608- settings : MaybeSettings = None ,
609- callbacks : Sequence [Callable ] | None = None ,
610- embedding_model : EmbeddingModel | None = None ,
611- summary_llm_model : LLMModel | None = None ,
612- partitioning_fn : Callable [[Embeddable ], int ] | None = None ,
613- ) -> PQASession :
614- warnings .warn (
615- "The synchronous `get_evidence` method is being deprecated in favor of the"
616- " asynchronous `aget_evidence` method, this deprecation will conclude in"
617- " version 6." ,
618- category = DeprecationWarning ,
619- stacklevel = 2 ,
620- )
621- return get_loop ().run_until_complete (
622- self .aget_evidence (
623- query = query ,
624- exclude_text_filter = exclude_text_filter ,
625- settings = settings ,
626- callbacks = callbacks ,
627- embedding_model = embedding_model ,
628- summary_llm_model = summary_llm_model ,
629- partitioning_fn = partitioning_fn ,
630- )
631- )
632-
633488 async def aget_evidence (
634489 self ,
635490 query : PQASession | str ,
636- exclude_text_filter : set [str ] | None = None ,
637491 settings : MaybeSettings = None ,
638492 callbacks : Sequence [Callable ] | None = None ,
639493 embedding_model : EmbeddingModel | None = None ,
@@ -660,21 +514,6 @@ async def aget_evidence(
660514 if summary_llm_model is None :
661515 summary_llm_model = evidence_settings .get_summary_llm ()
662516
663- if exclude_text_filter is not None :
664- text_name = Text .__name__
665- warnings .warn (
666- (
667- "The 'exclude_text_filter' argument did not work as intended"
668- f" due to a mix-up in excluding { text_name } .name vs { text_name } ."
669- f" This bug enabled us to have 2+ contexts per { text_name } , so to"
670- " first-class that capability and simplify our implementation,"
671- " we're removing the 'exclude_text_filter' argument."
672- " This deprecation will conclude in version 6"
673- ),
674- category = DeprecationWarning ,
675- stacklevel = 2 ,
676- )
677-
678517 if answer_config .evidence_retrieval :
679518 matches = await self .retrieve_texts (
680519 session .question ,
@@ -735,35 +574,6 @@ async def aget_evidence(
735574 session .contexts += [c for c , _ in results if c is not None and c .score > 0 ]
736575 return session
737576
738- def query (
739- self ,
740- query : PQASession | str ,
741- settings : MaybeSettings = None ,
742- callbacks : Sequence [Callable ] | None = None ,
743- llm_model : LLMModel | None = None ,
744- summary_llm_model : LLMModel | None = None ,
745- embedding_model : EmbeddingModel | None = None ,
746- partitioning_fn : Callable [[Embeddable ], int ] | None = None ,
747- ) -> PQASession :
748- warnings .warn (
749- "The synchronous `query` method is being deprecated in favor of the"
750- " asynchronous `aquery` method, this deprecation will conclude in"
751- " version 6." ,
752- category = DeprecationWarning ,
753- stacklevel = 2 ,
754- )
755- return get_loop ().run_until_complete (
756- self .aquery (
757- query ,
758- settings = settings ,
759- callbacks = callbacks ,
760- llm_model = llm_model ,
761- summary_llm_model = summary_llm_model ,
762- embedding_model = embedding_model ,
763- partitioning_fn = partitioning_fn ,
764- )
765- )
766-
767577 async def aquery (
768578 self ,
769579 query : PQASession | str ,
0 commit comments