File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ def search(self, query: str) -> SearchOutput:
7272
7373 Args:
7474 query (str) : A natural language query of either:
75- - comma-delimited keywords, example: "polyhedra, orthorhombic, superconductor"
75+ - comma-delimited keywords, example: "polyhedra,orthorhombic,superconductor".
76+ This should contain no whitespace; all whitespace will be removed.
7677 - chemical formula, example: "TiO2"
7778 - dash-delimited elements for more general chemical system, example: "Li-P-S"
7879 To query by formula or chemical system, no commas should be present in the query.
@@ -94,11 +95,16 @@ def search(self, query: str) -> SearchOutput:
9495 material_ids = material_ids , fields = ["description" , "material_id" ]
9596 )
9697 else :
97- robo_docs += self .client .materials .robocrys .search (query )
98+ robo_docs += self .client .materials .robocrys .search (
99+ query .replace (" " , "" ).split ("," )
100+ )
98101
99102 return SearchOutput (
100103 results = [
101- FetchResult (id = doc ["material_id" ], text = doc ["description" ])
104+ FetchResult (
105+ id = doc ["material_id" ],
106+ text = doc ["description" ],
107+ )
102108 for doc in robo_docs
103109 ]
104110 )
You can’t perform that action at this time.
0 commit comments