-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
from typing import List | ||
|
||
from docs import Section | ||
|
||
|
||
def parse_abstracts(nodes) -> List[str]: | ||
"""Returns a list of abstract texts from a list of nodes.""" | ||
return [ | ||
node.get_text() | ||
for node in nodes | ||
if node.metadata["section"] == str(Section.ABSTRACT) | ||
] | ||
|
||
|
||
def summarize(texts): | ||
# TODO: | ||
return | ||
|
||
|
||
def get_welcome_message(nodes): | ||
# TODO: | ||
return "Ask me a question about these PDFs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from tests.context import docs | ||
from tests.context import welcome as w | ||
|
||
|
||
def test_parse_abstracts(): | ||
nodes = [ | ||
docs.create_text_node( | ||
text="this is abstract", node_id=1, section=docs.Section.ABSTRACT | ||
), | ||
docs.create_text_node( | ||
text="this is not abstract", node_id=2, section=docs.Section.BODY | ||
), | ||
] | ||
abstracts = w.parse_abstracts(nodes) | ||
assert len(abstracts) == 1 | ||
assert isinstance(abstracts, list) | ||
assert all(isinstance(abstract, str) for abstract in abstracts) |