Forum in maintenance, we will back soon 🙂
Course: Build With AI - What does ChatGPT give you?
I'm very curious about the results ChatGPT is giving you with your prompt. So please respond to my query with
- Please respond using the code icon (<>) above using one for your prompt and another for the ChatGPT code.
- The prompt you gave to ChatGPT
- The results ChatGPT gave you.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
write the code of a flask Python API, it uses Google autosuggestions to generate keyword ideas and suggestions
from flask import Flask, request, jsonify from googlesearch import search app = Flask(__name__) @app.route('/suggestions', methods=['GET']) def get_suggestions(): query = request.args.get('query') if not query: return jsonify({'error': 'Query parameter is required'}), 400 suggestions = [] try: # Use Google search to get auto-suggestions for suggestion in search(query, num=5, stop=5, pause=2): suggestions.append(suggestion) return jsonify({'suggestions': suggestions}) except Exception as e: return jsonify({'error': 'Failed to fetch suggestions'}), 500 if __name__ == '__main__': app.run(debug=True)
Note the parameters for the search() function given by ChatGPT is incorrect and I had to modify it by removing the num, stop and pause arguments.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
You know, chatbot will not always generate the same code. And my prompt was not that perfect. I just used a very basic prompt.
I tested at worked from the first time, maybe it was luck 🙂
@admin definitely it was luck or maybe your previous use of ChatGPT where it's remembering you and your preferred answer based on your environment.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack