AWS Lambda + ChatGPT API = 🔥

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • You have an AWS Lambda function and now you want to integrate with ChatGPT's API.
    Can you do this in a few steps using the Cloud9 IDE?
    --
    AWS Lambda is a serverless, event-driven compute service that lets you run code for virtually any type of application or backend service without provisioning or managing servers.
    --
    Tutorial Summary:
    - The video demonstrates how to integrate AWS Lambda with the ChatGPT API.
    - The process is explained in a series of steps using the Cloud9 IDE.
    Steps:
    1. Navigate to the Lambda service.
    2. Create a new Lambda function with a Python runtime.
    3. Configure environment variables, including an API key.
    4. Increase the timeout value for the Lambda function to 20 seconds.
    5. In the Code Source tab, copy and paste Python code.
    6. The code imports modules, sets API key, defines message roles, and makes a chat completion call.
    7. It extracts the response and constructs an HTML output.
    8. Deploy the Lambda function, but encounter an issue with the OpenAI module.
    To fix the OpenAI module issue:
    9. Create a Cloud9 environment.
    10. Open the Cloud9 IDE.
    11. Download the Lambda function code.
    12. Install the OpenAI module using pip3.
    13. Upload the Lambda function code back to Lambda.
    14. Adjust the timeout setting to 40 seconds.
    15. Test the Lambda function, and it works.
    16. Check the Lambda output in a web browser, and it displays an interesting fact about New York, which changes with each refresh.

Комментарии • 48

  • @miboso2024
    @miboso2024 4 месяца назад +3

    Nice video, I got stuck with "No module named `pydantic_core._pydantic_core` error", run pip3 -V in your cloud9 ide to get the python version, and use that as the runtime version in your lambda function. Worked for me.

    • @miboso2024
      @miboso2024 4 месяца назад

      @@saipranavvuppala7829 what is your python version?

  • @nelljrbr
    @nelljrbr 8 месяцев назад

    Man! your style is very nice! Both, the way you dress, and the way you explain!

  • @serdarb8995
    @serdarb8995 4 месяца назад +2

    Thank you but I am getting No module named `pydantic_core._pydantic_core` error

  • @gurvirbaraich
    @gurvirbaraich 22 дня назад

    Bro, it's not a tiktok video, try not to bounce as much. Good content by the way! Thanks

  • @michaelbrand2044
    @michaelbrand2044 10 месяцев назад +1

    Bro love your videos

    • @GokceDB
      @GokceDB  10 месяцев назад +1

      Thank you! :)

  • @latheeshvmv
    @latheeshvmv 10 месяцев назад +9

    Sorry, Stop moving around, it's so annoying!!

    • @GokceDB
      @GokceDB  10 месяцев назад +1

      haha, fair enough!

    • @OkiemTaty
      @OkiemTaty 9 месяцев назад +3

      yep, super distracting. don't act so much

  • @patrickevanroach7498
    @patrickevanroach7498 4 месяца назад

    Very nice video, I am having similar issues to many other with pylance it appears there is a hurdle there that could be addressed

  • @OkiemTaty
    @OkiemTaty 9 месяцев назад

    I am getting internal server error at the end after creating function URL. any ideas?

  • @kevinpicado7610
    @kevinpicado7610 10 месяцев назад +1

    awesome!!! 🤯

  • @danielquiroga43
    @danielquiroga43 10 месяцев назад +1

    It says that I'm missing pylance eventhouhg pylance is installed with openai

    • @GokceDB
      @GokceDB  10 месяцев назад

      That’s strange! Perhaps try installing it anyway.

  • @shamsudheenmarakkar7346
    @shamsudheenmarakkar7346 10 месяцев назад +1

    Hey need help
    My lambda give error "message": "Endpoint request timed out" even after changing it to 5 minutes.
    How to solve this?

    • @GokceDB
      @GokceDB  10 месяцев назад +1

      Make sure it works in Playground first: platform.openai.com/playground

    • @shamsudheenmarakkar7346
      @shamsudheenmarakkar7346 10 месяцев назад +1

      @@GokceDB Yes. It does.

    • @GokceDB
      @GokceDB  10 месяцев назад

      @@shamsudheenmarakkar7346 is your Lambda running in a VPC? Does it have access to the internet?

  • @mistrkittty
    @mistrkittty 6 месяцев назад +1

    i'm getting: ""errorMessage": "Unable to import module 'lambda_function': No module named 'pydantic_core._pydantic_core'"" but I see it in the folder when i ls

    • @toute-belle590
      @toute-belle590 5 месяцев назад +1

      I found a GitHub repository that offers an OpenAI layer and solves the issue: "Unable to import module 'lambda_function': No module named 'pydantic_core._pydantic_core'". @Gokce DB, could you create a tutorial on this topic, as we are encountering the same error with the anthropic library.

    • @enricotrivellato2898
      @enricotrivellato2898 4 месяца назад

      Same error here.

    • @toute-belle590
      @toute-belle590 4 месяца назад

      The more easiest, it's to use lambda with bedrock ​@@enricotrivellato2898

  • @umairw235
    @umairw235 7 месяцев назад

    where can I get the lambda script you pasted?

  • @user-nr7qq9cb8k
    @user-nr7qq9cb8k 10 месяцев назад +1

    I love your style, but I need help! I tried twice and get this error when I run the test in Lambda: "Unable to import module 'lambda_function': No module named 'pydantic_core._pydantic_core'",

    • @GokceDB
      @GokceDB  10 месяцев назад

      Try installing this module :)

    • @L12393
      @L12393 10 месяцев назад +1

      same problem here...

    • @GokceDB
      @GokceDB  10 месяцев назад

      @@L12393 did you try installing the module?

    • @L12393
      @L12393 10 месяцев назад

      ​@@GokceDB I tried to pip install pydantic-core and add it to a new layer but the error occurs.

    • @L12393
      @L12393 10 месяцев назад +1

      Hey, did you find a solution? @@GokceDB
      This is the error message when I follow your steps.:
      {
      "errorMessage": "Unable to import module 'lambda_function': No module named 'pydantic_core._pydantic_core'",
      "errorType": "Runtime.ImportModuleError",
      "requestId": "93f7da54-3f7e-41a5-95d2-9038bc158337",
      "stackTrace": []
      }
      The only thing I noticed was that you have a .C9 folder in your environment. Is that related?

  • @Mostafa_Sharaf_4_9
    @Mostafa_Sharaf_4_9 10 месяцев назад +1

    When I open the choose my region and select the lambda function I can't download it , It's not available ..why?

    • @GokceDB
      @GokceDB  10 месяцев назад

      Try python 3.10 for your Lambda function, then try again

    • @Mostafa_Sharaf_4_9
      @Mostafa_Sharaf_4_9 10 месяцев назад +1

      "errorMessage": "Unable to import module 'lambda_function': No module named 'pydantic_core._pydantic_core'",
      this error happened in your method and it is also happened when I used layers ...this error would kill me @@GokceDB

    • @GokceDB
      @GokceDB  10 месяцев назад

      @@Mostafa_Sharaf_4_9 that's weird. Try installing this module.

    • @mistrkittty
      @mistrkittty 6 месяцев назад

      I downgraded the python version and it worked.

  • @muhammadaasimsoomro4971
    @muhammadaasimsoomro4971 8 месяцев назад

    can we use langchain along with vector db ?

  • @data-IndieHacker
    @data-IndieHacker 4 месяца назад

    you"re the best

  • @OkiemTaty
    @OkiemTaty 9 месяцев назад +6

    too much showmanship...

    • @GokceDB
      @GokceDB  9 месяцев назад +2

      Sorry

  • @anirban6310
    @anirban6310 5 месяцев назад

    the cloud9 isnt connecting for me

  • @JavierHernandez-xo5nb
    @JavierHernandez-xo5nb 10 месяцев назад +1

    Exelente

  • @davegamesuk
    @davegamesuk 3 месяца назад

    No way this guy isn't AI generated