Skip to content
site logo mobile

Forum in maintenance, we will back soon 🙂

Course: Build With ...
 
Notifications
Clear all

Course: Build With AI - What does ChatGPT give you?

4 Posts
2 Users
3 Reactions
323 Views
SSAdvisor
(@ssadvisor)
Posts: 1063
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
Topic starter
 

I'm very curious about the results ChatGPT is giving you with your prompt. So please respond to my query with 

  1. Please respond using the code icon (<>) above using one for your prompt and another for the ChatGPT code.
  2. The prompt you gave to ChatGPT
  3. The results ChatGPT gave you.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 10/15/2023 4:12 pm
SSAdvisor
(@ssadvisor)
Posts: 1063
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
Topic starter
 
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

 
Posted : 10/15/2023 4:16 pm
Hasan Aboul Hasan
(@admin)
Posts: 1103
Member Admin
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
 

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 🙂

 

 

 
Posted : 10/19/2023 7:34 am
SSAdvisor reacted
SSAdvisor
(@ssadvisor)
Posts: 1063
Noble Member
Premium Member
Pythonista Prodigy Badge
Prompt Engineer
API Entrepreneur
Power Member
Topic starter
 

@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

 
Posted : 10/19/2023 4:43 pm
Share: