Skip to content
site logo mobile

Forum in maintenance, we will back soon 🙂

I have complication...
 
Notifications
Clear all

I have complications - Need you assistance ASAP

13 Posts
4 Users
3 Reactions
289 Views
(@starnasrat)
Posts: 9
Active Member
Topic starter
 

I have started with the lesson Build Your 1st API. I have complications with the Build With AI lesson.

build with AI   lesson

 

1. ChatGPT codes generated are not the same as your video tutorial sample/s (attached screenshot: file 3.5 ChatGpt generate code (1)) + file 3.5 ChatGpt copy code (1)(2)(3)(4)

2. Once I copied the code from ChatGPT, I do not get the same end results as your tutorial. Visual Studio screenshot attachment (file build with AI lesson) 

 

Please advise. Thank you.

3.5 chatgpt   generate code (1)
3.5 chatgpt   copy code (1)
3.5 chatgpt   copy code (3)
3.5 chatgpt   copy code (2)
3.5 chatgpt   copy code (4)

 

 
Posted : 10/11/2023 12:49 am
Hasan Aboul Hasan
(@admin)
Posts: 1106
Member Admin
 

That's normal, ChatGPT will never generate the exact same output every time. This is how AI Lanaguge models work.

you can for example continue chatting with it, and tell it that the code didn't work, and giving this is or that error. and it will try to fix it for you.

anyway, here is the endpoint code:

@app.route('/<query>', methods=['GET'])
def autocomplete(query):
    url = f"https://suggestqueries.google.com/complete/search?client=firefox&q={query}"
    response = requests.get(url)
    suggestions = response.json()[1]

    return jsonify(suggestions)

 

 
Posted : 10/11/2023 4:51 am
(@husein)
Posts: 340
Member Moderator
 

@abhinav-singh Hello friend, did you install openAI Module? If you didn't, copy and paste the below line into your terminal and run it:

pip install openai

 
Posted : 10/12/2023 7:45 am
(@starnasrat)
Posts: 9
Active Member
Topic starter
 

@admin Hello Hassan. Appreciate your fast response. I will try your advice, asking chatGPT to rectify my codes for Python. I managed to do no code and I was successful with Xano. Can I build all future API models with Xano or is it advisable to get the know-how in Python?

 
Posted : 10/12/2023 1:59 pm
(@starnasrat)
Posts: 9
Active Member
Topic starter
 

@husein-aboul-hasan Hi. I appreciate you taking the time and interest in replying to my post (predicament). I will try to apply your advice. Thank you, friend.

 
Posted : 10/12/2023 2:01 pm
Hasan Aboul Hasan
(@admin)
Posts: 1106
Member Admin
 

@starnasrat theoretically, you can build complex APIs with Xano, yes. But requires some testing and a learning curve.

anyway, if you have an API idea, I will try my best to help 

 
Posted : 10/13/2023 9:20 am
(@starnasrat)
Posts: 9
Active Member
Topic starter
 

@admin Hi Hassan. Thank you for getting back to me so quickly. I have not got an API idea. I've decided to go through all 56 steps and learn before I build my 1st API. I highly appreciate your offer of assistance. At this moment I have a pressing issue which I would need your advice. I'm on lesson Exercise 2: String and List Operations = Task 2: Create two lists: list1 with elements 1, 2, 3 and list2 with elements 4, 5, 6. Concatenate these lists and print the result. I've viewed your conclusion and I can't get the correct output. What am I doing wrong? I've attached a screenshot for your reference. Thank you in advance.

string and list operations
 
Posted : 10/13/2023 4:05 pm
SSAdvisor
(@ssadvisor)
Posts: 1065
Noble Member
 

@starnasrat your line 17 isn't valid. Were you attempting to print the variable string instead?

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

 
Posted : 10/14/2023 2:01 am
(@starnasrat)
Posts: 9
Active Member
Topic starter
 

@ssadvisor Hello Berney,

I am trying to print the list of variables in lines 19 + 20. What am I doing wrong?

 
Posted : 10/14/2023 8:24 am
Hasan Aboul Hasan
(@admin)
Posts: 1106
Member Admin
 

@starnasrat in line 17, there is an error, are you trying to print? use print instead of string

string ("python" + rock")
 
Posted : 10/14/2023 9:15 am
SSAdvisor
(@ssadvisor)
Posts: 1065
Noble Member
 

@starnasrat you need to modify line 17; perhaps like so

print(string)

this will give you output based on line 16 of

pythonrocks

If you want a space between "python" and "rocks" you'll need to modify line 16 like so

string = "python " + "rocks"

or like so

string = "python" + " rocks"

etc, there are more ways to do this.

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

 
Posted : 10/14/2023 2:08 pm
(@starnasrat)
Posts: 9
Active Member
Topic starter
 

@admin Thank you Hasan

 
Posted : 10/15/2023 3:03 am
(@starnasrat)
Posts: 9
Active Member
Topic starter
 

@ssadvisor Thank you, Earnie

 
Posted : 10/15/2023 3:04 am
Share: