Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Inject kg context even if kg query result is empty #198

Merged
merged 19 commits into from
Aug 20, 2024
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c216408
Merge pull request #31 from fengsh27/wip/fengsh/merge_upstream_main_0802
fengsh27 Aug 2, 2024
f3f8a36
fix some bugs in reflexion agent
Aug 2, 2024
543a96c
Merge pull request #32 from fengsh27/wip/fengsh/fix_bug_in_reflextion…
fengsh27 Aug 2, 2024
2cbbe98
Merge remote-tracking branch 'upstream/main' into wip/fengsh/merge_up…
Aug 6, 2024
a3c6f92
fix an vectorstore issue
Aug 6, 2024
be01ca6
Merge pull request #33 from fengsh27/wip/fengsh/fix-vectorstore-agent…
fengsh27 Aug 6, 2024
7e0aa65
Merge remote-tracking branch 'upstream/main' into wip/fengsh/merge-up…
Aug 14, 2024
d50a245
Merge pull request #34 from fengsh27/wip/fengsh/merge-upstream-0814
fengsh27 Aug 14, 2024
3fbbb88
introduce use_reflexion to kg RagAgent
Aug 16, 2024
35d69a9
prompt LLM not to generate cypher marker
Aug 16, 2024
e0caf2b
fix test error
Aug 17, 2024
54efb78
change vectorstore collection names to apply previous fix of collecti…
Aug 17, 2024
2b5575a
Merge remote-tracking branch 'upstream/main' into wip/fengsh/merge-up…
Aug 17, 2024
f559518
phrasing, formatting, parameter explanations
slobentanzer Aug 17, 2024
5cc3576
fix type hinting
slobentanzer Aug 17, 2024
574b092
Merge remote-tracking branch 'upstream/main' into wip/fengsh/merge_up…
Aug 20, 2024
aac1636
Merge branch 'main' of https://github.com/fengsh27/biochatter into wi…
Aug 20, 2024
03dd65a
Merge pull request #35 from fengsh27/wip/fengsh/merge_upstream_0820
fengsh27 Aug 20, 2024
802ac8a
prompt LLM even if kg query result is empty
Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions biochatter/database_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ def get_query_results(self, query: str, k: int = 3) -> list[Document]:
# than k
if results is None or len(results) == 0 or results[0] is None:
return []
if len(results[0]) == 0:
return [
Document(
page_content = (
"I didn't find any result in knowledge graph, "
f"but here is the query I used: {cypher_query}. "
"You can ask user to refine the question, "
"but don't make up anything."
),
metadata={
"cypher_query": cypher_query,
},
)
]

for result in results[0]:
documents.append(
Document(
Expand Down
Loading