-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: added base flask setup #9
base: dev
Are you sure you want to change the base?
Conversation
app = Flask(__name__) | ||
|
||
# Load data endpoint | ||
@app.route('/loaddata', methods=['GET']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use /load-data
as api endpoint here
|
||
# Load data endpoint | ||
@app.route('/loaddata', methods=['GET']) | ||
def loaddata(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make use of snake_case
for function definations
data = request.json | ||
user_query = data.get('query') | ||
|
||
if user_query is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider re-writing this falsy check as
if not user_query:
return jsonify({"error": "Query parameter 'query' is required."}), 400
|
||
def response_generator(user_query,loader): | ||
Settings.llm = Ollama(model="llama3") | ||
if loader.index is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not loader.index:
raise ValueError("Index is not loaded. Call load_data first.")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comments please check
closes #1
base project setup with api endpoints
GET /loaddata
loads data from local drive into vectorDBPOST /generate
generates response with the query