Skip to content
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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

kumarpanzade
Copy link
Contributor

closes #1

base project setup with api endpoints
GET /loaddata loads data from local drive into vectorDB
POST /generate generates response with the query

@kumarpanzade kumarpanzade requested a review from sourabh-josh July 4, 2024 13:17
@kumarpanzade kumarpanzade self-assigned this Jul 4, 2024
app = Flask(__name__)

# Load data endpoint
@app.route('/loaddata', methods=['GET'])

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():

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:

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:

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.")

Copy link

@sourabh-josh sourabh-josh left a 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

@sourabh-josh sourabh-josh changed the base branch from master to dev July 8, 2024 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting up Flask and basic project setup
2 participants