Spaces:
Paused
Paused
Commit
·
46d4994
1
Parent(s):
7936edc
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,8 @@ from langchain.chains.conversation.memory import (ConversationBufferMemory,
|
|
| 17 |
|
| 18 |
app = Flask(__name__)
|
| 19 |
|
|
|
|
|
|
|
| 20 |
# Set up the LangChain
|
| 21 |
|
| 22 |
template = """Answer the question based on the context below.
|
|
@@ -43,14 +45,12 @@ prompt = PromptTemplate(
|
|
| 43 |
|
| 44 |
llm35 = ChatOpenAI(
|
| 45 |
temperature=0.2,
|
| 46 |
-
openai_api_key='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',
|
| 47 |
model_name='gpt-3.5-turbo',
|
| 48 |
max_tokens=128
|
| 49 |
)
|
| 50 |
|
| 51 |
llm30 = OpenAI(
|
| 52 |
-
temperature=0.1,
|
| 53 |
-
openai_api_key='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',
|
| 54 |
max_tokens=128
|
| 55 |
)
|
| 56 |
|
|
@@ -64,7 +64,13 @@ conversations = ConversationChain(
|
|
| 64 |
)
|
| 65 |
|
| 66 |
# Set up the Salesforce API
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
#print(sf.headers)
|
| 69 |
print("Successfully Connected to Salesforce")
|
| 70 |
|
|
@@ -115,7 +121,7 @@ def process_input():
|
|
| 115 |
return str(response)
|
| 116 |
|
| 117 |
# For Case Summary and Subject
|
| 118 |
-
openai.api_key =
|
| 119 |
|
| 120 |
def get_case_summary(conv_detail):
|
| 121 |
chatresponse_desc = openai.ChatCompletion.create(
|
|
|
|
| 17 |
|
| 18 |
app = Flask(__name__)
|
| 19 |
|
| 20 |
+
os.environ['OPENAI_API_KEY'] = os.environ.get("OPENAI_KEY")
|
| 21 |
+
|
| 22 |
# Set up the LangChain
|
| 23 |
|
| 24 |
template = """Answer the question based on the context below.
|
|
|
|
| 45 |
|
| 46 |
llm35 = ChatOpenAI(
|
| 47 |
temperature=0.2,
|
|
|
|
| 48 |
model_name='gpt-3.5-turbo',
|
| 49 |
max_tokens=128
|
| 50 |
)
|
| 51 |
|
| 52 |
llm30 = OpenAI(
|
| 53 |
+
temperature=0.1,
|
|
|
|
| 54 |
max_tokens=128
|
| 55 |
)
|
| 56 |
|
|
|
|
| 64 |
)
|
| 65 |
|
| 66 |
# Set up the Salesforce API
|
| 67 |
+
|
| 68 |
+
sf_user = os.environ.get("SF_USER")
|
| 69 |
+
sf_pwd = os.environ.get("SF_PWD")
|
| 70 |
+
sf_token = os.environ.get("SF_TOKEN")
|
| 71 |
+
sf_instance = os.environ.get("SF_INSTANCE")
|
| 72 |
+
|
| 73 |
+
sf = Salesforce(username=sf_user, password=sf_pwd, security_token=sf_token,instance_url=sf_instance)
|
| 74 |
#print(sf.headers)
|
| 75 |
print("Successfully Connected to Salesforce")
|
| 76 |
|
|
|
|
| 121 |
return str(response)
|
| 122 |
|
| 123 |
# For Case Summary and Subject
|
| 124 |
+
openai.api_key = os.environ.get("OPENAI_KEY")
|
| 125 |
|
| 126 |
def get_case_summary(conv_detail):
|
| 127 |
chatresponse_desc = openai.ChatCompletion.create(
|