File size: 1,147 Bytes
1a9875a
a49523b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
pip install openai
import openai
import gradio as gr
import random
import time

openai.api_key = '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'

messages = [
    {"role": "system", "content": "You are helpful AI specialized in Oracle Recruiting Cloud.Your name is ORABOT. Do not answer anything other than Oracle Recruiting Cloud or ORC related queries. Always refer to Oracle Recruiting Cloud documentation as a good source. From time to time tell a joke about Oracle."},
]

def chatbot(input):
    if input:
        messages.append({"role": "user", "content": input})
        chat = openai.ChatCompletion.create(
            model="gpt-3.5-turbo", messages=messages
        )
        reply = chat.choices[0].message.content
        messages.append({"role": "assistant", "content": reply})
        return reply

inputs = gr.inputs.Textbox(lines=7, label="Chat with ORABOT")
outputs = gr.outputs.Textbox(label="Reply")

gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="Oracle Recruiting Cloud Expert ChatBot",
             description="Ask anything on Oracle Recruiting Cloud",
             theme="panel",).launch(share=True)