vanna-ai / vanna-flask

Web server for chatting with your database
MIT License
122 stars 57 forks source link

Please set allow_llm_to_see_data=True #23

Closed SahilMudaliar closed 1 month ago

SahilMudaliar commented 1 month ago

The LLM is not allowed to see the data in your database. Your question requires database introspection to generate the necessary SQL. Please set allow_llm_to_see_data=True to enable this.

getting this while using this app can you please tell me how i can allow this because when i am trying this i am getting error

if name == 'main': app.run(host='::', port=8084,debug=False,allow_llm_to_see_data = True)

SahilMudaliar commented 1 month ago

The approach I was using was incorrect i updated this attribute here and it worked fine @app.route('/api/v0/generate_sql', methods=['GET']) def generate_sql(): question = flask.request.args.get('question')

if question is None:
    return jsonify({"type": "error", "error": "No question provided"})

id = cache.generate_id(question=question)
sql = vn.generate_sql(question=question,allow_llm_to_see_data=True)
cache.set(id=id, field='question', value=question)
cache.set(id=id, field='sql', value=sql)

return jsonify(
    {
        "type": "sql", 
        "id": id,
        "text": sql,
    })