|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import streamlit as st |
|
from pprint import pprint |
|
from agents import agentController , salesAgent, chinookAgent, chatAgent, \ |
|
GEN_TYPE |
|
|
|
|
|
|
|
st.set_page_config(page_title="Global", |
|
page_icon=":store:", |
|
layout="wide") |
|
st.header("π¦ Global ποΈ") |
|
|
|
col1, col2 = st.columns([1,1]) |
|
|
|
with col1: |
|
option_llm = st.selectbox( |
|
"Model", |
|
('text-davinci-003', |
|
'text-babbage-001', |
|
'text-curie-001', |
|
'text-ada-001', |
|
'gpt-4', |
|
'gpt-3.5-turbo', |
|
'google/flan-t5-xl', |
|
'databricks/dolly-v2-3b', |
|
'bigscience/bloom-1b7') |
|
) |
|
with col2: |
|
option_mode = st.selectbox( |
|
"LLM mode", |
|
("Instruct (all)", |
|
"Chat (high temperature)", |
|
"Wolfram-Alpha", |
|
"Internal-Sales", |
|
"Internal-Merchant" |
|
) |
|
) |
|
|
|
def get_question(): |
|
input_text = st.text_area(label="Your question ...", |
|
placeholder="Ask me anything ...", |
|
key="question_text", label_visibility="collapsed") |
|
return input_text |
|
|
|
question_text = get_question() |
|
if question_text and len(question_text) > 1: |
|
output="" |
|
outputType=GEN_TYPE.deterministic |
|
if option_mode == "Internal-Sales": |
|
|
|
output = salesAgent(question_text) |
|
elif option_mode == "Internal-Merchant": |
|
|
|
output = chinookAgent(question_text, option_llm) |
|
elif option_mode.startswith("Chat"): |
|
|
|
response = chatAgent(question_text) |
|
if response and response.content: |
|
output = response.content |
|
else: |
|
output = response |
|
else: |
|
output, outputType = agentController(question_text, option_llm) |
|
|
|
height = min(2*len(output), 240) |
|
st.text_area(label=str(outputType) , |
|
value=output, height=height) |
|
|
|
|
|
|
|
st.markdown( |
|
""" |
|
<style> |
|
textarea[aria-label^="ex"] { |
|
font-size: 0.8em !important; |
|
font-family: Arial, sans-serif !important; |
|
color: gray !important; |
|
} |
|
</style> |
|
""", |
|
unsafe_allow_html=True, |
|
) |
|
|
|
st.markdown("#### 3 types of reasoning:") |
|
col1, col2, col3 = st.columns([1,1,1]) |
|
|
|
with col1: |
|
st.markdown("__Common sense reasoning__") |
|
st.text_area(label="ex1", label_visibility="collapsed", height=150, |
|
value="πΉ Write a warm intro email about Salesforce to a CIO.\n" + |
|
"πΉ What are key selling points about Salesforce Commerce Cloud?\n" + |
|
"πΉ Write a socially conscious business plan for a new granola bar venture in South America." |
|
) |
|
|
|
with col2: |
|
st.markdown("__Trusted (local) reasoning__") |
|
st.text_area(label="ex2", label_visibility="collapsed", height=150, |
|
value="πΉ What is the targeted 2024 non-GAAP operating margin for Salesforce?\n" + |
|
"πΉ What are our sales broken down by month for EMEA? Output one monthly sale per line\n" + |
|
"πΉ How many total artists are there in each genre in our digital media database? Output one genre per line\n" + |
|
"πΉ How to best govern a city? (The Prince)\n" + |
|
"πΉ How to win a war? (Art of War)", |
|
) |
|
|
|
with col3: |
|
st.markdown("__Enhanced reasoning__ [π΅](https://www.youtube.com/watch?v=hTTUaImgCyU&t=62s)") |
|
st.text_area(label="ex3", label_visibility="collapsed", height=150, |
|
value="πΉ Write an apology email to a client for our product's recent outage, " + |
|
"an offer for a 10% discount on our sales to them in May " + |
|
"(include total discount amount), and an invitation to attend an SIC " + |
|
"in San Francisco with a brief note on the current temperature. " + |
|
"Finish with a note wishing the client's family the best.\n" |
|
"πΉ Who is the president of South Korea? " + |
|
"What is his favorite song? How old is he? " + |
|
"What is the smallest prime greater than his age?\n" + |
|
"πΉ What is the derivative of f(x)=3*log(x)*sin(x)?") |
|
|
|
st.image(image="images/plugins.png", width=700, caption="salesforce.com") |
|
st.image(image="images/chinook.png", width=420, caption="Digital Media Schema") |
|
|
|
|
|
|