pip install google-generativeai import gradio as gr import google.generativeai as genai genai.configure(api_key="AIzaSyAOLyWRegqB-NxufjTlkyRBhn1ESJE-G38") model = genai.GenerativeModel('gemini-pro') chat = model.start_chat(history=[]) def get_llm_response(message): response = chat.send_message(message) print(response) return response.text # Define Basic information for prompt base_info = """ You are chatbot named "PathFinder", and your work is to give career guidance to the user. \ You first greet the user. \ Then collects the following information one by one: first country, then qualification, then area of interest, then career aspirations \ and then you ask the user if he/she want to find a job or pursuing further studies or want to do a certificate course or to do an internship. \ You respond in a short, very conversational friendly style. \ Search the details online related to the information entered by user \ At last, you ask for the user, if they have any further queries """ find_a_job = """If the user select to find a job, you search on internet and provide available jobs related to the information entered by user.\ You also provide linkedIn assistance and resume building assistance to the user. \ """ further_study = """If the user select to pursue further studies, you provide the relevant courses according to the country and higher studies of the user \ You also provide links of websites to find the top colleges and universities which offers these courses. \ You also provide the entrance exams specific to the user's country (e.g., SAT for US, NEET for India). """ certificate = """If the user select to do a certificate course or diploma course, you search on internet and provide top certificate courses links relevant to the user interest.\ You also ask the user if they want to know more about the course or not. \ """ internship = """If the user select to do a internship, you search on internet and provide available internships related to the information entered by user.\ You also provide linkedIn assistance and resume building assistance to the user. \ """ #create prompt context = [f""" {base_info} \ {find_a_job} \ {further_study} \ {certificate} """] #create welcome message context.append("") response = get_llm_response(context) #define communication function def bot(message, history): prompt = message context.append(prompt) response = get_llm_response(context) context.append(response) return response # create gradio instance demo = gr.ChatInterface(fn=bot, title=response) # launch gradio chatbot demo.launch(debug=True, share=True)