From the course: Advanced Python Projects: Build AI Applications
Unlock the full course today
Join today to access over 25,200 courses taught by industry experts.
Generate chat responses using GPT-3.5 and Langchain - Python Tutorial
From the course: Advanced Python Projects: Build AI Applications
Generate chat responses using GPT-3.5 and Langchain
- [Instructor] Here we're defining a pedantic model named ChatMessageSent using the base model class. Next, we create a function named get response that takes several parameters. This is the name of the file to load data from. This is the session ID for tracking conversation history. This is the user query or question to be used in the conversation. Here we're using the model GPT-3.5 Turbo 16K, and then we're setting the temperature of the model to zero. Temperature parameter is to control the response randomness. The default is set to Zero, which produces a very stable or less random response. Then we print the file name and update it by extracting the last part after the slash using this line over here. So overall, this function generates a response using a conversational model like GPT-3.5 Turbo. It takes a final name to load data, a session ID to track the conversation, a query or question, and optional parameters for…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Setting up MongoDB4m 24s
-
(Locked)
Generate chat responses using GPT-3.5 and Langchain2m 46s
-
(Locked)
Load conversation history for a given session ID1m 16s
-
(Locked)
Create new sessions and add chat history to existing sessions1m 11s
-
(Locked)
Setup FastAPI app, CORS, S3 session, and obtain a chat response3m 43s
-
(Locked)
Upload files to Amazon S3 storage bucket2m 39s
-
(Locked)
Deploy and run the chatbot4m 2s
-
(Locked)
Challenge: Complete the backend code for file upload2m 13s
-
(Locked)
Solution: Complete the backend code for file upload9m 52s
-
(Locked)
-
-