Skip to content

Commit 5ad32a7

Browse files
Merge pull request #99 from neo4j-labs/DEV
Dev
2 parents 0996df9 + b192543 commit 5ad32a7

38 files changed

+2399
-1010
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ KNN_MIN_SCORE = ""\
114114
https://github.com/neo4j-labs/llm-graph-builder/assets/121786590/b725a503-6ade-46d2-9e70-61d57443c311
115115
116116
## Links
117-
The Public [ Google cloud Run URL](https://frontend-dcavk67s4a-uc.a.run.app).
117+
The Public [ Google cloud Run URL](https://prod-frontend-dcavk67s4a-uc.a.run.app).
118118
[Workspace URL](https://workspace-preview.neo4j.io/workspace)
119119
120120

backend/requirements.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,12 @@ jsonpointer==2.4
6161
jupyter_client==8.6.0
6262
jupyter_core==5.5.0
6363
kiwisolver==1.4.5
64-
langchain==0.1.1
65-
langchain-community==0.0.20
66-
langchain-core==0.1.23
67-
langchain-experimental==0.0.49
68-
langchain-openai==0.0.2.post1
64+
langchain==0.1.11
65+
langchain-community==0.0.27
66+
langchain-core==0.1.30
67+
langchain-experimental==0.0.53
68+
langchain-openai==0.0.8
6969
langdetect==1.0.9
70-
langsmith==0.0.87
7170
layoutparser==0.3.4
7271
lxml==5.1.0
7372
MarkupSafe==2.1.5
@@ -97,7 +96,7 @@ nvidia-nvtx-cu12==12.1.105
9796
omegaconf==2.3.0
9897
onnx==1.15.0
9998
onnxruntime==1.15.1
100-
openai==1.7.1
99+
openai
101100
opencv-python==4.9.0.80
102101
opencv-python-headless==4.9.0.80
103102
packaging==23.2
@@ -181,4 +180,4 @@ poppler-utils
181180
pytesseract
182181
pdf2image
183182
youtube-transcript-api
184-
pytube
183+
pytube

backend/score.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from fastapi.middleware.cors import CORSMiddleware
66
from src.main import *
77
import asyncio
8+
import base64
89

910

1011
def healthy_condition():
@@ -30,7 +31,7 @@ def sick():
3031

3132
@app.post("/sources")
3233
async def create_source_knowledge_graph(
33-
uri=Form(), database=Form(), userName=Form(), password=Form(), file: UploadFile = File(...), model=Form()
34+
uri=Form(None), userName=Form(None), password=Form(None), file: UploadFile = File(...), model=Form(),database=Form(None),
3435
):
3536
"""
3637
Calls 'create_source_node_graph' function in a new thread to create
@@ -46,36 +47,36 @@ async def create_source_knowledge_graph(
4647
'Source' Node creation in Neo4j database
4748
"""
4849
result = await asyncio.to_thread(
49-
create_source_node_graph_local_file, uri, database, userName, password, file, model
50+
create_source_node_graph_local_file, uri, userName, password, file, model, database
5051
)
5152
return result
5253

5354
@app.post("/url/scan")
5455
async def create_source_knowledge_graph_url(
55-
uri=Form(),
56-
database=Form(),
57-
userName=Form(),
58-
password=Form(),
56+
uri=Form(None),
57+
userName=Form(None),
58+
password=Form(None),
5959
source_url=Form(),
60+
database=Form(None),
6061
aws_access_key_id=Form(None),
6162
aws_secret_access_key=Form(None),
6263
max_limit=Form(5),
6364
query_source=Form(None),
6465
model=Form(None)
6566
):
6667
return create_source_node_graph_url(
67-
uri, database, userName, password, source_url, max_limit, query_source, model, aws_access_key_id, aws_secret_access_key
68+
uri, userName, password, source_url, model, database, aws_access_key_id, aws_secret_access_key
6869
)
6970

7071

7172
@app.post("/extract")
7273
async def extract_knowledge_graph_from_file(
73-
uri=Form(),
74-
database=Form(),
75-
userName=Form(),
76-
password=Form(),
74+
uri=Form(None),
75+
userName=Form(None),
76+
password=Form(None),
77+
model=Form(None),
78+
database=Form(None),
7779
file: UploadFile = File(None),
78-
model=Form(),
7980
source_url=Form(None),
8081
aws_access_key_id=Form(None),
8182
aws_secret_access_key=Form(None),
@@ -101,10 +102,10 @@ async def extract_knowledge_graph_from_file(
101102
return await asyncio.to_thread(
102103
extract_graph_from_file,
103104
uri,
104-
database,
105105
userName,
106106
password,
107107
model,
108+
database,
108109
file=file,
109110
source_url=None,
110111
wiki_query=wiki_query,
@@ -114,10 +115,10 @@ async def extract_knowledge_graph_from_file(
114115
return await asyncio.to_thread(
115116
extract_graph_from_file,
116117
uri,
117-
database,
118118
userName,
119119
password,
120120
model,
121+
database,
121122
source_url=source_url,
122123
aws_access_key_id=aws_access_key_id,
123124
aws_secret_access_key=aws_secret_access_key,
@@ -129,11 +130,17 @@ async def extract_knowledge_graph_from_file(
129130

130131

131132
@app.get("/sources_list")
132-
async def get_source_list(uri=Form(),database=Form(),userName=Form(),password=Form()):
133+
async def get_source_list(uri:str,
134+
userName:str,
135+
password:str,
136+
database:str=None):
133137
"""
134138
Calls 'get_source_list_from_graph' which returns list of sources which alreday exist in databse
135139
"""
136-
result = await asyncio.to_thread(get_source_list_from_graph,uri,database,userName,password)
140+
decoded_password = decode_password(password)
141+
if " " in uri:
142+
uri= uri.replace(" ","+")
143+
result = await asyncio.to_thread(get_source_list_from_graph,uri,userName,decoded_password,database)
137144
return result
138145

139146
@app.post("/update_similarity_graph")
@@ -144,6 +151,11 @@ async def update_similarity_graph():
144151

145152
result = await asyncio.to_thread(update_graph)
146153
return result
154+
155+
def decode_password(pwd):
156+
sample_string_bytes = base64.b64decode(pwd)
157+
decoded_password = sample_string_bytes.decode("utf-8")
158+
return decoded_password
147159

148160
if __name__ == "__main__":
149161
uvicorn.run(app)

0 commit comments

Comments
 (0)