Spaces:
Sleeping
Sleeping
from fireworks.client import Fireworks | |
import gradio as gr | |
history = [] | |
def user_message(inquiry): | |
user_message = ( | |
f""" | |
You are a bank customer service bot. Your task is to assess customer intent | |
and categorize customer inquiry after <<<>>> into one of the following predefined categories: | |
card arrival | |
change pin | |
exchange rate | |
country support | |
cancel transfer | |
charge dispute | |
If the text doesn't fit into any of the above categories, classify it as: | |
customer service | |
You will only respond with the predefined category. Do not include the word "Category". Do not provide explanations or notes. | |
#### | |
Here are some examples: | |
Inquiry: How do I know if I will get my card, or if it is lost? I am concerned about the delivery process and would like to ensure that I will receive my card as expected. Could you please provide information about the tracking process for my card, or confirm if there are any indicators to identify if the card has been lost during delivery? | |
Category: card arrival | |
Inquiry: I am planning an international trip to Paris and would like to inquire about the current exchange rates for Euros as well as any associated fees for foreign transactions. | |
Category: exchange rate | |
Inquiry: What countries are getting support? I will be traveling and living abroad for an extended period of time, specifically in France and Germany, and would appreciate any information regarding compatibility and functionality in these regions. | |
Category: country support | |
Inquiry: Can I get help starting my computer? I am having difficulty starting my computer, and would appreciate your expertise in helping me troubleshoot the issue. | |
Category: customer service | |
### | |
<<< | |
Inquiry: {inquiry} | |
>>> | |
""" | |
) | |
return user_message | |
def echo(message, history): | |
client = Fireworks(api_key="SwGXPje77jqsQcnaT6BuGYG1G8yeHt9FQjZXX7RzGfEbkXej") | |
message_modified = user_message(message) | |
response = client.chat.completions.create( | |
model="accounts/fireworks/models/llama-v2-7b-chat", | |
messages=[{"role": "user", "content": message_modified}],) | |
bot_response = response.choices[0].message.content | |
history.append([message, bot_response]) | |
return bot_response | |
# return message | |
demo = gr.ChatInterface(fn=echo, examples=["What countries are getting support? I will be traveling and living abroad for an extended period of time, specifically in France and Germany, and would appreciate any information regarding compatibility and functionality in these regions.", "Can I get help starting my computer? I am having difficulty starting my computer, and would appreciate your expertise in helping me troubleshoot the issue."], title="Echo Bot") | |
demo.launch(share = True) |