Skip to content

Commit

Permalink
Fix examples in README (#379)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
taabishm2 and pre-commit-ci-lite[bot] authored Sep 12, 2024
1 parent 3597759 commit 30cb026
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ doc_paths = ("myfile.pdf", "myotherfile.pdf")
docs = Docs()

for doc in doc_paths:
doc.add(doc_paths)
docs.add(doc)

settings = Settings()
settings.llm = "claude-3-5-sonnet-20240620"
Expand All @@ -277,24 +277,30 @@ PaperQA2 is written to be used asynchronously. The synchronous API is just a wra
| `Docs.get_evidence` | `Docs.aget_evidence` |
| `Docs.query` | `Docs.aquery` |

The synchronous version just call the async version in a loop. Most modern python environments support async natively (including Jupyter notebooks!). So you can do this in a Jupyter Notebook:
The synchronous version just calls the async version in a loop. Most modern python environments support async natively (including Jupyter notebooks!). So you can do this in a Jupyter Notebook:

```python
import asyncio
from paperqa import Docs

# valid extensions include .pdf, .txt, and .html
doc_paths = ("myfile.pdf", "myotherfile.pdf")

docs = Docs()
async def main():
# valid extensions include .pdf, .txt, and .html
doc_paths = ("myfile.pdf", "myotherfile.pdf")

for doc in doc_paths:
await doc.aadd(doc_paths)
docs = Docs()

answer = await docs.aquery(
"What manufacturing challenges are unique to bispecific antibodies?"
)
for doc in doc_paths:
await docs.aadd(doc)

print(answer.formatted_answer)
answer = await docs.aquery(
"What manufacturing challenges are unique to bispecific antibodies?"
)

print(answer.formatted_answer)


asyncio.run(main())
```

### Choosing Model
Expand Down Expand Up @@ -613,7 +619,7 @@ are executed after the query and before the query. For example, you can use this

### How come I get different results than your papers?

Internally at FutureHouse, we have a slightly different set of tools. We're trying to get some of them, like citation traversral, into this repo. However, we have APIs and licenses to access research papers that we cannot share openly. Similarly, in our research papers' results we do not start with the known relevant PDFs. Our agent has to identify them using keyword search over all papers, rather than just a subset. We're gradually aligning these two versions of PaperQA, but until there is an open-source way to freely access papers (even just open source papers) you will need to provide PDFs yourself.
Internally at FutureHouse, we have a slightly different set of tools. We're trying to get some of them, like citation traversal, into this repo. However, we have APIs and licenses to access research papers that we cannot share openly. Similarly, in our research papers' results we do not start with the known relevant PDFs. Our agent has to identify them using keyword search over all papers, rather than just a subset. We're gradually aligning these two versions of PaperQA, but until there is an open-source way to freely access papers (even just open source papers) you will need to provide PDFs yourself.

### How is this different from LlamaIndex?

Expand Down

0 comments on commit 30cb026

Please sign in to comment.