Hi everyone,
We had some code in our Python functions repository that was working fine a few weeks ago, but it’s recently stopped working. I noticed there was a recent update to the Ontology SDK: https://www.palantir.com/docs/foundry/announcements/#manage-platform-sdk-access-in-developer-console. Could that be causing the issue?
I’ve pasted the error message below. Has anyone encountered a similar problem, or can anyone offer guidance?
Thanks in advance for your help,
Jenny
EnvironmentNotConfigured: Unable to configure client: please pass in values to FoundryClient, or set the context variable in foundry_sdk_runtime, or set one of the following environment variables: FOUNDRY_PYTHON_OSDK_HOSTNAME, FOUNDRY_HOSTNAME..
Error Parameters: {}
Traceback (most recent call last):
File "function_context.py", line 83, in run_function
File "/app/var/data/conda-env/lib/python3.12/site-packages/functions/api/_function.py", line 79, in __call__
raise err
File "/app/var/data/conda-env/lib/python3.12/site-packages/functions/api/_function.py", line 77, in __call__
return self._function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/python_functions/file.py", line 206, in search
docs = get_results_hlpr(query, ["policies_html"], rater_chain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/python_functions/file.py", line 141, in get_results_hlpr
doc_results = list(
^^^^^
File "/app/var/data/conda-env/lib/python3.12/concurrent/futures/_base.py", line 619, in result_iterator
yield _result_or_cancel(fs.pop())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/concurrent/futures/_base.py", line 317, in _result_or_cancel
return fut.result(timeout)
^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/app/var/data/conda-env/lib/python3.12/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/python_functions/file.py", line 138, in get_results_unwrap
return get_doc_type_results(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/python_functions/file.py", line 105, in get_doc_type_results
retriever = get_doc_retriver(doc_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/python_functions/embed_documents.py", line 64, in get_doc_retriver
embeddings_map = get_embeddings_map()
^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/python_functions/embed_documents.py", line 41, in get_embeddings_map
client = FoundryClient()
^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/ontology_sdk/_foundry_client.py", line 30, in __init__
super().__init__(
File "/app/var/data/conda-env/lib/python3.12/site-packages/foundry_sdk_runtime/client/foundry_client_base_class.py", line 25, in __init__
self._hostname = hostname or FoundryClientBaseClass._init_hostname_from_env()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/foundry_sdk_runtime/client/foundry_client_base_class.py", line 42, in _init_hostname_from_env
return get_value_from_context_or_env(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/var/data/conda-env/lib/python3.12/site-packages/foundry_sdk_runtime/client_config_helpers.py", line 34, in get_value_from_context_or_env
raise EnvironmentNotConfigured(
foundry_sdk_runtime.errors.environment_not_configured.EnvironmentNotConfigured: Unable to configure client: please pass in values to FoundryClient, or set the context variable in foundry_sdk_runtime, or set one of the following environment variables: FOUNDRY_PYTHON_OSDK_HOSTNAME, FOUNDRY_HOSTNAME.