-
Notifications
You must be signed in to change notification settings - Fork 23
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
1 parent
e7278f6
commit f6253c6
Showing
4 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,85 @@ | ||
# Vignette: Knowledge Graph RAG | ||
|
||
This vignette demonstrates the KG module of BioChatter as used by the | ||
BioChatter Next application. We connect to a BioCypher knowledge graph (KG) to | ||
retrieve relevant information for a given question. We then use the retrieved | ||
information to generate a response to the question. The application can connect | ||
to any real-world BioCypher KG by providing the connection details in the `KG | ||
Settings` dialog. | ||
|
||
## Background | ||
|
||
For the demonstration purposes of this vignette, we include a demo KG based on | ||
an open-source dataset of crime statistics in Manchester, because it allows us | ||
to redistribute the KG due to its small size and public domain licence, and | ||
because it is easily understood. This is the schema of the KG: | ||
|
||
```mermaid | ||
graph LR; | ||
Person(:Person) -- KNOWS --> Person | ||
Person -- FAMILY_REL --> Person | ||
Person -- LIVES_AT --> Location(:Location) | ||
Person -- PARTY_TO --> Crime(:Crime) | ||
Person -- MADE_CALL --> PhoneCall(:PhoneCall) | ||
Person -- RECEIVED_CALL --> PhoneCall | ||
Crime -- INVESTIGATED_BY --> Officer(:Officer) | ||
Crime -- OCCURRED_AT --> Location | ||
Object(:Object) -- INVOLVED_IN --> Crime | ||
``` | ||
|
||
The KG is adapted from a [Neo4j | ||
tutorial](https://github.com/neo4j-graph-examples/pole), and is available as a | ||
BioCypher adapter including a BioChatter Light integration | ||
[here](https://github.com/biocypher/pole). We also include it in an optional | ||
BioChatter Next Docker Compose | ||
[configuration](https://github.com/biocypher/biochatter-next/blob/main/biochatter-next/docker-compose-incl-kg.yml) | ||
to allow trying it out locally. | ||
|
||
## Usage | ||
|
||
In BioChatter Next, we first activate the KG functionality by clicking on the | ||
`KG Settings` button in the sidebar. In the settings dialog, we can activate the | ||
KG functionality and select how many results we want to retrieve. Returning to | ||
the conversation and enabling the KG functionality for the current chat | ||
(directly above the send button), we can then ask the model about the KG. The | ||
conversation is pasted below for convenience. | ||
|
||
![KG Demo](kg-demo.gif) | ||
|
||
In the background, the RagAgent module of BioChatter receives the question and | ||
generates a query to retrieve the desired information. This is then passed back | ||
to the primary model, which includes it in its answer generation. | ||
|
||
## Conclusion | ||
|
||
The native integration of BioCypher KGs into the BioChatter framework allows for | ||
a seamless integration of KGs into the conversational AI. This in turn | ||
facilitates knowledge accessibility in a wide range of application domains. | ||
|
||
## Conversation | ||
|
||
### Message From You | ||
How many crimes happened in total? | ||
|
||
### Message From ChatGPT | ||
According to the provided statement, the total number of crimes is 28,762. This information suggests that there have been 28,762 reported crimes in the given context. However, without additional information or context, it is difficult to determine the specific time period, location, or nature of these crimes. It's important to note that crime statistics can vary depending on the source, methodology, and reporting practices. Therefore, it is always advisable to consult official crime reports or local law enforcement agencies for the most accurate and up-to-date information on crime statistics. | ||
|
||
### Message From You | ||
Where happened most crimes? | ||
|
||
### Message From ChatGPT | ||
Based on the provided statement, it appears that the location with the highest number of crimes is a parking area, with a total of 811 reported crimes. However, without additional context or information, it is difficult to determine the consistency or inconsistency of this statement with other available information. It is important to note that crime rates and locations can vary significantly depending on various factors such as the region, city, neighborhood, and specific time period being considered. To provide a more comprehensive analysis, it would be helpful to have access to a broader dataset or additional information about the specific location and its crime statistics. | ||
|
||
### Message From You | ||
Who were the top 3 offenders? | ||
|
||
### Message From ChatGPT | ||
Based on the provided information, the top three offenders are: | ||
|
||
1. Phillip Williamson: According to the information given, Phillip Williamson has committed 5 crimes. | ||
|
||
2. Jessica Kelly: The information states that Jessica Kelly has also committed 5 crimes. | ||
|
||
3. Brian Morales: The data indicates that Brian Morales has committed 4 crimes. | ||
|
||
These three individuals, Phillip Williamson, Jessica Kelly, and Brian Morales, are the top offenders based on the number of crimes they have committed. |
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