33# Copyright (C) 2024 Intel Corporation
44# SPDX-License-Identifier: Apache-2.0
55
6- # ==============================================================================
7- # Environment Configuration for DeepResearchAgent on Intel Gaudi HPU
8- # ==============================================================================
9-
10- # Get the directory where this script is located
6+ # Navigate to the parent directory and source the environment
117SCRIPT_DIR=" $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd) "
128
13- # Source the parent environment configuration file
149pushd " $SCRIPT_DIR /../../../../../" > /dev/null
1510source .set_env.sh
1611popd > /dev/null
1712
18- # ------------------------------------------------------------------------------
19- # Helper Functions
20- # ------------------------------------------------------------------------------
21-
22- # Validates that a required environment variable is set
13+ # Function to check if a variable is set
2314check_var () {
2415 local var_name=" $1 "
2516 local var_value=" ${! var_name} "
2617 if [ -z " ${var_value} " ]; then
2718 echo " Error: ${var_name} is not set. Please set ${var_name} ."
28- return 1 # Return error but don't exit to allow other checks to run
19+ return 1 # Return an error code but do not exit the script
2920 fi
3021}
3122
32- # ------------------------------------------------------------------------------
33- # Validate Required API Keys
34- # ------------------------------------------------------------------------------
35-
36- check_var " HF_TOKEN" # HuggingFace token for model access
37- check_var " TAVILY_API_KEY" # Tavily API key for web search functionality
38-
39- # ------------------------------------------------------------------------------
40- # Network Configuration
41- # ------------------------------------------------------------------------------
42-
43- # Detect the primary IP address of the host machine
23+ # Check critical variables
24+ check_var " HF_TOKEN"
4425export ip_address=$( hostname -I | awk ' {print $1}' )
45- export HOST_IP=${ip_address}
4626
47- # Update proxy settings to include the host IP
48- export no_proxy=${no_proxy} ,${ip_address}
49- export http_proxy=${http_proxy}
50- export https_proxy=${https_proxy}
51-
52- # ------------------------------------------------------------------------------
53- # vLLM Service Configuration
54- # ------------------------------------------------------------------------------
55-
56- # Port where vLLM service will be accessible
27+ # VLLM configuration
5728export VLLM_PORT=" ${VLLM_PORT:- 8000} "
58-
59- # ------------------------------------------------------------------------------
60- # Language Model Configuration
61- # ------------------------------------------------------------------------------
62-
63- # LLM model to use for the Deep Research Agent
64- # See supported models and tool call parsers at:
65- # https://docs.vllm.ai/en/stable/features/tool_calling/#automatic-function-calling
29+ export VLLM_VOLUME=" ${VLLM_VOLUME:-/ data2/ huggingface} "
30+ export VLLM_IMAGE=" ${VLLM_IMAGE:- opea/ vllm-gaudi: latest} "
6631export LLM_MODEL_ID=" ${LLM_MODEL_ID:- meta-llama/ Llama-3.3-70B-Instruct} "
67-
68- # Parser for handling function/tool calls (must match the model)
69- export TOOL_CALL_PARSER=" ${TOOL_CALL_PARSER:- llama3_json} "
70-
71- # Maximum sequence length for model context (131072 = ~128K tokens)
7232export MAX_LEN=" ${MAX_LEN:- 131072} "
73-
74- # Number of Gaudi accelerator cards to use
7533export NUM_CARDS=" ${NUM_CARDS:- 4} "
76-
77- # Directory for caching HuggingFace models
7834export HF_CACHE_DIR=" ${HF_CACHE_DIR:- " ./data" } "
35+ export OPENAI_BASE_URL=" http://${ip_address} :8000/v1"
36+ export OPENAI_API_KEY=" empty"
37+ export no_proxy=${no_proxy}
38+ export http_proxy=${http_proxy}
39+ export https_proxy=${https_proxy}
7940
80- # OpenAI-compatible API endpoint URL for vLLM
81- export OPENAI_BASE_URL=" http://${ip_address} :${VLLM_PORT} /v1"
82-
83- # ------------------------------------------------------------------------------
84- # API Keys and Authentication
85- # ------------------------------------------------------------------------------
86-
87- export HF_TOKEN=" ${HF_TOKEN} " # HuggingFace authentication token
88- export OPENAI_API_KEY=" empty-api-key" # Placeholder for vLLM compatibility
89- export TAVILY_API_KEY=" ${TAVILY_API_KEY} " # Tavily search API key
90-
91- # ------------------------------------------------------------------------------
92- # Deep Research Agent Configuration
93- # ------------------------------------------------------------------------------
94-
95- # Maximum number of research units that can run concurrently
96- export MAX_CONCURRENT_RESEARCH_UNITS=" ${MAX_CONCURRENT_RESEARCH_UNITS:- 3} "
9741
98- # Maximum iterations per researcher before stopping
99- export MAX_RESEARCHER_ITERATIONS =" ${MAX_RESEARCHER_ITERATIONS :- 3 } "
42+ # Hugging Face API token
43+ export HF_TOKEN =" ${HF_TOKEN } "
10044
101- # Custom instructions for agent behavior (leave empty for defaults)
102- export RESEARCHER_INSTRUCTIONS=" " # Instructions for individual researchers
103- export RESEARCH_WORKFLOW_INSTRUCTIONS=" " # Instructions for overall research workflow
104- export SUBAGENT_DELEGATION_INSTRUCTIONS=" " # Instructions for task delegation between agents
45+ # API keys
46+ check_var " TAVILY_API_KEY"
47+ export TAVILY_API_KEY=" ${TAVILY_API_KEY} "
0 commit comments