Hi all,
I'm trying to follow your example to set up Cortex Analyst on a streamlit app and was initially able to get results but after Nov 12, I'm getting a new error. "Unauthorized to call Cortex Analyst"

this is what it looked like before:

I'm using the code from
|
resp = _snowflake.send_snow_api_request( |
resp = _snowflake.send_snow_api_request(
"POST", # method
API_ENDPOINT, # path
{}, # headers
{}, # params
request_body, # body
None, # request_guid
API_TIMEOUT, # timeout in milliseconds
)
My app is being deployed in development mode to snowflake.
From reading the code in this repo, I'm under the impression that the code above should include authentication under the hood, else the examples here wouldn't work.
Additionally, I went ahead and attempted to fetch from the api outside of snowflake / streamlit by using the following code:
resp = requests.post(
url=f"https://{host}/api/v2/cortex/analyst/message",
json=request_body,
headers={
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
"X-Snowflake-Authorization-Token-Type": "KEYPAIR_JWT",
},
)
where host is the https://{account_identifier}.snowflakecomputing.com
and I got a successful response.
I attempted to pass in the same headers to the _snowflake.send_snow_api_request but kept getting the same Unauthorized to call Cortex Analyst response.
Please let me know a good way to interact with the Cortex Analyst api within Snowflake / Streamlit.
Mauricio
Hi all,
I'm trying to follow your example to set up Cortex Analyst on a streamlit app and was initially able to get results but after Nov 12, I'm getting a new error. "Unauthorized to call Cortex Analyst"
this is what it looked like before:

I'm using the code from
sfguide-getting-started-with-cortex-analyst/cortex_analyst_sis_demo_app.py
Line 150 in 4faa4cc
My app is being deployed in development mode to snowflake.
From reading the code in this repo, I'm under the impression that the code above should include authentication under the hood, else the examples here wouldn't work.
Additionally, I went ahead and attempted to fetch from the api outside of snowflake / streamlit by using the following code:
where host is the https://{account_identifier}.snowflakecomputing.com
and I got a successful response.
I attempted to pass in the same headers to the
_snowflake.send_snow_api_requestbut kept getting the sameUnauthorized to call Cortex Analystresponse.Please let me know a good way to interact with the Cortex Analyst api within Snowflake / Streamlit.
Mauricio