Skip to content

Commit a9d2a8f

Browse files
authored
Merge branch 'main' of https://github.com/neo4j-labs/llm-graph-builder into STAGING
2 parents e3b527d + 2aae8f9 commit a9d2a8f

File tree

10 files changed

+76
-4
lines changed

10 files changed

+76
-4
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ If you are using Neo4j Desktop, you will not be able to use the docker-compose b
3131
### Local deployment
3232
#### Running through docker-compose
3333
By default only OpenAI and Diffbot are enabled since Gemini requires extra GCP configurations.
34+
Accoroding to enviornment we are configuring the models which is indicated by VITE_LLM_MODELS_PROD variable we can configure model based on our need.
35+
EX:
36+
```env
37+
VITE_LLM_MODELS_PROD="openai_gpt_4o,openai_gpt_4o_mini,diffbot,gemini_1.5_flash"
38+
```
3439
According to the environment, we are configuring the models which indicated by VITE_LLM_MODELS_PROD variable we can configure models based on our needs.
3540
EX:
3641
```env
@@ -40,12 +45,14 @@ VITE_LLM_MODELS_PROD="openai_gpt_4o,openai_gpt_4o_mini,diffbot,gemini_1.5_flash"
4045
if you only want OpenAI:
4146
```env
4247
VITE_LLM_MODELS_PROD="diffbot,openai-gpt-3.5,openai-gpt-4o"
48+
VITE_LLM_MODELS_PROD="diffbot,openai-gpt-3.5,openai-gpt-4o"
4349
OPENAI_API_KEY="your-openai-key"
4450
```
4551

4652
if you only want Diffbot:
4753
```env
4854
VITE_LLM_MODELS_PROD="diffbot"
55+
VITE_LLM_MODELS_PROD="diffbot"
4956
DIFFBOT_API_KEY="your-diffbot-key"
5057
```
5158

@@ -71,6 +78,7 @@ You can of course combine all (local, youtube, wikipedia, s3 and gcs) or remove
7178

7279
### Chat Modes
7380

81+
By default,all of the chat modes will be available: vector, graph_vector, graph, fulltext, graph_vector_fulltext , entity_vector and global_vector.
7482
By default,all of the chat modes will be available: vector, graph_vector, graph, fulltext, graph_vector_fulltext , entity_vector and global_vector.
7583
If none of the mode is mentioned in the chat modes variable all modes will be available:
7684
```env
@@ -80,6 +88,7 @@ VITE_CHAT_MODES=""
8088
If however you want to specify the only vector mode or only graph mode you can do that by specifying the mode in the env:
8189
```env
8290
VITE_CHAT_MODES="vector,graph"
91+
VITE_CHAT_MODES="vector,graph"
8392
```
8493

8594
#### Running Backend and Frontend separately (dev environment)
@@ -114,7 +123,7 @@ Alternatively, you can run the backend and frontend separately:
114123
To deploy the app and packages on Google Cloud Platform, run the following command on google cloud run:
115124
```bash
116125
# Frontend deploy
117-
gcloud run deploy
126+
gcloud run deploy dev-frontend --set-env-vars "VITE_BACKEND_API_URL=" --set-env-vars "VITE_FRONTEND_HOSTNAME=hostname.us-central1.run.app" --set-env-vars "VITE_SEGMENT_API_URL=https://cdn.segment.com/v1/projects/4SGwdwzuDm5WkFvQtz7D6ATQlo14yjmW/settings"
118127
source location current directory > Frontend
119128
region : 32 [us-central 1]
120129
Allow unauthenticated request : Yes

backend/score.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
from src.ragas_eval import *
3737
from starlette.types import ASGIApp, Message, Receive, Scope, Send
3838
import gzip
39+
<<<<<<< HEAD
3940
from langchain_neo4j import Neo4jGraph
41+
=======
42+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
4043

4144
logger = CustomLogger()
4245
CHUNK_DIR = os.path.join(os.path.dirname(__file__), "chunks")
@@ -82,9 +85,16 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send):
8285
await gzip_middleware(scope, receive, send)
8386
app = FastAPI()
8487
# SecWeb(app=app, Option={'referrer': False, 'xframe': False})
88+
<<<<<<< HEAD
8589
# app.add_middleware(ContentSecurityPolicy, Option={'default-src': ["'self'"], 'base-uri': ["'self'"], 'block-all-mixed-content': []}, script_nonce=False, style_nonce=False, report_only=False)
8690
app.add_middleware(XContentTypeOptions)
8791
app.add_middleware(XFrame, Option={'X-Frame-Options': 'DENY'})
92+
=======
93+
app.add_middleware(ContentSecurityPolicy, Option={'default-src': ["'self'"], 'base-uri': ["'self'"], 'block-all-mixed-content': []}, script_nonce=False, style_nonce=False, report_only=False)
94+
app.add_middleware(XContentTypeOptions)
95+
app.add_middleware(XFrame, Option={'X-Frame-Options': 'DENY'})
96+
#app.add_middleware(GZipMiddleware, minimum_size=1000, compresslevel=5)
97+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
8898
app.add_middleware(CustomGZipMiddleware, minimum_size=1000, compresslevel=5,paths=["/sources_list","/url/scan","/extract","/chat_bot","/chunk_entities","/get_neighbours","/graph_query","/schema","/populate_graph_schema","/get_unconnected_nodes_list","/get_duplicate_nodes","/fetch_chunktext"])
8999
app.add_middleware(
90100
CORSMiddleware,
@@ -829,11 +839,15 @@ async def retry_processing(uri=Form(), userName=Form(), password=Form(), databas
829839
start = time.time()
830840
graph = create_graph_database_connection(uri, userName, password, database)
831841
await asyncio.to_thread(set_status_retry, graph,file_name,retry_condition)
842+
<<<<<<< HEAD
832843
end = time.time()
833844
elapsed_time = end - start
834845
json_obj = {'api_name':'retry_processing', 'db_url':uri, 'userName':userName, 'database':database, 'file_name':file_name,'retry_condition':retry_condition,
835846
'logging_time': formatted_time(datetime.now(timezone.utc)), 'elapsed_api_time':f'{elapsed_time:.2f}'}
836847
logger.log_struct(json_obj, "INFO")
848+
=======
849+
#set_status_retry(graph,file_name,retry_condition)
850+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
837851
return create_api_response('Success',message=f"Status set to Ready to Reprocess for filename : {file_name}")
838852
except Exception as e:
839853
job_status = "Failed"
@@ -949,8 +963,11 @@ async def fetch_chunktext(
949963
json_obj = {
950964
'api_name': 'fetch_chunktext',
951965
'db_url': uri,
966+
<<<<<<< HEAD
952967
'userName': userName,
953968
'database': database,
969+
=======
970+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
954971
'document_name': document_name,
955972
'page_no': page_no,
956973
'logging_time': formatted_time(datetime.now(timezone.utc)),
@@ -968,6 +985,7 @@ async def fetch_chunktext(
968985
gc.collect()
969986

970987

988+
<<<<<<< HEAD
971989
@app.post("/backend_connection_configuation")
972990
async def backend_connection_configuation():
973991
try:
@@ -997,5 +1015,7 @@ async def backend_connection_configuation():
9971015
finally:
9981016
gc.collect()
9991017

1018+
=======
1019+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
10001020
if __name__ == "__main__":
10011021
uvicorn.run(app)

backend/src/graphDB_dataAccess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def get_duplicate_nodes_list(self):
362362
score_value = float(os.environ.get('DUPLICATE_SCORE_VALUE'))
363363
text_distance = int(os.environ.get('DUPLICATE_TEXT_DISTANCE'))
364364
query_duplicate_nodes = """
365-
MATCH (n:!Chunk&!Session&!Document&!`__Community__`) with n
365+
MATCH (n:!Chunk&!Session&!Document&!`__Community__`&!`__Entity__`) with n
366366
WHERE n.embedding is not null and n.id is not null // and size(toString(n.id)) > 3
367367
WITH n ORDER BY count {{ (n)--() }} DESC, size(toString(n.id)) DESC // updated
368368
WITH collect(n) as nodes

frontend/src/App.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,4 +408,4 @@
408408
z-index: 111;
409409
opacity: 0.8;
410410
background-color: rgb(201 201 201 / 40%);
411-
}
411+
}

frontend/src/components/ChatBot/Chatbot.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ const Chatbot: FC<ChatbotProps> = (props) => {
445445
status={connectionStatus ? 'online' : 'offline'}
446446
shape='square'
447447
type='image'
448+
shape='square'
448449
/>
449450
) : (
450451
<Avatar
@@ -455,6 +456,7 @@ const Chatbot: FC<ChatbotProps> = (props) => {
455456
status={connectionStatus ? 'online' : 'offline'}
456457
shape='square'
457458
type='image'
459+
shape='square'
458460
/>
459461
)}
460462
</div>

frontend/src/components/Content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ const Content: React.FC<ContentProps> = ({
208208
}
209209
toggleChunksLoading();
210210
};
211-
211+
212212
const extractData = async (uid: string, isselectedRows = false, filesTobeProcess: CustomFile[]) => {
213213
if (!isselectedRows) {
214214
const fileItem = filesData.find((f) => f.id == uid);

frontend/src/components/Graph/GraphViewModal.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,15 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
349349
'aria-labelledby': 'form-dialog-title',
350350
}}
351351
>
352+
<<<<<<< HEAD
352353
<Dialog.Header htmlAttributes={{ id: 'graph-title' }}>
354+
=======
355+
<Dialog.Header
356+
htmlAttributes={{
357+
id: 'graph-title',
358+
}}
359+
>
360+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
353361
{headerTitle}
354362
{viewPoint !== graphLabels.chatInfoView && (
355363
<div style={{ display: 'flex', alignItems: 'center' }}>
@@ -403,7 +411,11 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
403411
}}
404412
nvlCallbacks={nvlCallbacks}
405413
/>
414+
<<<<<<< HEAD
406415
<IconButtonArray orientation='vertical' isFloating={true} className='absolute bottom-4 right-4'>
416+
=======
417+
<IconButtonArray orientation='vertical' isFloating className='absolute bottom-4 right-4'>
418+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
407419
{viewPoint !== 'chatInfoView' && (
408420
<IconButtonWithToolTip
409421
label='Refresh'

frontend/src/components/Graph/ResultOverview.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ const ResultOverview: React.FunctionComponent<OverViewProps> = ({
114114
<Typography variant='h3'>{graphLabels.resultOverview}</Typography>
115115
<div className={`text-input-container`}>
116116
<TextInput
117+
<<<<<<< HEAD
117118
htmlAttributes={{
118119
type: 'text',
119120
'aria-label': 'search nodes',
120121
placeholder: 'Search On Node Properties',
121122
}}
123+
=======
124+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
122125
value={searchQuery}
123126
onChange={(e) => {
124127
setSearchQuery(e.target.value);
@@ -127,14 +130,27 @@ const ResultOverview: React.FunctionComponent<OverViewProps> = ({
127130
leftElement={
128131
<IconButton
129132
ariaLabel='Search Icon'
133+
<<<<<<< HEAD
130134
isClean={true}
135+
=======
136+
isClean
137+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
131138
size='small'
132139
className='-mt-0.5'
133140
htmlAttributes={{ type: 'submit' }}
134141
>
142+
<<<<<<< HEAD
135143
<MagnifyingGlassIconOutline className='n-size-token-7' />
144+
=======
145+
<MagnifyingGlassIconOutline />
146+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
136147
</IconButton>
137148
}
149+
htmlAttributes={{
150+
type: 'text',
151+
'aria-label': 'search nodes',
152+
placeholder: 'Search On Node Properties',
153+
}}
138154
/>
139155
</div>
140156
<Typography variant='subheading-small'>

frontend/src/components/UI/ErrroBoundary.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ export default class ErrorBoundary extends React.Component<any, any> {
1919
return (
2020
<div className='n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-bg-palette-neutral-bg-weak n-box-border'>
2121
<Banner
22+
<<<<<<< HEAD
2223
hasIcon={true}
24+
=======
25+
hasIcon
26+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
2327
type='info'
2428
description={
2529
this.state.errorMessage === 'Missing required parameter client_id.'
@@ -49,7 +53,11 @@ export default class ErrorBoundary extends React.Component<any, any> {
4953
},
5054
]
5155
}
56+
<<<<<<< HEAD
5257
usage='inline'
58+
=======
59+
usage='global'
60+
>>>>>>> 6a46472dcebfb9282c1c9d7332bcfacb30811661
5361
></Banner>
5462
</div>
5563
);

frontend/src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,11 @@ export interface GraphContextType {
773773
setLoadingGraph: Dispatch<SetStateAction<boolean>>;
774774
}
775775

776+
export interface GraphContextType {
777+
loadingGraph: boolean;
778+
setLoadingGraph: Dispatch<SetStateAction<boolean>>;
779+
}
780+
776781
export interface DatabaseStatusProps {
777782
isConnected: boolean;
778783
isGdsActive: boolean;

0 commit comments

Comments
 (0)