Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tutorials
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
Eclipse Graphene
tutorials
Commits
2c15c688
Commit
2c15c688
authored
1 month ago
by
Sangamithra Panneer Selvam
Browse files
Options
Downloads
Patches
Plain Diff
modified to accept repeatative questions
parent
e10f1688
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
RAG-pipelines/RAG-Node/app.py
+2
-0
2 additions, 0 deletions
RAG-pipelines/RAG-Node/app.py
RAG-pipelines/RAG-Node/server.py
+8
-6
8 additions, 6 deletions
RAG-pipelines/RAG-Node/server.py
with
10 additions
and
6 deletions
RAG-pipelines/RAG-Node/app.py
+
2
−
0
View file @
2c15c688
...
...
@@ -12,6 +12,7 @@ import json
from
datetime
import
datetime
import
logging
from
queue
import
Queue
import
uuid
app
=
Flask
(
__name__
)
...
...
@@ -136,6 +137,7 @@ def handle_request():
# Append the new question
user_question
.
clear
()
user_question
.
append
(
question
)
user_question
.
append
(
str
(
uuid
.
uuid4
()))
return
jsonify
({
"
response
"
:
"
Question recieved
"
})
...
...
This diff is collapsed.
Click to expand it.
RAG-pipelines/RAG-Node/server.py
+
8
−
6
View file @
2c15c688
...
...
@@ -7,6 +7,7 @@ import rag_pb2
import
rag_pb2_grpc
from
app
import
app_run
,
get_user_question
,
get_user_prompt
import
json
import
os
import
uuid
import
ast
...
...
@@ -27,11 +28,13 @@ class RAGService(rag_pb2_grpc.RAGServiceServicer):
def
__init__
(
self
):
super
().
__init__
()
self
.
responses
=
{}
self
.
current_question
=
None
# Store the last processed question
#self.current_question = None # Store the last processed question
self
.
last_question_id
=
None
def
instruct_llm_query
(
self
,
request
,
context
):
while
True
:
params
=
get_user_question
()
# print("Params:", params)
custom_prompt
=
get_user_prompt
()
# Ensure both prompt and question are checked
...
...
@@ -44,15 +47,14 @@ class RAGService(rag_pb2_grpc.RAGServiceServicer):
continue
self
.
new_question
=
params
[
0
]
if
self
.
new_question
==
self
.
current_question
:
question_id
=
params
[
1
]
if
self
.
last_question_id
==
question_id
:
time
.
sleep
(
0.5
)
continue
continue
self
.
curren
t_question
=
self
.
new_
question
self
.
las
t_question
_id
=
question
_id
print
(
"
Prompt received:
"
,
self
.
system_prompt
)
question_id
=
str
(
uuid
.
uuid4
())
input_text
=
f
"
You asked:
{
self
.
new_question
}
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment