Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
Let's code the function to return LLM response!
Define a function get_response
that generates a response based on the input question. It will take question, organization_name, organization_info, contact_info as input:
def get_response(question, organization_name, organization_info, contact_info):
Now write further code inside this function.
Initialize chat_history. Here, we initialize chat_history as an empty string for this demonstration. But you can pass the conversation here:
chat_history = ""
Invoke/Run the chain we created and store the output in a variable response
:
chain = make_chain()
response = chain({"question": question, "chat_history": chat_history,
"organization_name": organization_name, "contact_info": contact_info,
"organization_info": organization_info})
response
is a directory storing several values. We just need to return the 'answer'. Try exploring what all the response
directory includes:
return response['answer']
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...