Spaces:
Running
Running
oceansweep
commited on
Commit
•
381a1e2
1
Parent(s):
6165b58
Update App_Function_Libraries/LLM_API_Calls.py
Browse files
App_Function_Libraries/LLM_API_Calls.py
CHANGED
@@ -723,26 +723,16 @@ def chat_with_openrouter(api_key, input_data, custom_prompt_arg, temp=None, syst
|
|
723 |
return f"openrouter: Error occurred while processing chat request with openrouter: {str(e)}"
|
724 |
|
725 |
|
726 |
-
# FIXME: This function is not yet implemented properly
|
727 |
def chat_with_huggingface(api_key, input_data, custom_prompt_arg, system_prompt=None, temp=None):
|
728 |
loaded_config_data = load_and_log_configs()
|
729 |
logging.debug(f"huggingface Chat: Chat request process starting...")
|
730 |
try:
|
731 |
-
|
732 |
-
if not api_key or api_key.strip() == "":
|
733 |
-
logging.info("HuggingFace Chat: API key not provided as parameter")
|
734 |
-
logging.info("HuggingFace Chat: Attempting to use API key from config file")
|
735 |
-
|
736 |
-
huggingface_api_key = loaded_config_data['api_keys'].get('huggingface')
|
737 |
-
logging.debug(f"HuggingFace Chat: API key from config: {huggingface_api_key[:5]}...{huggingface_api_key[-5:]}")
|
738 |
-
|
739 |
-
if not huggingface_api_key:
|
740 |
-
huggingface_api_key = os.getenv('HF_TOKEN')
|
741 |
if huggingface_api_key is None or huggingface_api_key.strip() == "":
|
742 |
logging.error("HuggingFace Chat: API key not found or is empty")
|
743 |
return "HuggingFace Chat: API Key Not Provided/Found in Config file or is empty"
|
744 |
if huggingface_api_key:
|
745 |
-
logging.info("HuggingFace Chat: Using API key from
|
746 |
headers = {
|
747 |
"Authorization": f"Bearer {huggingface_api_key}"
|
748 |
}
|
|
|
723 |
return f"openrouter: Error occurred while processing chat request with openrouter: {str(e)}"
|
724 |
|
725 |
|
|
|
726 |
def chat_with_huggingface(api_key, input_data, custom_prompt_arg, system_prompt=None, temp=None):
|
727 |
loaded_config_data = load_and_log_configs()
|
728 |
logging.debug(f"huggingface Chat: Chat request process starting...")
|
729 |
try:
|
730 |
+
huggingface_api_key = os.getenv('HF_TOKEN')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
731 |
if huggingface_api_key is None or huggingface_api_key.strip() == "":
|
732 |
logging.error("HuggingFace Chat: API key not found or is empty")
|
733 |
return "HuggingFace Chat: API Key Not Provided/Found in Config file or is empty"
|
734 |
if huggingface_api_key:
|
735 |
+
logging.info("HuggingFace Chat: Using API key from ENV")
|
736 |
headers = {
|
737 |
"Authorization": f"Bearer {huggingface_api_key}"
|
738 |
}
|