Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -67,12 +67,22 @@ def IBM_chat (messages):
|
|
67 |
response = response.json()
|
68 |
return response["choices"][0]["message"]["content"]
|
69 |
|
|
|
|
|
|
|
|
|
70 |
def get_credentials():
|
71 |
return {
|
72 |
"url" : "https://us-south.ml.cloud.ibm.com",
|
73 |
"apikey" : os.getenv("IBM_API_KEY")
|
74 |
}
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
from ibm_watsonx_ai.client import APIClient
|
77 |
from ibm_watsonx_ai.foundation_models.embeddings.sentence_transformer_embeddings import SentenceTransformerEmbeddings
|
78 |
|
@@ -249,7 +259,7 @@ if st.sidebar.button("🔗 Connect with IBM Chat"):
|
|
249 |
|
250 |
# Get response from IBM
|
251 |
with st.spinner("Analyzing..."):
|
252 |
-
result =
|
253 |
query = "Find 3 projects that best match these criteria: " + result
|
254 |
st.session_state["extended_query"] = query
|
255 |
else:
|
|
|
67 |
response = response.json()
|
68 |
return response["choices"][0]["message"]["content"]
|
69 |
|
70 |
+
def IBM_query (prompt):
|
71 |
+
messages = [{"role": "user", "content": prompt}]
|
72 |
+
return IBM_chat(messages)
|
73 |
+
|
74 |
def get_credentials():
|
75 |
return {
|
76 |
"url" : "https://us-south.ml.cloud.ibm.com",
|
77 |
"apikey" : os.getenv("IBM_API_KEY")
|
78 |
}
|
79 |
|
80 |
+
##############################################
|
81 |
+
##
|
82 |
+
## Vector DB
|
83 |
+
##
|
84 |
+
##############################################
|
85 |
+
|
86 |
from ibm_watsonx_ai.client import APIClient
|
87 |
from ibm_watsonx_ai.foundation_models.embeddings.sentence_transformer_embeddings import SentenceTransformerEmbeddings
|
88 |
|
|
|
259 |
|
260 |
# Get response from IBM
|
261 |
with st.spinner("Analyzing..."):
|
262 |
+
result = IBM_query(prompt)
|
263 |
query = "Find 3 projects that best match these criteria: " + result
|
264 |
st.session_state["extended_query"] = query
|
265 |
else:
|