diff --git a/paperqa/types.py b/paperqa/types.py index 036a8116..43ce8106 100644 --- a/paperqa/types.py +++ b/paperqa/types.py @@ -604,7 +604,7 @@ def repopulate_doc_id_from_doi(self) -> None: if self.doi: self.doc_id = encode_id(self.doi) - def __add__(self, other: DocDetails | int) -> DocDetails: + def __add__(self, other: DocDetails | int) -> DocDetails: # noqa: PLR0912 """Merge two DocDetails objects together.""" # control for usage w. Python's sum() function if isinstance(other, int): @@ -650,13 +650,20 @@ def __add__(self, other: DocDetails | int) -> DocDetails: # if we have multiple keys, we wipe them and allow regeneration merged_data[field] = None # type: ignore[assignment] - elif ( - field in {"citation_count", "year", "publication_date"} - and self_value is not None - and other_value is not None - ): + elif field in {"citation_count", "year", "publication_date"}: # get the latest data - merged_data[field] = max(self_value, other_value) + # this conditional is written in a way to handle if multiple doc objects + # are provided, we'll use the highest value + # if there's only one valid value, we'll use that regardless even if + # that value is 0 + if self_value is None or other_value is None: + merged_data[field] = ( + self_value + if self_value is not None # Dance around 0 + else other_value + ) + else: + merged_data[field] = max(self_value, other_value) else: # Prefer non-null values, default preference for 'other' object. diff --git a/tests/cassettes/test_title_search[paper_attributes0].yaml b/tests/cassettes/test_title_search[paper_attributes0].yaml index 4f3b1e10..72d477b0 100644 --- a/tests/cassettes/test_title_search[paper_attributes0].yaml +++ b/tests/cassettes/test_title_search[paper_attributes0].yaml @@ -1,4 +1,58 @@ interactions: + - request: + body: null + headers: {} + method: GET + uri: https://api.unpaywall.org/v2/search?query=Effect%20of%20native%20oxide%20layers%20on%20copper%20thin-film%20tensile%20properties:%20A%20reactive%20molecular%20dynamics%20study&email=example@papercrow.ai + response: + body: + string: + '{"elapsed_seconds":0.293,"results":[{"response":{"best_oa_location":null,"data_standard":2,"doi":"10.1063/1.4938384","doi_url":"https://doi.org/10.1063/1.4938384","first_oa_location":null,"genre":"journal-article","has_repository_copy":false,"is_oa":false,"is_paratext":false,"journal_is_in_doaj":false,"journal_is_oa":false,"journal_issn_l":"0021-8979","journal_issns":"0021-8979,1089-7550","journal_name":"Journal + of Applied Physics","oa_locations":[],"oa_locations_embargoed":[],"oa_status":"closed","published_date":"2015-12-21","publisher":"AIP + Publishing","title":"Effect of native oxide layers on copper thin-film tensile + properties: A reactive molecular dynamics study","updated":"2023-07-31T05:28:57.007821","year":2015,"z_authors":[{"affiliation":[{"name":"University + of Rochester 1 Materials Science Program, , Rochester, New York 14627, USA"}],"family":"Skarlinski","given":"Michael + D.","sequence":"first"},{"affiliation":[{"name":"University of Rochester 1 + Materials Science Program, , Rochester, New York 14627, USA"},{"name":"University + of Rochester 2 Department of Mechanical Engineering, , Rochester, New York + 14627, USA"}],"family":"Quesnel","given":"David J.","sequence":"additional"}]},"score":0.009231734,"snippet":"Effect + of native oxide layers on copper thin-film + tensile properties: A reactive molecular dynamics + study"}]} + + ' + headers: + Access-Control-Allow-Headers: + - origin, content-type, accept, x-requested-with + Access-Control-Allow-Methods: + - POST, GET, OPTIONS, PUT, DELETE, PATCH + Access-Control-Allow-Origin: + - "*" + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Length: + - "706" + Content-Type: + - application/json + Date: + - Mon, 16 Sep 2024 14:27:14 GMT + Nel: + - '{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}' + Report-To: + - '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1726496834&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=8Yb6yS3oBlsm7GItef5gXCaZZ5ZTUCpWzHxYNQaGnzk%3D"}]}' + Reporting-Endpoints: + - heroku-nel=https://nel.heroku.com/reports?ts=1726496834&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=8Yb6yS3oBlsm7GItef5gXCaZZ5ZTUCpWzHxYNQaGnzk%3D + Server: + - gunicorn + Vary: + - Accept-Encoding + Via: + - 1.1 vegur + status: + code: 200 + message: OK - request: body: null headers: {} @@ -21,7 +75,7 @@ interactions: tensile properties: A reactive molecular dynamics study},\n volume = {118},\n year = {2015}\n}\n"}, "authors": [{"authorId": "9821934", "name": "Michael Skarlinski"}, {"authorId": "37723150", "name": "D. Quesnel"}], "matchScore": - 283.23224}]} + 283.16406}]} ' headers: @@ -34,27 +88,27 @@ interactions: Content-Type: - application/json Date: - - Wed, 04 Sep 2024 22:54:18 GMT + - Mon, 16 Sep 2024 14:27:15 GMT Via: - - 1.1 e8075a4d83e15c8c6543597e1a8de938.cloudfront.net (CloudFront) + - 1.1 ad82d8a3c91257adecf18541576c7e72.cloudfront.net (CloudFront) X-Amz-Cf-Id: - - vB0latP66Hte1od43bgj7T8qLdb6UzgZtdqHNa2gxDLLvDKO6z_zQg== + - tzP7nmuXE6ItJQWbUpPZ2NM0OcRWRQnHsH4xNcUm1ww6zfKlEeF7Qg== X-Amz-Cf-Pop: - SFO53-C1 X-Cache: - Miss from cloudfront x-amz-apigw-id: - - dmi8GFhlvHcErEg= + - eM76cF3EPHcEbeQ= x-amzn-Remapped-Connection: - keep-alive x-amzn-Remapped-Content-Length: - "1109" x-amzn-Remapped-Date: - - Wed, 04 Sep 2024 22:54:18 GMT + - Mon, 16 Sep 2024 14:27:15 GMT x-amzn-Remapped-Server: - gunicorn x-amzn-RequestId: - - 88340ebb-a44f-4660-aa0f-f42e231133a9 + - 63c346cc-8764-4aea-a3d2-f29ca40b0d70 status: code: 200 message: OK @@ -66,7 +120,7 @@ interactions: response: body: string: - '{"status":"ok","message-type":"work-list","message-version":"1.0.0","message":{"facets":{},"total-results":11790075,"items":[{"indexed":{"date-parts":[[2023,9,29]],"date-time":"2023-09-29T22:47:50Z","timestamp":1696027670718},"reference-count":57,"publisher":"AIP + '{"status":"ok","message-type":"work-list","message-version":"1.0.0","message":{"facets":{},"total-results":11817992,"items":[{"indexed":{"date-parts":[[2023,9,29]],"date-time":"2023-09-29T22:47:50Z","timestamp":1696027670718},"reference-count":57,"publisher":"AIP Publishing","issue":"23","funder":[{"DOI":"10.13039\/100000006","name":"Office of Naval Research","doi-asserted-by":"publisher","award":["N00014-12-1-0542"],"id":[{"id":"10.13039\/100000006","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":["pubs.aip.org"],"crossmark-restriction":true},"published-print":{"date-parts":[[2015,12,21]]},"abstract":"Metal-oxide layers are likely to be present on metallic nano-structures due to either @@ -160,7 +214,7 @@ interactions: Sci. Eng. A"},{"key":"2023062402360541600_c55","doi-asserted-by":"publisher","first-page":"057129","DOI":"10.1063\/1.4880241","volume":"4","year":"2014","journal-title":"AIP Adv."},{"key":"2023062402360541600_c56","doi-asserted-by":"publisher","first-page":"94","DOI":"10.1016\/j.susc.2014.10.017","volume":"633","year":"2015","journal-title":"Surf. Sci."},{"key":"2023062402360541600_c57","doi-asserted-by":"publisher","first-page":"710","DOI":"10.1016\/j.pmatsci.2010.04.001","volume":"55","year":"2010","journal-title":"Prog. - Mater. Sci."}],"container-title":["Journal of Applied Physics"],"language":"en","link":[{"URL":"https:\/\/pubs.aip.org\/aip\/jap\/article-pdf\/doi\/10.1063\/1.4938384\/15174088\/235306_1_online.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"syndication"},{"URL":"https:\/\/pubs.aip.org\/aip\/jap\/article-pdf\/doi\/10.1063\/1.4938384\/15174088\/235306_1_online.pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2023,6,24]],"date-time":"2023-06-24T15:07:33Z","timestamp":1687619253000},"score":64.015274,"resource":{"primary":{"URL":"https:\/\/pubs.aip.org\/jap\/article\/118\/23\/235306\/141678\/Effect-of-native-oxide-layers-on-copper-thin-film"}},"issued":{"date-parts":[[2015,12,21]]},"references-count":57,"journal-issue":{"issue":"23","published-print":{"date-parts":[[2015,12,21]]}},"URL":"http:\/\/dx.doi.org\/10.1063\/1.4938384","ISSN":["0021-8979","1089-7550"],"issn-type":[{"value":"0021-8979","type":"print"},{"value":"1089-7550","type":"electronic"}],"published-other":{"date-parts":[[2015,12,21]]},"published":{"date-parts":[[2015,12,21]]}}],"items-per-page":1,"query":{"start-index":0,"search-terms":null}}}' + Mater. Sci."}],"container-title":["Journal of Applied Physics"],"language":"en","link":[{"URL":"https:\/\/pubs.aip.org\/aip\/jap\/article-pdf\/doi\/10.1063\/1.4938384\/15174088\/235306_1_online.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"syndication"},{"URL":"https:\/\/pubs.aip.org\/aip\/jap\/article-pdf\/doi\/10.1063\/1.4938384\/15174088\/235306_1_online.pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2023,6,24]],"date-time":"2023-06-24T15:07:33Z","timestamp":1687619253000},"score":63.781567,"resource":{"primary":{"URL":"https:\/\/pubs.aip.org\/jap\/article\/118\/23\/235306\/141678\/Effect-of-native-oxide-layers-on-copper-thin-film"}},"issued":{"date-parts":[[2015,12,21]]},"references-count":57,"journal-issue":{"issue":"23","published-print":{"date-parts":[[2015,12,21]]}},"URL":"http:\/\/dx.doi.org\/10.1063\/1.4938384","ISSN":["0021-8979","1089-7550"],"issn-type":[{"value":"0021-8979","type":"print"},{"value":"1089-7550","type":"electronic"}],"published-other":{"date-parts":[[2015,12,21]]},"published":{"date-parts":[[2015,12,21]]}}],"items-per-page":1,"query":{"start-index":0,"search-terms":null}}}' headers: Access-Control-Allow-Headers: - X-Requested-With, Accept, Accept-Encoding, Accept-Charset, Accept-Language, @@ -174,11 +228,11 @@ interactions: Content-Encoding: - gzip Content-Length: - - "3945" + - "3947" Content-Type: - application/json Date: - - Wed, 04 Sep 2024 22:54:18 GMT + - Mon, 16 Sep 2024 14:27:15 GMT Server: - Jetty(9.4.40.v20210413) Vary: @@ -225,7 +279,7 @@ interactions: Connection: - close Date: - - Wed, 04 Sep 2024 22:54:19 GMT + - Mon, 16 Sep 2024 14:27:16 GMT Server: - Jetty(9.4.40.v20210413) Transfer-Encoding: @@ -245,58 +299,4 @@ interactions: status: code: 200 message: OK - - request: - body: null - headers: {} - method: GET - uri: https://api.unpaywall.org/v2/search?query=Effect%20of%20native%20oxide%20layers%20on%20copper%20thin-film%20tensile%20properties:%20A%20reactive%20molecular%20dynamics%20study&email=example@papercrow.ai - response: - body: - string: - '{"elapsed_seconds":0.357,"results":[{"response":{"best_oa_location":null,"data_standard":2,"doi":"10.1063/1.4938384","doi_url":"https://doi.org/10.1063/1.4938384","first_oa_location":null,"genre":"journal-article","has_repository_copy":false,"is_oa":false,"is_paratext":false,"journal_is_in_doaj":false,"journal_is_oa":false,"journal_issn_l":"0021-8979","journal_issns":"0021-8979,1089-7550","journal_name":"Journal - of Applied Physics","oa_locations":[],"oa_locations_embargoed":[],"oa_status":"closed","published_date":"2015-12-21","publisher":"AIP - Publishing","title":"Effect of native oxide layers on copper thin-film tensile - properties: A reactive molecular dynamics study","updated":"2023-07-31T05:28:57.007821","year":2015,"z_authors":[{"affiliation":[{"name":"University - of Rochester 1 Materials Science Program, , Rochester, New York 14627, USA"}],"family":"Skarlinski","given":"Michael - D.","sequence":"first"},{"affiliation":[{"name":"University of Rochester 1 - Materials Science Program, , Rochester, New York 14627, USA"},{"name":"University - of Rochester 2 Department of Mechanical Engineering, , Rochester, New York - 14627, USA"}],"family":"Quesnel","given":"David J.","sequence":"additional"}]},"score":0.009231734,"snippet":"Effect - of native oxide layers on copper thin-film - tensile properties: A reactive molecular dynamics - study"}]} - - ' - headers: - Access-Control-Allow-Headers: - - origin, content-type, accept, x-requested-with - Access-Control-Allow-Methods: - - POST, GET, OPTIONS, PUT, DELETE, PATCH - Access-Control-Allow-Origin: - - "*" - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Length: - - "706" - Content-Type: - - application/json - Date: - - Wed, 04 Sep 2024 22:54:20 GMT - Nel: - - '{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}' - Report-To: - - '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1725490458&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=3iH3mreiGrF6hHOFWXTx5avt8oC7DhAjNvJhBq5sqs8%3D"}]}' - Reporting-Endpoints: - - heroku-nel=https://nel.heroku.com/reports?ts=1725490458&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=3iH3mreiGrF6hHOFWXTx5avt8oC7DhAjNvJhBq5sqs8%3D - Server: - - gunicorn - Vary: - - Accept-Encoding - Via: - - 1.1 vegur - status: - code: 200 - message: OK version: 1 diff --git a/tests/cassettes/test_title_search[paper_attributes1].yaml b/tests/cassettes/test_title_search[paper_attributes1].yaml index 3973edff..d7cabab8 100644 --- a/tests/cassettes/test_title_search[paper_attributes1].yaml +++ b/tests/cassettes/test_title_search[paper_attributes1].yaml @@ -6,7 +6,7 @@ interactions: uri: https://api.unpaywall.org/v2/search?query=PaperQA:%20Retrieval-Augmented%20Generative%20Agent%20for%20Scientific%20Research&email=example@papercrow.ai response: body: - string: '{"elapsed_seconds":0.018,"results":[]} + string: '{"elapsed_seconds":0.021,"results":[]} ' headers: @@ -23,13 +23,13 @@ interactions: Content-Type: - application/json Date: - - Wed, 04 Sep 2024 22:54:20 GMT + - Mon, 16 Sep 2024 14:27:24 GMT Nel: - '{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}' Report-To: - - '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1725490460&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=HLxBN33rMeUOx491OpwKHBqFWhk%2F47Zh%2FMQMQA3ZIc0%3D"}]}' + - '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1726496844&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=8R%2FkS7ZX7kIO47oqQL9k7%2F0TOIAIV7TNhokT4OBh6HQ%3D"}]}' Reporting-Endpoints: - - heroku-nel=https://nel.heroku.com/reports?ts=1725490460&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=HLxBN33rMeUOx491OpwKHBqFWhk%2F47Zh%2FMQMQA3ZIc0%3D + - heroku-nel=https://nel.heroku.com/reports?ts=1726496844&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=8R%2FkS7ZX7kIO47oqQL9k7%2F0TOIAIV7TNhokT4OBh6HQ%3D Server: - gunicorn Via: @@ -37,6 +37,67 @@ interactions: status: code: 200 message: OK + - request: + body: null + headers: {} + method: GET + uri: https://api.semanticscholar.org/graph/v1/paper/search/match?query=PaperQA:+Retrieval-Augmented+Generative+Agent+for+Scientific+Research&fields=authors,citationCount,citationStyles,externalIds,influentialCitationCount,isOpenAccess,journal,openAccessPdf,publicationDate,publicationTypes,title,url,venue,year + response: + body: + string: + '{"data": [{"paperId": "7e55d8701785818776323b4147cb13354c820469", "externalIds": + {"ArXiv": "2312.07559", "DBLP": "journals/corr/abs-2312-07559", "DOI": "10.48550/arXiv.2312.07559", + "CorpusId": 266191420}, "url": "https://www.semanticscholar.org/paper/7e55d8701785818776323b4147cb13354c820469", + "title": "PaperQA: Retrieval-Augmented Generative Agent for Scientific Research", + "venue": "arXiv.org", "year": 2023, "citationCount": 25, "influentialCitationCount": + 1, "isOpenAccess": false, "openAccessPdf": null, "publicationTypes": ["JournalArticle"], + "publicationDate": "2023-12-08", "journal": {"name": "ArXiv", "volume": "abs/2312.07559"}, + "citationStyles": {"bibtex": "@Article{L''ala2023PaperQARG,\n author = {Jakub + L''ala and Odhran O''Donoghue and Aleksandar Shtedritski and Sam Cox and Samuel + G. Rodriques and Andrew D. White},\n booktitle = {arXiv.org},\n journal = + {ArXiv},\n title = {PaperQA: Retrieval-Augmented Generative Agent for Scientific + Research},\n volume = {abs/2312.07559},\n year = {2023}\n}\n"}, "authors": + [{"authorId": "2219926382", "name": "Jakub L''ala"}, {"authorId": "2258961056", + "name": "Odhran O''Donoghue"}, {"authorId": "2258961451", "name": "Aleksandar + Shtedritski"}, {"authorId": "2161337138", "name": "Sam Cox"}, {"authorId": + "2258964497", "name": "Samuel G. Rodriques"}, {"authorId": "2273941271", "name": + "Andrew D. White"}], "matchScore": 245.30392}]} + + ' + headers: + Access-Control-Allow-Origin: + - "*" + Connection: + - keep-alive + Content-Length: + - "1386" + Content-Type: + - application/json + Date: + - Mon, 16 Sep 2024 14:27:24 GMT + Via: + - 1.1 cc58556a6e846289f4d3105969536e4c.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - vYVSmPNOxrNMlkPspTDYwQvTEjEt_FnRdoOcXM_xqzHzattndSdWnA== + X-Amz-Cf-Pop: + - SFO53-C1 + X-Cache: + - Miss from cloudfront + x-amz-apigw-id: + - eM78AGtAPHcElCw= + x-amzn-Remapped-Connection: + - keep-alive + x-amzn-Remapped-Content-Length: + - "1386" + x-amzn-Remapped-Date: + - Mon, 16 Sep 2024 14:27:24 GMT + x-amzn-Remapped-Server: + - gunicorn + x-amzn-RequestId: + - 20898718-6cb6-472f-95a9-0dce2bb43279 + status: + code: 200 + message: OK - request: body: null headers: {} @@ -45,7 +106,7 @@ interactions: response: body: string: - '{"status":"ok","message-type":"work-list","message-version":"1.0.0","message":{"facets":{},"total-results":2016375,"items":[{"indexed":{"date-parts":[[2024,3,8]],"date-time":"2024-03-08T00:26:06Z","timestamp":1709857566241},"reference-count":48,"publisher":"Oxford + '{"status":"ok","message-type":"work-list","message-version":"1.0.0","message":{"facets":{},"total-results":2022077,"items":[{"indexed":{"date-parts":[[2024,3,8]],"date-time":"2024-03-08T00:26:06Z","timestamp":1709857566241},"reference-count":48,"publisher":"Oxford University Press (OUP)","issue":"1","license":[{"start":{"date-parts":[[2024,2,21]],"date-time":"2024-02-21T00:00:00Z","timestamp":1708473600000},"content-version":"vor","delay-in-days":48,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"DOI":"10.13039\/100000092","name":"National Library of Medicine","doi-asserted-by":"publisher","award":["R01LM009886","R01LM014344"],"id":[{"id":"10.13039\/100000092","id-type":"DOI","asserted-by":"publisher"}]},{"DOI":"10.13039\/100006108","name":"National Center for Advancing Translational Sciences","doi-asserted-by":"publisher","award":["UL1TR001873"],"id":[{"id":"10.13039\/100006108","id-type":"DOI","asserted-by":"publisher"}]},{"DOI":"10.13039\/100000002","name":"National @@ -132,7 +193,7 @@ interactions: gain-based evaluation of IR techniques","volume":"20","author":"J\u00e4rvelin","year":"2002","journal-title":"ACM Trans Inf Syst"},{"key":"2024030720490192400_ooae021-B46","volume-title":"Evidence-Based Practice in Nursing & Healthcare: A Guide to Best Practice","author":"Melnyk","year":"2022"},{"key":"2024030720490192400_ooae021-B47","first-page":"206","author":"Gupta","year":"2017"},{"key":"2024030720490192400_ooae021-B48","first-page":"1","author":"Park","year":"2012"}],"container-title":["JAMIA - Open"],"language":"en","link":[{"URL":"https:\/\/academic.oup.com\/jamiaopen\/advance-article-pdf\/doi\/10.1093\/jamiaopen\/ooae021\/56732770\/ooae021.pdf","content-type":"application\/pdf","content-version":"am","intended-application":"syndication"},{"URL":"https:\/\/academic.oup.com\/jamiaopen\/article-pdf\/7\/1\/ooae021\/56904263\/ooae021.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"syndication"},{"URL":"https:\/\/academic.oup.com\/jamiaopen\/article-pdf\/7\/1\/ooae021\/56904263\/ooae021.pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2024,3,7]],"date-time":"2024-03-07T20:49:23Z","timestamp":1709844563000},"score":28.21724,"resource":{"primary":{"URL":"https:\/\/academic.oup.com\/jamiaopen\/article\/doi\/10.1093\/jamiaopen\/ooae021\/7612234"}},"issued":{"date-parts":[[2024,1,4]]},"references-count":48,"journal-issue":{"issue":"1","published-print":{"date-parts":[[2024,1,4]]}},"URL":"http:\/\/dx.doi.org\/10.1093\/jamiaopen\/ooae021","ISSN":["2574-2531"],"issn-type":[{"value":"2574-2531","type":"electronic"}],"published-other":{"date-parts":[[2024,4,1]]},"published":{"date-parts":[[2024,1,4]]}}],"items-per-page":1,"query":{"start-index":0,"search-terms":null}}}' + Open"],"language":"en","link":[{"URL":"https:\/\/academic.oup.com\/jamiaopen\/advance-article-pdf\/doi\/10.1093\/jamiaopen\/ooae021\/56732770\/ooae021.pdf","content-type":"application\/pdf","content-version":"am","intended-application":"syndication"},{"URL":"https:\/\/academic.oup.com\/jamiaopen\/article-pdf\/7\/1\/ooae021\/56904263\/ooae021.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"syndication"},{"URL":"https:\/\/academic.oup.com\/jamiaopen\/article-pdf\/7\/1\/ooae021\/56904263\/ooae021.pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2024,3,7]],"date-time":"2024-03-07T20:49:23Z","timestamp":1709844563000},"score":27.98084,"resource":{"primary":{"URL":"https:\/\/academic.oup.com\/jamiaopen\/article\/doi\/10.1093\/jamiaopen\/ooae021\/7612234"}},"issued":{"date-parts":[[2024,1,4]]},"references-count":48,"journal-issue":{"issue":"1","published-print":{"date-parts":[[2024,1,4]]}},"URL":"http:\/\/dx.doi.org\/10.1093\/jamiaopen\/ooae021","ISSN":["2574-2531"],"issn-type":[{"value":"2574-2531","type":"electronic"}],"published-other":{"date-parts":[[2024,4,1]]},"published":{"date-parts":[[2024,1,4]]}}],"items-per-page":1,"query":{"start-index":0,"search-terms":null}}}' headers: Access-Control-Allow-Headers: - X-Requested-With, Accept, Accept-Encoding, Accept-Charset, Accept-Language, @@ -146,11 +207,11 @@ interactions: Content-Encoding: - gzip Content-Length: - - "4501" + - "4502" Content-Type: - application/json Date: - - Wed, 04 Sep 2024 22:54:20 GMT + - Mon, 16 Sep 2024 14:27:24 GMT Server: - Jetty(9.4.40.v20210413) Vary: @@ -170,65 +231,4 @@ interactions: status: code: 200 message: OK - - request: - body: null - headers: {} - method: GET - uri: https://api.semanticscholar.org/graph/v1/paper/search/match?query=PaperQA:+Retrieval-Augmented+Generative+Agent+for+Scientific+Research&fields=authors,citationCount,citationStyles,externalIds,influentialCitationCount,isOpenAccess,journal,openAccessPdf,publicationDate,publicationTypes,title,url,venue,year - response: - body: - string: - '{"data": [{"paperId": "7e55d8701785818776323b4147cb13354c820469", "externalIds": - {"ArXiv": "2312.07559", "DBLP": "journals/corr/abs-2312-07559", "DOI": "10.48550/arXiv.2312.07559", - "CorpusId": 266191420}, "url": "https://www.semanticscholar.org/paper/7e55d8701785818776323b4147cb13354c820469", - "title": "PaperQA: Retrieval-Augmented Generative Agent for Scientific Research", - "venue": "arXiv.org", "year": 2023, "citationCount": 23, "influentialCitationCount": - 1, "isOpenAccess": false, "openAccessPdf": null, "publicationTypes": ["JournalArticle"], - "publicationDate": "2023-12-08", "journal": {"name": "ArXiv", "volume": "abs/2312.07559"}, - "citationStyles": {"bibtex": "@Article{L''ala2023PaperQARG,\n author = {Jakub - L''ala and Odhran O''Donoghue and Aleksandar Shtedritski and Sam Cox and Samuel - G. Rodriques and Andrew D. White},\n booktitle = {arXiv.org},\n journal = - {ArXiv},\n title = {PaperQA: Retrieval-Augmented Generative Agent for Scientific - Research},\n volume = {abs/2312.07559},\n year = {2023}\n}\n"}, "authors": - [{"authorId": "2219926382", "name": "Jakub L''ala"}, {"authorId": "2258961056", - "name": "Odhran O''Donoghue"}, {"authorId": "2258961451", "name": "Aleksandar - Shtedritski"}, {"authorId": "2161337138", "name": "Sam Cox"}, {"authorId": - "2258964497", "name": "Samuel G. Rodriques"}, {"authorId": "2273941271", "name": - "Andrew D. White"}], "matchScore": 245.32262}]} - - ' - headers: - Access-Control-Allow-Origin: - - "*" - Connection: - - keep-alive - Content-Length: - - "1386" - Content-Type: - - application/json - Date: - - Wed, 04 Sep 2024 22:54:21 GMT - Via: - - 1.1 22dc875d744f932282ce89367c98a9de.cloudfront.net (CloudFront) - X-Amz-Cf-Id: - - wPdXFyJ6K74yqvcthCmUvijgxfYiphfPhTqPkAOi1NLDO3OTHvZfVQ== - X-Amz-Cf-Pop: - - SFO53-C1 - X-Cache: - - Miss from cloudfront - x-amz-apigw-id: - - dmi8gHlpvHcEFBg= - x-amzn-Remapped-Connection: - - keep-alive - x-amzn-Remapped-Content-Length: - - "1386" - x-amzn-Remapped-Date: - - Wed, 04 Sep 2024 22:54:21 GMT - x-amzn-Remapped-Server: - - gunicorn - x-amzn-RequestId: - - 3f4118a6-9ea7-482d-b995-b6732d7193e3 - status: - code: 200 - message: OK version: 1 diff --git a/tests/cassettes/test_title_search[paper_attributes2].yaml b/tests/cassettes/test_title_search[paper_attributes2].yaml index fa3c5b27..5fab5b72 100644 --- a/tests/cassettes/test_title_search[paper_attributes2].yaml +++ b/tests/cassettes/test_title_search[paper_attributes2].yaml @@ -7,7 +7,7 @@ interactions: response: body: string: - '{"status":"ok","message-type":"work-list","message-version":"1.0.0","message":{"facets":{},"total-results":2296021,"items":[{"indexed":{"date-parts":[[2024,9,4]],"date-time":"2024-09-04T17:39:08Z","timestamp":1725471548702},"reference-count":103,"publisher":"Springer + '{"status":"ok","message-type":"work-list","message-version":"1.0.0","message":{"facets":{},"total-results":2302135,"items":[{"indexed":{"date-parts":[[2024,9,13]],"date-time":"2024-09-13T07:49:27Z","timestamp":1726213767507},"reference-count":103,"publisher":"Springer Science and Business Media LLC","issue":"5","license":[{"start":{"date-parts":[[2024,5,8]],"date-time":"2024-05-08T00:00:00Z","timestamp":1715126400000},"content-version":"tdm","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0"},{"start":{"date-parts":[[2024,5,8]],"date-time":"2024-05-08T00:00:00Z","timestamp":1715126400000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0"}],"funder":[{"DOI":"10.13039\/501100001711","name":"Schweizerischer Nationalfonds zur F\u00f6rderung der Wissenschaftlichen Forschung","doi-asserted-by":"publisher","award":["180544","180544","180544"],"id":[{"id":"10.13039\/501100001711","id-type":"DOI","asserted-by":"publisher"}]},{"DOI":"10.13039\/100000001","name":"National Science Foundation","doi-asserted-by":"publisher","award":["1751471","1751471"],"id":[{"id":"10.13039\/100000001","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":["link.springer.com"],"crossmark-restriction":false},"short-container-title":["Nat @@ -24,7 +24,7 @@ interactions: both LLM and expert assessments, demonstrates ChemCrow\u2019s effectiveness in automating a diverse set of chemical tasks. Our work not only aids expert chemists and lowers barriers for non-experts but also fosters scientific advancement - by bridging the gap between experimental and computational chemistry.<\/jats:p>","DOI":"10.1038\/s42256-024-00832-8","type":"journal-article","created":{"date-parts":[[2024,5,8]],"date-time":"2024-05-08T10:03:31Z","timestamp":1715162611000},"page":"525-535","update-policy":"http:\/\/dx.doi.org\/10.1007\/springer_crossmark_policy","source":"Crossref","is-referenced-by-count":17,"title":["Augmenting + by bridging the gap between experimental and computational chemistry.<\/jats:p>","DOI":"10.1038\/s42256-024-00832-8","type":"journal-article","created":{"date-parts":[[2024,5,8]],"date-time":"2024-05-08T10:03:31Z","timestamp":1715162611000},"page":"525-535","update-policy":"http:\/\/dx.doi.org\/10.1007\/springer_crossmark_policy","source":"Crossref","is-referenced-by-count":20,"title":["Augmenting large language models with chemistry tools"],"prefix":"10.1038","volume":"6","author":[{"given":"Andres","family":"M. Bran","sequence":"first","affiliation":[]},{"given":"Sam","family":"Cox","sequence":"additional","affiliation":[]},{"ORCID":"http:\/\/orcid.org\/0000-0003-0310-0851","authenticated-orcid":false,"given":"Oliver","family":"Schilter","sequence":"additional","affiliation":[]},{"given":"Carlo","family":"Baldassari","sequence":"additional","affiliation":[]},{"ORCID":"http:\/\/orcid.org\/0000-0002-6647-3965","authenticated-orcid":false,"given":"Andrew D.","family":"White","sequence":"additional","affiliation":[]},{"ORCID":"http:\/\/orcid.org\/0000-0003-3046-6576","authenticated-orcid":false,"given":"Philippe","family":"Schwaller","sequence":"additional","affiliation":[]}],"member":"297","published-online":{"date-parts":[[2024,5,8]]},"reference":[{"key":"832_CR1","unstructured":"Devlin, @@ -313,7 +313,7 @@ interactions: (2024).","DOI":"10.5281\/zenodo.10884645"},{"key":"832_CR103","doi-asserted-by":"publisher","unstructured":"Bran, A., Cox, S., White, A. & Schwaller, P. ur-whitelab\/chemcrow-public: v0.3.24. Zenodo https:\/\/doi.org\/10.5281\/zenodo.10884639 (2024).","DOI":"10.5281\/zenodo.10884639"}],"container-title":["Nature - Machine Intelligence"],"language":"en","link":[{"URL":"https:\/\/www.nature.com\/articles\/s42256-024-00832-8.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/www.nature.com\/articles\/s42256-024-00832-8","content-type":"text\/html","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/www.nature.com\/articles\/s42256-024-00832-8.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2024,5,23]],"date-time":"2024-05-23T23:03:31Z","timestamp":1716505411000},"score":46.731644,"resource":{"primary":{"URL":"https:\/\/www.nature.com\/articles\/s42256-024-00832-8"}},"issued":{"date-parts":[[2024,5,8]]},"references-count":103,"journal-issue":{"issue":"5","published-online":{"date-parts":[[2024,5]]}},"alternative-id":["832"],"URL":"http:\/\/dx.doi.org\/10.1038\/s42256-024-00832-8","ISSN":["2522-5839"],"issn-type":[{"value":"2522-5839","type":"electronic"}],"published":{"date-parts":[[2024,5,8]]},"assertion":[{"value":"13 + Machine Intelligence"],"language":"en","link":[{"URL":"https:\/\/www.nature.com\/articles\/s42256-024-00832-8.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/www.nature.com\/articles\/s42256-024-00832-8","content-type":"text\/html","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/www.nature.com\/articles\/s42256-024-00832-8.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2024,5,23]],"date-time":"2024-05-23T23:03:31Z","timestamp":1716505411000},"score":46.488018,"resource":{"primary":{"URL":"https:\/\/www.nature.com\/articles\/s42256-024-00832-8"}},"issued":{"date-parts":[[2024,5,8]]},"references-count":103,"journal-issue":{"issue":"5","published-online":{"date-parts":[[2024,5]]}},"alternative-id":["832"],"URL":"http:\/\/dx.doi.org\/10.1038\/s42256-024-00832-8","ISSN":["2522-5839"],"issn-type":[{"value":"2522-5839","type":"electronic"}],"published":{"date-parts":[[2024,5,8]]},"assertion":[{"value":"13 September 2023","order":1,"name":"received","label":"Received","group":{"name":"ArticleHistory","label":"Article History"}},{"value":"27 March 2024","order":2,"name":"accepted","label":"Accepted","group":{"name":"ArticleHistory","label":"Article History"}},{"value":"8 May 2024","order":3,"name":"first_online","label":"First @@ -334,11 +334,11 @@ interactions: Content-Encoding: - gzip Content-Length: - - "10574" + - "10575" Content-Type: - application/json Date: - - Wed, 04 Sep 2024 22:54:22 GMT + - Mon, 16 Sep 2024 14:27:33 GMT Server: - Jetty(9.4.40.v20210413) Vary: @@ -366,7 +366,7 @@ interactions: response: body: string: - '{"elapsed_seconds":0.298,"results":[{"response":{"best_oa_location":{"endpoint_id":null,"evidence":"open + '{"elapsed_seconds":0.315,"results":[{"response":{"best_oa_location":{"endpoint_id":null,"evidence":"open (via crossref license)","host_type":"publisher","is_best":true,"license":"cc-by","oa_date":"2024-05-08","pmh_id":null,"repository_institution":null,"updated":"2024-07-28T13:13:26.235272","url":"https://www.nature.com/articles/s42256-024-00832-8.pdf","url_for_landing_page":"https://doi.org/10.1038/s42256-024-00832-8","url_for_pdf":"https://www.nature.com/articles/s42256-024-00832-8.pdf","version":"publishedVersion"},"data_standard":2,"doi":"10.1038/s42256-024-00832-8","doi_url":"https://doi.org/10.1038/s42256-024-00832-8","first_oa_location":{"endpoint_id":null,"evidence":"open (via crossref license)","host_type":"publisher","is_best":true,"license":"cc-by","oa_date":"2024-05-08","pmh_id":null,"repository_institution":null,"updated":"2024-07-28T13:13:26.235272","url":"https://www.nature.com/articles/s42256-024-00832-8.pdf","url_for_landing_page":"https://doi.org/10.1038/s42256-024-00832-8","url_for_pdf":"https://www.nature.com/articles/s42256-024-00832-8.pdf","version":"publishedVersion"},"genre":"journal-article","has_repository_copy":true,"is_oa":true,"is_paratext":false,"journal_is_in_doaj":false,"journal_is_oa":false,"journal_issn_l":"2522-5839","journal_issns":"2522-5839","journal_name":"Nature Machine Intelligence","oa_locations":[{"endpoint_id":null,"evidence":"open @@ -1936,17 +1936,17 @@ interactions: Content-Encoding: - gzip Content-Length: - - "39585" + - "39584" Content-Type: - application/json Date: - - Wed, 04 Sep 2024 22:54:22 GMT + - Mon, 16 Sep 2024 14:27:33 GMT Nel: - '{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}' Report-To: - - '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1725490461&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=j0vwwBQJBKSjl7xJkMYB4ksAyr6H3jKPUYltKx2FaWA%3D"}]}' + - '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1726496853&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=sp2SR2LAkKeYFx5X3Aha4VFoyxSXyXrEe1am8ilyHDk%3D"}]}' Reporting-Endpoints: - - heroku-nel=https://nel.heroku.com/reports?ts=1725490461&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=j0vwwBQJBKSjl7xJkMYB4ksAyr6H3jKPUYltKx2FaWA%3D + - heroku-nel=https://nel.heroku.com/reports?ts=1726496853&sid=c46efe9b-d3d2-4a0c-8c76-bfafa16c5add&s=sp2SR2LAkKeYFx5X3Aha4VFoyxSXyXrEe1am8ilyHDk%3D Server: - gunicorn Vary: @@ -1969,7 +1969,7 @@ interactions: "11116106", "DOI": "10.1038/s42256-024-00832-8", "CorpusId": 258059792, "PubMed": "38799228"}, "url": "https://www.semanticscholar.org/paper/354dcdebf3f8b5feeed5c62090e0bc1f0c28db06", "title": "Augmenting large language models with chemistry tools", "venue": - "Nat. Mac. Intell.", "year": 2023, "citationCount": 191, "influentialCitationCount": + "Nat. Mac. Intell.", "year": 2023, "citationCount": 196, "influentialCitationCount": 12, "isOpenAccess": true, "openAccessPdf": {"url": "https://www.nature.com/articles/s42256-024-00832-8.pdf", "status": "HYBRID"}, "publicationTypes": ["JournalArticle"], "publicationDate": "2023-04-11", "journal": {"name": "Nature Machine Intelligence", "pages": @@ -1982,7 +1982,7 @@ interactions: M Bran"}, {"authorId": "2161337138", "name": "Sam Cox"}, {"authorId": "1820929773", "name": "Oliver Schilter"}, {"authorId": "2251414370", "name": "Carlo Baldassari"}, {"authorId": "2150199535", "name": "Andrew D. White"}, {"authorId": "1379965853", - "name": "P. Schwaller"}], "matchScore": 179.3787}]} + "name": "P. Schwaller"}], "matchScore": 177.60979}]} ' headers: @@ -1991,31 +1991,31 @@ interactions: Connection: - keep-alive Content-Length: - - "1550" + - "1551" Content-Type: - application/json Date: - - Wed, 04 Sep 2024 22:54:22 GMT + - Mon, 16 Sep 2024 14:27:33 GMT Via: - - 1.1 62c71b579b931f194fbc7abcc843d132.cloudfront.net (CloudFront) + - 1.1 0f4013a0af68dcba176ca4372e470df4.cloudfront.net (CloudFront) X-Amz-Cf-Id: - - VwbnXhY_A5M45lRneO76qNYDmL4RnBGAb0pjfkEcjJruMewyZUvaQQ== + - dd4-81xSX7SU7omkJU1Mlys_dal7O5oWEAfaDWM3J1pAk_F4JBFIbg== X-Amz-Cf-Pop: - SFO53-C1 X-Cache: - Miss from cloudfront x-amz-apigw-id: - - dmi8sEt4vHcEvHw= + - eM79WGChvHcElGQ= x-amzn-Remapped-Connection: - keep-alive x-amzn-Remapped-Content-Length: - - "1550" + - "1551" x-amzn-Remapped-Date: - - Wed, 04 Sep 2024 22:54:22 GMT + - Mon, 16 Sep 2024 14:27:33 GMT x-amzn-Remapped-Server: - gunicorn x-amzn-RequestId: - - 797ca22d-1ce8-48ae-b214-3271d15e4a9e + - 9c34751f-334f-48b1-a2ed-ceb7953d2e78 status: code: 200 message: OK @@ -2045,7 +2045,7 @@ interactions: Connection: - close Date: - - Wed, 04 Sep 2024 22:54:22 GMT + - Mon, 16 Sep 2024 14:27:36 GMT Server: - Jetty(9.4.40.v20210413) Transfer-Encoding: diff --git a/tests/test_clients.py b/tests/test_clients.py index 96ec0d96..282b27cd 100644 --- a/tests/test_clients.py +++ b/tests/test_clients.py @@ -67,7 +67,7 @@ " Samuel G. Rodriques, and Andrew D. White. Paperqa:" " retrieval-augmented generative agent for scientific research. ArXiv," " Dec 2023. URL: https://doi.org/10.48550/arxiv.2312.07559," - " doi:10.48550/arxiv.2312.07559. This article has 23 citations." + " doi:10.48550/arxiv.2312.07559. This article has 25 citations." ), "is_oa": None, }, @@ -91,7 +91,7 @@ " White, and Philippe Schwaller. Augmenting large language models with" " chemistry tools. Nature Machine Intelligence, 6:525-535, May 2024." " URL: https://doi.org/10.1038/s42256-024-00832-8," - " doi:10.1038/s42256-024-00832-8. This article has 191 citations and is" + " doi:10.1038/s42256-024-00832-8. This article has 196 citations and is" " from a domain leading peer-reviewed journal." ), "is_oa": True,