Home Artists Posts Import Register

Downloads

Content

This is for video: https://youtu.be/NxvhDPMF9SU

NOTE: from_scratch folder in the code files is an easier implementation of the main UI chatbot with memory

BONUS video for this:

Miniconda: 'https://docs.conda.io/en/latest/miniconda.htmlChat completions doc: https://platform.openai.com/docs/guides/chat/introduction


Prompt from the video:

Follow these instructions carefully: We will create python backend with fastapi and a javascript frontend for a chatbot. think step by step so you eliminate any possible errors. implement middleware with cors.  outline any pip installs that needs to be done. Just use FastAPI, Uvicorn and openai. use a seperate js script file give instructions on how to run the server.  we will make calls to gpt-3.5-turbo cals to openai api as: "# Note: you need to be using OpenAI Python v0.27.0 for the code below to work import openai  openai.ChatCompletion.create(   model="gpt-3.5-turbo",   messages=[         {"role": "system", "content": "You are a helpful assistant."},         {"role": "user", "content": "Who won the world series in 2020?"},         {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},         {"role": "user", "content": "Where was it played?"}     ] )" sample response from api is: "{  'id': 'chatcmpl-6p9XYPYSTTRi0xEviKjjilqrWU2Ve',  'object': 'chat.completion',  'created': 1677649420,  'model': 'gpt-3.5-turbo',  'usage': {'prompt_tokens': 56, 'completion_tokens': 31, 'total_tokens': 87},  'choices': [    {     'message': {       'role': 'assistant',       'content': 'The 2020 World Series was played in Arlington, Texas at the Globe Life Field, which was the new home stadium for the Texas Rangers.'},     'finish_reason': 'stop',     'index': 0    }   ] } User's message will be sent to the pyton backend and the response from api will return to the browser. write the html and css to make the website for the chatbot beautiful and elegant


Comments

Michal Babula

I will try to build it.

echohive42

Code to each file should work as long as you have the dependencies installed. Try and improve on it! :)

Michal Babula

I may have a problem with setting virtual environment in VC. I usually test my simple js apps at https://codepen.io. Fortunately, we have chatGPT4 and we can ask for help:)